public Hooks() { MouseWatcher.OnMouseInput += (s, e) => { if (IsMouseButtonClickEvent(e.Message.ToString())) { MauseHook?.Invoke(GetMouseEventDescription(e)); } }; KeyboardWatcher.OnKeyInput += (s, e) => { if (IsButtonDownEvent(e.KeyData.EventType.ToString())) { KeyBordHook?.Invoke(GetKeyBordEventDescription(e.KeyData)); KeyCombinationAnalyzer(e.KeyData); } }; }
void Init() { mykeyboardhook = new KeyBordHook(); mykeyboardhook.Start(); mykeyboardhook.OnKeyDownEvent += new KeyEventHandler(mykeyboardhook_OnKeyDownEvent); radioButton1.Enabled = false; radioButton2.Enabled = false; radioButton3.Enabled = false; radioButton4.Enabled = false; StreamReader infile = new StreamReader("Set.ini", Encoding.GetEncoding("gb2312")); string tempstring = infile.ReadLine(); tempstring = tempstring.Substring(tempstring.IndexOf("\"") + 1); RemLocateKey = tempstring.Substring(0, tempstring.IndexOf("\"")); tempstring = infile.ReadLine(); tempstring = tempstring.Substring(tempstring.IndexOf("\"") + 1); MoveKey = tempstring.Substring(0, tempstring.IndexOf("\"")); tempstring = infile.ReadLine(); tempstring = tempstring.Substring(tempstring.IndexOf("\"") + 1); SpeedUpKey = tempstring.Substring(0, tempstring.IndexOf("\"")); tempstring = infile.ReadLine(); int nestnum = Convert.ToInt32(tempstring.Substring(tempstring.IndexOf("=") + 1)); movenestnum = nestnum; if (movenest != null) { movenest = null; } movenest = new Nest[nestnum]; if (nestmenu != null) { nestmenu = null; } nestmenu = new ToolStripMenuItem[nestnum]; 副本选择ToolStripMenuItem.DropDownItems.Clear(); for (int j = 0; j < nestnum; j++) { tempstring = infile.ReadLine(); string nestname = tempstring.Substring(tempstring.IndexOf("=") + 1); tempstring = infile.ReadLine(); int nestmovenum = Convert.ToInt32(tempstring.Substring(tempstring.IndexOf("=") + 1)); movenest[j] = new Nest(nestname, nestmovenum); nestmenu[j] = new ToolStripMenuItem(nestname); 副本选择ToolStripMenuItem.DropDownItems.Add(nestmenu[j]); nestmenu[j].Click += new EventHandler(NestMenu_Click); movenest[j].ReadNest("Locate.txt"); } infile.Close(); nestmenu[0].Checked = true; label1.Text = movenest[0].nestname; comboBox1.SelectedIndex = -1; nestkind = 0; comboBox1.Items.Clear(); for (int j = 0; j < movenest[0].movepointnum; j++) { comboBox1.Items.Add(movenest[0].movepointname[j]); } }