Example #1
0
        private void OptionBox_Load(object sender, EventArgs e)
        {
            ScriptContext context = EditorAppContext.GetScriptContext();

            directoryList.Items.AddRange(context.SearchPath);
            assemblyList.Items.AddRange(context.References);
        }
Example #2
0
        private void runToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /****************************************************************************
             * Parses the script and then runs it.
             * *************************************************************************/
            if (!(Saved || string.IsNullOrEmpty(filePath)))
            {
                Save(filePath);
            }

            try
            {
                ClearErrors();
                Hide();
                Console.Clear();
                Console.Title = Text;

                var context = EditorAppContext.GetScriptContext();

                if (Saved & sciEditor.TextLength > 0)
                {
                    ScriptEngine.ExecuteFile(filePath, context);
                }
                else
                {
                    ScriptEngine.ExecuteString(sciEditor.Text, context);
                }
            }
            catch (ScriptException ex)
            {
                ReportError(ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.Read();
            }
            finally
            {
                Console.Title += " [Done]";
                Show();
                Activate();
            }
        }
Example #3
0
        private void okButton_Click(object sender, EventArgs e)
        {
            var directories = new List <string>();

            foreach (string directory in directoryList.Items)
            {
                directories.Add(directory);
            }

            var assemblies = new List <Assembly>();

            foreach (Assembly asm in assemblyList.Items)
            {
                assemblies.Add(asm);
            }

            EditorAppContext.UpdateScriptContext(directories.ToArray(), assemblies.ToArray());
            DialogResult = DialogResult.OK;
        }
Example #4
0
        private void openToolStripButton_Click(object sender, EventArgs e)
        {
            using (var dialog = new OpenFileDialog())
            {
                dialog.Filter      = Resources.FileDialogFilter;
                dialog.Title       = Resources.OpenFileDialogTitle;
                dialog.Multiselect = true;

                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                foreach (string fileName in dialog.FileNames)
                {
                    EditorAppContext.OpenForm(fileName);
                }

                if (string.IsNullOrEmpty(filePath) && sciEditor.TextLength <= 0)
                {
                    Close();
                }
            }
        }
Example #5
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     EditorAppContext.OpenForm(string.Empty);
 }