Beispiel #1
0
        public bool Check()
        {
            ClearOutput();
            var code        = CodeTextBox.Text.Trim();
            var selected    = EntryToolStripComboBox.Text;
            var engine      = new DcEngine(code, CurrentLanguage, string.Empty);
            var entryPoints = engine.GetEntryPoints(true);

            if (engine.ErrorsLog.Length > 0)
            {
                ErrorsTextBox.AppendText(engine.ErrorsLog.ToString());
            }
            EntryToolStripComboBox.Items.Clear();
            if (entryPoints.Length > 0)
            {
                EntryToolStripComboBox.Items.AddRange(entryPoints);
            }
            if (EntryToolStripComboBox.Items.Contains(selected))
            {
                EntryToolStripComboBox.Text = selected;
            }
            else if (EntryToolStripComboBox.Items.Count == 1)
            {
                EntryToolStripComboBox.Text = EntryToolStripComboBox.Items.Cast <string>().First();
            }
            if (AutoRunToolStripButton.Checked && EntryToolStripComboBox.Text.Length > 0)
            {
                Run();
            }
            return(true);
        }
Beispiel #2
0
        public void Run(params object[] parameters)
        {
            var code  = CodeTextBox.Text.Trim();
            var entry = EntryToolStripComboBox.Text;

            if (code == "")
            {
                return;
            }
            if (entry == "")
            {
                entry = "Main";
            }
            var engine  = new DcEngine(code, CurrentLanguage, entry);
            var results = engine.Run(parameters);

            if (results == null)
            {
                OutputTextBox.Text = "null";
            }
            else if (results.GetType() == typeof(string))
            {
                OutputTextBox.Text = (string)results;
            }
            else if (results.GetType().FullName.StartsWith("System.Collections.Generic.List"))
            {
                OutputDataGridView.Dock = DockStyle.Fill;
                OutputDataGridView.BringToFront();
                OutputDataGridView.DataSource = results;
            }
            else
            {
                OutputTextBox.Dock = DockStyle.Fill;
                OutputTextBox.BringToFront();
                OutputTextBox.Text = results.GetType().FullName;
            }
            if (engine.ErrorsLog.Length > 0)
            {
                ErrorsTextBox.Text = engine.ErrorsLog.ToString();
            }
        }
Beispiel #3
0
 public bool Check()
 {
     ClearOutput();
     var code = CodeTextBox.Text.Trim();
     var selected = EntryToolStripComboBox.Text;
     var engine = new DcEngine(code, CurrentLanguage, string.Empty);
     var entryPoints = engine.GetEntryPoints(true);
     if (engine.ErrorsLog.Length > 0)
     {
         ErrorsTextBox.AppendText(engine.ErrorsLog.ToString());
     }
     EntryToolStripComboBox.Items.Clear();
     if (entryPoints.Length > 0) EntryToolStripComboBox.Items.AddRange(entryPoints);
     if (EntryToolStripComboBox.Items.Contains(selected))
     {
         EntryToolStripComboBox.Text = selected;
     }
     else if (EntryToolStripComboBox.Items.Count == 1)
     {
         EntryToolStripComboBox.Text = EntryToolStripComboBox.Items.Cast<string>().First();
     }
     if (AutoRunToolStripButton.Checked && EntryToolStripComboBox.Text.Length > 0) Run();
     return true;
 }
Beispiel #4
0
 public void Run(params object[] parameters)
 {
     var code = CodeTextBox.Text.Trim();
     var entry = EntryToolStripComboBox.Text;
     if (code == "") return;
     if (entry == "") entry = "Main";
     var engine = new DcEngine(code, CurrentLanguage, entry);
     object results = engine.Run(parameters);
     if (results == null)
     {
         OutputTextBox.Text = "null";
     }
     else if (results.GetType() == typeof(string))
     {
         OutputTextBox.Text = (string)results;
     }
     else if (results.GetType().FullName.StartsWith("System.Collections.Generic.List"))
     {
         OutputDataGridView.Dock = DockStyle.Fill;
         OutputDataGridView.BringToFront();
         OutputDataGridView.DataSource = results;
     }
     else
     {
         OutputTextBox.Dock = DockStyle.Fill;
         OutputTextBox.BringToFront();
         OutputTextBox.Text = results.GetType().FullName;
     }
     if (engine.ErrorsLog.Length > 0)
     {
         ErrorsTextBox.Text = engine.ErrorsLog.ToString();
     }
 }