private void button1_Click(object sender, EventArgs e) { cmd.path = cmdPath.Text; if (cmd.path.EndsWith(".dll")) { cmd.path = DllManaer.add(cmd.path); } cmd.description = cmdDescription.Text; if (cmd.id == -1) { dataBase.addCommand(cmd); cmd.id = Config.database.CommandId(cmd); Config.commands.Add(cmd); } else { dataBase.updateCommand(cmd); Command com = Config.commands.SingleOrDefault(c => c.id == cmd.id); com.path = cmd.path; com.description = cmd.description; } actionDone = true; this.Close(); }
//get the tight path from shortcuts and run it public void execute(int key) { Command command = Config.commands.SingleOrDefault(x => x.button == key); if (command == null) { return; } if (command.path.EndsWith(".dll")) { DllManaer.runDll(command.path); } else { if (File.Exists(command.path)) { Process.Start(command.path); } else { Config.notifier.notify("File does not Exists"); } } }