/// <summary> /// Serializes KeyboardMap class to a KeyboardMap.xml file. /// </summary> /// <param name="keyboard"></param> public static void Serialize(KeyboardMap keyboard) { var serializer = new XmlSerializer(keyboard.GetType()); using (var writer = XmlWriter.Create("KeyboardMap.xml")) { serializer.Serialize(writer, keyboard); } }
public void Subscribe(bool hookPlayer1, bool hookPlayer2) { _hookPlayer1 = hookPlayer1; _hookPlayer2 = hookPlayer2; _mGlobalHook = Hook.GlobalEvents(); _mGlobalHook.KeyDown += MGlobalHookOnKeyDown; _mGlobalHook.KeyUp += MGlobalHookOnKeyUp; if (!File.Exists("KeyboardMap.xml")) { _useCustomKeys = false; return; } _kbMap = KeyboardHelper.DeSerialize(); _useCustomKeys = true; }