/// <summary> /// Handles "key:" requests /// </summary> /// <param name="data">Message received from client</param> public void OnKeyRequest(string data) { string key = data.Substring("key:".Length); Program.Log("Key request: " + key, debug: true); try { KeySender.SendKey(ScancodeConvert.GetScancode(key)); } catch { Program.Log("Failed to send key: " + key, ConsoleColor.Red); } }
/// <summary> /// Handles "action:" requests. /// Similar to key requests except the actual keycode is loaded from a file based on the action name passed. /// </summary> /// <param name="data"></param> public void OnActionRequest(string data) { string action = data.Substring("action:".Length); Program.Log("Action request: " + action, debug: true); string keycode = Program.keybindingHelper.GetKeybind(action); if (keycode != null) { try { KeySender.SendKey(ScancodeConvert.GetScancode(keycode)); } catch { Program.Log("Failed to send key: " + keycode, ConsoleColor.Red); } } else { Program.Log("Attempt to trigger action that doesn't have an associated keybind! (" + action + ")", ConsoleColor.Red); } }