Ejemplo n.º 1
0
        void cmdEditScript_Click(object sender, EventArgs e)
        {
            Executable.Script cmd = (Executable.Script)cboScripts.SelectedItem;
            ScriptTool        ST  = new ScriptTool();

            ST.Script = cmd;
            ST.ShowDialog();
        }
Ejemplo n.º 2
0
        void cmdNewScript_Click(object sender, EventArgs e)
        {
            Executable.Script cmd = new Executable.Script();
            ScriptTool        ST  = new ScriptTool();

            ST.Script = cmd;
            if (ST.ShowDialog() == DialogResult.OK)
            {
                _executable.Scripts.Add(cmd);
                cboScripts.Items.Add(cmd);
                cboScripts.SelectedItem = cmd;
                SetScriptEnabled(true);
            }
        }
Ejemplo n.º 3
0
        public static void LoadExecutables()
        {
            if (!File.Exists("Executables.xml"))
            {
                using (var sw = File.CreateText("Executables.xml"))
                {
                    sw.WriteLine("<Executables></Executables>");
                }
            }
            using (var xr = XmlReader.Create(File.OpenRead("Executables.xml")))
            {
                Executable workingExe = null;
                while (!xr.EOF)
                {
                    xr.Read();
                    switch (xr.Name)
                    {
                    case "Executable":
                        if (xr.NodeType == XmlNodeType.EndElement)
                        {
                            continue;
                        }
                        workingExe = new Executable()
                        {
                            Name     = xr.GetAttribute("Name"),
                            Filename = xr.GetAttribute("Filename")
                        };
                        _executables.Add(workingExe);
                        break;

                    case "Script":
                        if (xr.NodeType == XmlNodeType.EndElement)
                        {
                            continue;
                        }
                        Executable.Script script = new Executable.Script()
                        {
                            Name     = xr.GetAttribute("Name"),
                            FileType = xr.GetAttribute("FileType"),
                            Code     = xr.ReadInnerXml(),
                        };
                        workingExe.Scripts.Add(script);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 4
0
 void cmdDeleteScript_Click(object sender, EventArgs e)
 {
     Executable.Script cmd = (Executable.Script)cboScripts.SelectedItem;
     _executable.Scripts.Remove(cmd);
     cboScripts.Items.Remove(cmd);
 }
Ejemplo n.º 5
0
 void ExecutableFileScript_Click(object sender, EventArgs e)
 {
     Executable.Script cmd = (Executable.Script)((ToolStripMenuItem)sender).Tag;
     cmd.Run(Path.GetFileNameWithoutExtension(listFiles.SelectedItems[0].Text));
 }
Ejemplo n.º 6
0
 void ExecutableScript_Click(object sender, EventArgs e)
 {
     Executable.Script cmd = (Executable.Script)((ToolStripMenuItem)sender).Tag;
     cmd.Run("");
 }