private static void findAndCall(KeyPair keypair) { if (!enableKeyHook) { return; } if (!HotKeyManager.getHotKeys().ContainsKey(keypair.GetHashCode())) { return; } ConfigClass cl = HotKeyManager.getHotKeys()[keypair.GetHashCode()]; switch (cl.getType()) { case ConfigClass.CommandType.EXE: CallProcess(cl.getExeFile(), cl.getExeArg()); break; case ConfigClass.CommandType.KEY: { keybd_event((byte)cl.getTargetKey(), 0, 0x0001, 0); //Key Down keybd_event((byte)cl.getTargetKey(), 0, 0x0002, 0); //Key Up break; } case ConfigClass.CommandType.CMD: CallCommand(cl.getCmdLine()); break; default: break; } }
private void addViewItem(ConfigClass val) { keysListView.Items.Add(new ListViewItem(new[] { val.getName(), string.Join("+", val.getKeyPairs()) , val.getType().ToString() , val.getType() == ConfigClass.CommandType.EXE ? val.getExeFile() + " " + val.getExeArg() :val.getType() == ConfigClass.CommandType.KEY ? val.getTargetKey().ToString() : val.getCmdLine() }, val.getKeyPairs().GetHashCode())); }
public ConfigAddForm(ConfigClass _config) : this() { this.Text = "Edit Item"; config = _config; nameView.Text = config.getName(); keysView.Text = string.Join("+", config.getKeyPairs()); switch (config.getType()) { case ConfigClass.CommandType.EXE: { typeView.SelectedIndex = 0; exeFileView.Text = config.getExeFile(); exeArgView.Text = config.getExeArg(); break; } case ConfigClass.CommandType.KEY: { typeView.SelectedIndex = 1; targetKeyView.Text = config.getTargetKey().ToString(); break; } case ConfigClass.CommandType.CMD: { typeView.SelectedIndex = 2; cmdLineView.Text = config.getCmdLine(); break; } default: break; } keysSaved = new KeyPair(_config.getKeyPairs()); }