private void RegisterScrolling(CompositeHook hook) { var mouse = hook.GetMouse(); var name = mouse.Information.InstanceName + " " + mouse.Information.InstanceGuid; ScrollUp = new KeyOrButton(new GamepadButton(name, "Scroll_Up")); ScrollDown = new KeyOrButton(new GamepadButton(name, "Scroll_Down")); hook.RegisterHotKey(ScrollUp); hook.RegisterHotKey(ScrollDown); }
private void RegisterHotkey(CompositeHook hook, KeyOrButton key) { hook.RegisterHotKey(key); if (DeactivateHotkeysForOtherPrograms && key.IsKey && GlobalHotkeysEnabled) { var args = new System.Windows.Forms.KeyEventArgs(key.Key); var modifiers = (args.Alt ? ModifierKeys.Alt : ModifierKeys.None) | (args.Shift ? ModifierKeys.Shift : ModifierKeys.None) | (args.Control ? ModifierKeys.Control : ModifierKeys.None); HotkeyHook.Instance.RegisterHotKey(modifiers, args.KeyCode); } }
void ParseInis(Process game) { string path = game.MainModule.FileName; path = path.Remove(path.LastIndexOf(game.ProcessName + ".exe"), (game.ProcessName + ".exe").Length); string pathUserIni = path + "User.ini"; Debug.WriteLine("[NoLoads] Path to inis: User.ini: \"" + pathUserIni + "\""); foreach (string line in System.IO.File.ReadAllLines(pathUserIni)) { Match regex = Regex.Match(line, @"([^ ?]+)=(?:ShowMissionObjectives|ShowMenu)"); if (regex.Success) { _hideMissionObjectivesKeys.Add(new KeyOrButton(regex.Groups[1].Value)); } } _hook.UnregisterAllHotkeys(); foreach (KeyOrButton key in _hideMissionObjectivesKeys) { _hook.RegisterHotKey(key); } }