コード例 #1
0
ファイル: Keyboard.cs プロジェクト: alexserov/wad_decompiled
        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);
        }
コード例 #2
0
ファイル: Keyboard.cs プロジェクト: alexserov/wad_decompiled
        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);
        }
コード例 #3
0
ファイル: Keyboard.cs プロジェクト: alexserov/wad_decompiled
 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));
     }
 }
コード例 #4
0
ファイル: Keyboard.cs プロジェクト: alexserov/wad_decompiled
 bool ParseWhitespace(ParsePosition position)
 {
     if (!char.IsWhiteSpace(c: position.CurrentChar))
     {
         return(false);
     }
     position.MoveNext();
     return(true);
 }
コード例 #5
0
ファイル: Keyboard.cs プロジェクト: alexserov/wad_decompiled
 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);
 }
コード例 #6
0
ファイル: Keyboard.cs プロジェクト: alexserov/wad_decompiled
 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);
 }