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"]; }
public string GetKeyString() { var toReturn = from k in Keys select KeyTranslater.GetKeyString(k); return(String.Join(", ", toReturn)); }
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); }
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); }