smallbasic에서 c# IDE

c#에서 parallel을하고 싶었기 때문에 IDE를 만들었습니다.

이미지





샘플 코드


C = Text.GetCharacter(34)
R = Text.GetCharacter(13) + Text.GetCharacter(10)
code = ""
GraphicsWindow.BackgroundColor = "skyblue"
button1 = Controls.AddButton("caption", 350, 400)
Controls.SetButtonCaption(button1, "clr")
button0 = Controls.AddButton("caption", 300, 400)
Controls.SetButtonCaption(button0, "csc")
textbox = Controls.AddTextBox(10, 400)
Controls.SetTextBoxText(textbox, "main.cs")
mtextbox = Controls.AddMultiLineTextBox(0, 0)
Controls.HideControl(mtextbox)
Controls.SetSize(mtextbox, 580, 380) 
Controls.SetTextBoxText(mtextbox, code)
Controls.Move(mtextbox, 10, 10)
Controls.ShowControl(mtextbox)
Controls.ButtonClicked = output
Sub output
  button = Controls.LastClickedButton
  If (button = button1) Then
    Controls.SetTextBoxText(mtextbox, "")
  ElseIf (button = button0) Then
    file = "c:\cs\" + Controls.GetTextBoxText(textbox)
    text = Controls.GetTextBoxText(mtextbox)
    File.WriteContents(file, text)
    csc = "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\csc.exe"
    code = ""
    code = code + "Function setup(a)" + R 
    code = code + "Set obj = CreateObject(" + C + "WScript.Shell" + C + ")" + R
    code = code + "  obj.run " + C + "cmd /K CD c:\cs & " + csc + " " + file + " & main.exe" + C + R
    code = code + "setup = "  + C + C + R
    code = code + "End Function" + R
    a = Class1.VBSrun(code)
  endif
EndSub

샘플 코드


using System;
using System.Threading.Tasks;

namespace Hello
{
    class Hello
    {
        static void Main(string[] args) 
        {
            double total = 0;
            Parallel.For(0, 100000, item => {
                total += Math.Pow(item, 2);
            });
            Console.WriteLine("result: 333328333350000");
            Console.WriteLine("result: {0}", total);
            Console.ReadKey();
        }
    }
}

좋은 웹페이지 즐겨찾기