void cmdEditScript_Click(object sender, EventArgs e) { Executable.Script cmd = (Executable.Script)cboScripts.SelectedItem; ScriptTool ST = new ScriptTool(); ST.Script = cmd; ST.ShowDialog(); }
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); } }
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); } }
void ExecutableFileScript_Click(object sender, EventArgs e) { Executable.Script cmd = (Executable.Script)((ToolStripMenuItem)sender).Tag; cmd.Run(Path.GetFileNameWithoutExtension(listFiles.SelectedItems[0].Text)); }
void ExecutableScript_Click(object sender, EventArgs e) { Executable.Script cmd = (Executable.Script)((ToolStripMenuItem)sender).Tag; cmd.Run(""); }
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; case "Module": if (xr.NodeType == XmlNodeType.EndElement) continue; uint baseAddress = 0; try { baseAddress = Convert.ToUInt32(xr.GetAttribute("BaseAddress"), 16); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Reading Module For: " + workingExe.Filename, MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } Executable.Module module = new Executable.Module(xr.GetAttribute("Filename"), baseAddress) { Name = xr.GetAttribute("Name") }; workingExe.Modules.Add(module); break; } } } }
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; case "Module": if (xr.NodeType == XmlNodeType.EndElement) { continue; } uint baseAddress = 0; try { baseAddress = Convert.ToUInt32(xr.GetAttribute("BaseAddress"), 16); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Reading Module For: " + workingExe.Filename, MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } Executable.Module module = new Executable.Module(xr.GetAttribute("Filename"), baseAddress) { Name = xr.GetAttribute("Name") }; workingExe.Modules.Add(module); break; } } } }
void cmdDeleteScript_Click(object sender, EventArgs e) { Executable.Script cmd = (Executable.Script)cboScripts.SelectedItem; _executable.Scripts.Remove(cmd); cboScripts.Items.Remove(cmd); }