private void KeysPress(InputBuilder builder, IEnumerable <Win32Constants.VirtualKeys> keyCodes) { if (keyCodes == null) { return; } foreach (Win32Constants.VirtualKeys key in keyCodes) { builder.AddKeyPress(key); } }
private void ModifiersDown(InputBuilder builder, IEnumerable <Win32Constants.VirtualKeys> modifierKeyCodes) { if (modifierKeyCodes == null) { return; } foreach (Win32Constants.VirtualKeys key in modifierKeyCodes) { builder.AddKeyDown(key); } }
public IKeyboardSimulator TextEntry(string text) { if (text.Length > UInt32.MaxValue / 2) { throw new ArgumentException( string.Format("The text parameter is too long. It must be less than {0} characters.", UInt32.MaxValue / 2), "text"); } Win32Types.INPUT[] inputList = new InputBuilder().AddCharacters(text).ToArray(); SendSimulatedInput(inputList); return(this); }
public IKeyboardSimulator ModifiedKeyStroke( IEnumerable <Win32Constants.VirtualKeys> modifierKeyCodes, IEnumerable <Win32Constants.VirtualKeys> keyCodes) { var builder = new InputBuilder(); Win32Constants.VirtualKeys[] virtualKeyss = modifierKeyCodes.ToArray(); ModifiersDown(builder, virtualKeyss); KeysPress(builder, keyCodes); ModifiersUp(builder, virtualKeyss); SendSimulatedInput(builder.ToArray()); return(this); }
private void ModifiersUp(InputBuilder builder, IEnumerable <Win32Constants.VirtualKeys> modifierKeyCodes) { if (modifierKeyCodes == null) { return; } var stack = new Stack <Win32Constants.VirtualKeys>(modifierKeyCodes); while (stack.Count > 0) { builder.AddKeyUp(stack.Pop()); } }
public IMouseSimulator LeftButtonUp() { Win32Types.INPUT[] inputList = new InputBuilder().AddMouseButtonUp(MouseButton.LeftButton).ToArray(); SendSimulatedInput(inputList); return(this); }
public IMouseSimulator XButtonDoubleClick(int buttonId) { Win32Types.INPUT[] inputList = new InputBuilder().AddMouseXButtonDoubleClick(buttonId).ToArray(); SendSimulatedInput(inputList); return(this); }
public IKeyboardSimulator KeyPress(Win32Constants.VirtualKeys keyCode) { Win32Types.INPUT[] inputList = new InputBuilder().AddKeyPress(keyCode).ToArray(); SendSimulatedInput(inputList); return(this); }
public IKeyboardSimulator TextEntry(char character) { Win32Types.INPUT[] inputList = new InputBuilder().AddCharacter(character).ToArray(); SendSimulatedInput(inputList); return(this); }