bool ParseModifier( ParsePosition position, List <IInputAction> pressInputs, List <IInputAction> releaseInputs) { switch (position.CurrentChar) { case '%': pressInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_MENU, action: KeyAction.Press, duration: SendKeysDelay)); releaseInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_MENU, action: KeyAction.Release, duration: SendKeysDelay)); break; case '+': pressInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_SHIFT, action: KeyAction.Press, duration: SendKeysDelay)); releaseInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_SHIFT, action: KeyAction.Release, duration: SendKeysDelay)); break; case '^': pressInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_CONTROL, action: KeyAction.Press, duration: SendKeysDelay)); releaseInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_CONTROL, action: KeyAction.Release, duration: SendKeysDelay)); break; default: return(false); } position.MoveNext(); return(true); }
bool ParsePrintable( ParsePosition position, List <IInputAction> pressInputs, List <IInputAction> releaseInputs) { if (position.CurrentChar == char.MinValue || position.CurrentChar != '~' && IsSpecial(character: position.CurrentChar)) { return(false); } if (position.CurrentChar == '~') { pressInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_RETURN, action: KeyAction.Press, duration: SendKeysDelay)); releaseInputs.AddRange(collection: Input.CreateKeyInput(key: VirtualKey.VK_RETURN, action: KeyAction.Release, duration: SendKeysDelay)); } else { var virtualAlphaNumericKey = this.keyTranslator.GetVirtualAlphaNumericKey(alphaNumKey: position.CurrentChar); if (virtualAlphaNumericKey != VirtualKey.VK_NONE) { pressInputs.AddRange(collection: Input.CreateKeyInput(key: virtualAlphaNumericKey, action: KeyAction.PressAndRelease, duration: SendKeysDelay)); } else { pressInputs.AddRange(collection: Input.CreateKeyInput(character: position.CurrentChar, duration: SendKeysDelay)); } } position.MoveNext(); return(true); }
internal bool ParseText(string text, out List <IInputAction> inputs) { using (var position = new ParsePosition(parseText: text)) { position.MoveNext(); inputs = new List <IInputAction>(); ParseInnerText(position: position, inputs: inputs); return(ParseEOS(position: position)); } }
bool ParseWhitespace(ParsePosition position) { if (!char.IsWhiteSpace(c: position.CurrentChar)) { return(false); } position.MoveNext(); return(true); }
bool ParseSpecialChar(ParsePosition position, List <IInputAction> pressInputs) { if (!IsSpecial(character: position.CurrentChar)) { return(false); } pressInputs.AddRange(collection: Input.CreateKeyInput(character: position.CurrentChar, duration: SendKeysDelay)); position.MoveNext(); return(true); }
bool ParseDigit(ParsePosition position, out int digit) { digit = 0; if (!char.IsDigit(c: position.CurrentChar)) { return(false); } digit = Convert.ToByte(value: position.CurrentChar) - Convert.ToByte(value: '0'); position.MoveNext(); return(true); }