// }}} private void B_EditMacro_CB(object sender, EventArgs e) // {{{ { log("B_EditMacro_CB():"); // selected macro if (MacroList.SelectedIndex == -1) { return; } Macro macro; // existing macro if (MacroList.SelectedIndex > 0) { string name = MacroList.SelectedItem.ToString(); macro = macroDict[name]; } // new macro else { macro = new Macro(null); macro.name = GetUniqueMacroName(); } // edit macro MacroEditor macroEditor = new MacroEditor(); macroEditor.RebuildFromMacroDefinition(macro); // user OK if (macroEditor.ShowDialog() == DialogResult.OK) { macro = macroEditor.GetMacroDefinition(); System.IO.FileStream stream = new System.IO.FileStream( Globals.ProfileMacroPath + macro.name + ".mac" , System.IO.FileMode.OpenOrCreate , System.IO.FileAccess.Write); Macro.Write(stream, macro); stream.Close(); } RebuildMacroList(); } //}}}
private void EditMacros_Click(object sender, EventArgs e) { MacroPlayer.MacroDefinition macroEdited = null; int item = MacroList.SelectedIndex; if (item == -1) { return; } String name = MacroList.SelectedItem.ToString(); if (item != 0) { macroEdited = mMacros[name]; } else { macroEdited = new MacroPlayer.MacroDefinition(null); macroEdited.name = GetUniqueMacroName(); } MacroEditor edit = new MacroEditor(); edit.RebuildFromMacroDefinition(macroEdited); if (edit.ShowDialog() == DialogResult.OK) { macroEdited = edit.GetMacroDefinition(); if (macroEdited.name.Length > 0) { System.IO.FileStream stream = new System.IO.FileStream(Globals.macroDir + macroEdited.name + ".mac", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write); MacroPlayer.MacroDefinition.Write(stream, macroEdited); stream.Close(); } } RebuildMacroList(); }
private void EditMacros_Click(object sender, EventArgs e) { MacroPlayer.MacroDefinition macroEdited = null; int item = MacroList.SelectedIndex; if (item == -1) return; String name = MacroList.SelectedItem.ToString(); if (item != 0) macroEdited = mMacros[name]; else { macroEdited = new MacroPlayer.MacroDefinition(null); macroEdited.name = GetUniqueMacroName(); } MacroEditor edit = new MacroEditor(); edit.RebuildFromMacroDefinition(macroEdited); if (edit.ShowDialog() == DialogResult.OK) { macroEdited = edit.GetMacroDefinition(); if (macroEdited.name.Length > 0) { System.IO.FileStream stream = new System.IO.FileStream(Globals.macroDir + macroEdited.name + ".mac", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write); MacroPlayer.MacroDefinition.Write(stream, macroEdited); stream.Close(); } } RebuildMacroList(); }