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 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);
 }