public void AddKeyDown() { var builder = new InputBuilder(); Assert.That(builder.ToArray(), Is.Empty); builder.AddKeyDown(VirtualKeyCode.VK_A); Assert.That(builder.Count(), Is.EqualTo(1)); Assert.That(builder[0].Type, Is.EqualTo((uint)InputType.Keyboard)); Assert.That(builder[0].Data.Keyboard.KeyCode, Is.EqualTo((ushort)VirtualKeyCode.VK_A)); }
public void AddKeyDown() { var builder = new InputBuilder(); Assert.IsFalse(builder.ToArray().Any()); builder.AddKeyDown(VirtualKeyCode.VK_A); Assert.AreEqual(builder.Count(), 1); Assert.AreEqual(builder[0].Type,(uint)InputType.Keyboard); Assert.AreEqual(builder[0].Data.Keyboard.KeyCode, (ushort)VirtualKeyCode.VK_A); }
private void ModifiersDown(InputBuilder builder, IEnumerable <Win32Constants.VirtualKeys> modifierKeyCodes) { if (modifierKeyCodes == null) { return; } foreach (Win32Constants.VirtualKeys key in modifierKeyCodes) { builder.AddKeyDown(key); } }
public IKeyboardInput KeyDown(InputBuilder builder, IEnumerable <KeyCode> keyCodes) { if (keyCodes == null) { return(this); } foreach (var key in keyCodes) { builder.AddKeyDown(key); } return(this); }
/// <summary> /// Simulates a modified keystroke where there is one modifier and multiple keys like CTRL-K-C where CTRL is the modifierKey and K and C are the keys. /// The flow is Modifier KeyDown, Keys Press in order, Modifier KeyUp. /// </summary> /// <param name="modifierKey">The modifier key</param> /// <param name="keyCodes">The list of keys to simulate</param> public void ModifiedKeyStroke(VirtualKeyCode modifierKey, IEnumerable<VirtualKeyCode> keyCodes) { var builder = new InputBuilder(); builder.AddKeyDown(modifierKey); if (keyCodes != null) keyCodes.ToList().ForEach(x => builder.AddKeyPress(x)); builder.AddKeyUp(modifierKey); SendSimulatedInput(builder.ToArray()); }
/// <summary> /// Simulates a modified keystroke where there are multiple modifiers and one key like CTRL-ALT-C where CTRL and ALT are the modifierKeys and C is the key. /// The flow is Modifiers KeyDown in order, Key Press, Modifiers KeyUp in reverse order. /// </summary> /// <param name="modifierKeyCodes">The list of modifier keys</param> /// <param name="keyCode">The key to simulate</param> public void ModifiedKeyStroke(IEnumerable<VirtualKeyCode> modifierKeyCodes, VirtualKeyCode keyCode) { var builder = new InputBuilder(); if (modifierKeyCodes != null) modifierKeyCodes.ToList().ForEach(x => builder.AddKeyDown(x)); builder.AddKeyPress(keyCode); if (modifierKeyCodes != null) modifierKeyCodes.Reverse().ToList().ForEach(x => builder.AddKeyUp(x)); SendSimulatedInput(builder.ToArray()); }
private void ModifiersDown(InputBuilder builder, IEnumerable<VirtualKeyCode> modifierKeyCodes) { if (modifierKeyCodes == null) return; foreach (var key in modifierKeyCodes) builder.AddKeyDown(key); }
private void ModifiersDown(InputBuilder builder, IEnumerable<Win32Constants.VirtualKeys> modifierKeyCodes){ if (modifierKeyCodes == null) return; foreach (Win32Constants.VirtualKeys key in modifierKeyCodes) builder.AddKeyDown(key); }
private void ModifiersDown(InputBuilder builder, IEnumerable<DirectInputKeyCode> modifierDikCodes) { if (modifierDikCodes == null) return; foreach (var dik in modifierDikCodes) builder.AddKeyDown(dik); }