Esempio n. 1
0
        public static int Main(string[] args)
        {
            try
            {
                Thread.CurrentThread.CurrentCulture = Utility.CultureUS;

                if (args.Length <= 0)
                {
                    Console.WriteLine("Usage: SB3UtilityScript \"scriptPath.txt\"");
                }
                else
                {
                    for (int i = 0; i < args.Length; i++)
                    {
                        ScriptMain script = new ScriptMain();
                        Report.Log += new Action<string>(Logger);
                        script.LoadPlugin((string)script.ScriptEnvironment.Variables[ScriptExecutor.PluginDirectoryName] + "SB3UtilityPlugins.dll");
                        script.RunScript(args[i]);
                    }
                }

                return 0;
            }
            catch (Exception ex)
            {
                Exception inner = ex;
                while (inner != null)
                {
                    Console.WriteLine(inner.Message);
                    inner = inner.InnerException;
                }

                return -1;
            }
        }
Esempio n. 2
0
        public static int Main(string[] args)
        {
            try
            {
                Thread.CurrentThread.CurrentCulture = Utility.CultureUS;

                if (args.Length <= 0)
                {
                    Console.WriteLine("Usage: SB3UtilityScript \"scriptPath.txt\"");
                }
                else
                {
                    for (int i = 0; i < args.Length; i++)
                    {
                        ScriptMain script = new ScriptMain();
                        Report.Log += new Action <string>(Logger);
                        script.LoadPlugin((string)script.ScriptEnvironment.Variables[ScriptExecutor.PluginDirectoryName] + "SB3UtilityPlugins.dll");
                        script.RunScript(args[i]);
                    }
                }

                return(0);
            }
            catch (Exception ex)
            {
                Exception inner = ex;
                while (inner != null)
                {
                    Console.WriteLine(inner.Message);
                    inner = inner.InnerException;
                }

                return(-1);
            }
        }
Esempio n. 3
0
        public FormScript()
        {
            InitializeComponent();

            string fileDialogFilter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";

            openFileDialog1.Filter = fileDialogFilter;
            saveFileDialog1.Filter = fileDialogFilter;

            richTextBoxScript.AllowDrop  = true;
            richTextBoxScript.DragEnter += new DragEventHandler(richTextBoxScript_DragEnter);
            richTextBoxScript.DragDrop  += new DragEventHandler(richTextBoxScript_DragDrop);

            string[] pluginsDoNotLoad = Properties.Settings.Default.PluginsDoNotLoad.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < pluginsDoNotLoad.Length; i++)
            {
                string plugin = pluginsDoNotLoad[i].ToLowerInvariant();
                if (!PluginManager.DoNotLoad.Contains(plugin))
                {
                    PluginManager.DoNotLoad.Add(plugin);
                }
            }

            PluginDirectory = (string)ScriptMain.ScriptEnvironment.Variables[ScriptExecutor.PluginDirectoryName];
            DirectoryInfo pluginDir = new DirectoryInfo(PluginDirectory);

            foreach (var plugin in pluginDir.GetFiles("*.dll"))
            {
                ScriptMain.LoadPlugin(plugin.FullName);
            }

            captureCommandsToolStripMenuItem.Checked         = (bool)Gui.Config["CaptureCommands"];
            captureCommandsToolStripMenuItem.CheckedChanged += captureCommandsToolStripMenuItem_CheckedChanged;

            autosaveToolStripMenuItem.Checked         = (bool)Gui.Config["AutosaveCommands"];
            autosaveToolStripMenuItem.CheckedChanged += autosaveToolStripMenuItem_CheckedChanged;
            if (autosaveToolStripMenuItem.Checked)
            {
                InitAutosave();
            }

            timeStampToolStripMenuItem.Checked         = (bool)Gui.Config["CommandsTimestamp"];
            timeStampToolStripMenuItem.CheckedChanged += timeStampToolStripMenuItem_CheckedChanged;

            this.FormClosing += new FormClosingEventHandler(FormScript_FormClosing);
        }