예제 #1
0
        /// <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);
            }
        }
예제 #2
0
        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;
        }