Пример #1
0
        public void LoadFromJson(JObject jsonData)
        {
            string         tempTriggerKey = (string)jsonData["trigger key"];          // Load String from json
            VirtualKeyCode vkCode         = KeyTranslater.GetKeyCode(tempTriggerKey); // Convert the string to a keycode using the Keytranslator

            triggerKey  = (Keys)vkCode;                                               // Cast the Vkeycode to a key and save to the class
            commandWord = (string)jsonData["command word"];
        }
Пример #2
0
        public string GetKeyString()
        {
            var toReturn =
                from k in Keys
                select KeyTranslater.GetKeyString(k);

            return(String.Join(", ", toReturn));
        }
Пример #3
0
        public JObject SaveToJson()
        {
            JObject toReturn = new JObject();

            toReturn["trigger key"]  = KeyTranslater.GetKeyString((VirtualKeyCode)triggerKey);
            toReturn["command word"] = commandWord;
            toReturn["command type"] = GetCommandType().ToString();
            return(toReturn);
        }
Пример #4
0
 public KeyCombo(string keysString, InputSimulator inputSimulator)
 {
     Keys = new List <VirtualKeyCode>();
     this.inputSimulator = inputSimulator;
     foreach (string VARIABLE in keysString.Split(','))
     {
         var keyCode = KeyTranslater.GetKeyCode(VARIABLE);
         Keys.Add(keyCode);
     }
 }
 public void GetKeyCodeTest()
 {
     Assert.AreEqual(KeyTranslater.GetKeyCode("m1"), VirtualKeyCode.LBUTTON);
     Assert.AreEqual(KeyTranslater.GetKeyCode("m2"), VirtualKeyCode.RBUTTON);
 }