当前位置: 首页>>代码示例>>C#>>正文


C# InputBuilder.ToArray方法代码示例

本文整理汇总了C#中InputBuilder.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# InputBuilder.ToArray方法的具体用法?C# InputBuilder.ToArray怎么用?C# InputBuilder.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputBuilder的用法示例。


在下文中一共展示了InputBuilder.ToArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddKeyDown

 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));
 }
开发者ID:HouSong,项目名称:inputsimulator,代码行数:9,代码来源:InputBuilderTests.cs

示例2: AddKeyDown

 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);
 }
开发者ID:HaKDMoDz,项目名称:InputSimulator,代码行数:9,代码来源:InputBuilderTests.cs

示例3: ModifiedKeyStroke

        /// <summary>
        /// Simulates a modified keystroke where there are multiple modifiers and multiple keys like CTRL-ALT-K-C where CTRL and ALT are the modifierKeys and K and C are the keys.
        /// The flow is Modifiers KeyDown in order, Keys Press in order, Modifiers KeyUp in reverse order.
        /// </summary>
        /// <param name="modifierKeyCodes">The list of modifier keys</param>
        /// <param name="keyCodes">The list of keys to simulate</param>
        public void ModifiedKeyStroke(IEnumerable<VirtualKeyCode> modifierKeyCodes, IEnumerable<VirtualKeyCode> keyCodes)
        {
            var builder = new InputBuilder();
            if (modifierKeyCodes != null) modifierKeyCodes.ToList().ForEach(x => builder.AddKeyUp(x));
            if (keyCodes != null) keyCodes.ToList().ForEach(x => builder.AddKeyPress(x));
            if (modifierKeyCodes != null) modifierKeyCodes.Reverse().ToList().ForEach(x => builder.AddKeyUp(x));

            SendSimulatedInput(builder.ToArray());
        }
开发者ID:HaKDMoDz,项目名称:baro-corelibrary,代码行数:15,代码来源:KeyboardSimulator.cs

示例4: ModifiedKeyStroke

        /// <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();
            var modifierKeyCodesList = modifierKeyCodes.ToList();
            if (modifierKeyCodes != null) modifierKeyCodesList.ForEach(x => builder.AddKeyDown(x));
            builder.AddKeyPress(keyCode);
            if (modifierKeyCodes != null)
            {
                modifierKeyCodesList.Reverse();
                modifierKeyCodesList.ForEach(x => builder.AddKeyUp(x));
            }

            SendSimulatedInput(builder.ToArray());
        }
开发者ID:HaKDMoDz,项目名称:InputSimulator,代码行数:20,代码来源:KeyboardSimulator.cs

示例5: ModifiedKeyStroke

        /// <summary>
        /// Simulates a modified keystroke where there are multiple modifiers and multiple keys like CTRL-ALT-K-C where CTRL and ALT are the modifierKeys and K and C are the keys.
        /// The flow is Modifiers KeyDown in order, Keys Press in order, Modifiers KeyUp in reverse order.
        /// </summary>
        /// <param name="modifierKeyCodes">The list of modifier keys</param>
        /// <param name="keyCodes">The list of keys to simulate</param>
        public IKeyboardSimulator ModifiedKeyStroke(IEnumerable<VirtualKeyCode> modifierKeyCodes, IEnumerable<VirtualKeyCode> keyCodes)
        {
            var builder = new InputBuilder();
            ModifiersDown(builder, modifierKeyCodes);
            KeysPress(builder, keyCodes);
            ModifiersUp(builder, modifierKeyCodes);

            SendSimulatedInput(builder.ToArray());
            return this;
        }
开发者ID:himidori,项目名称:Sakura-Clicker,代码行数:16,代码来源:KeyboardSimulator.cs

示例6: KeyPress

 /// <summary>
 /// Simulates a key press for each of the specified key codes in the order they are specified.
 /// </summary>
 /// <param name="keyCodes"></param>
 public IKeyboardSimulator KeyPress(params VirtualKeyCode[] keyCodes)
 {
     var builder = new InputBuilder();
     KeysPress(builder, keyCodes);
     SendSimulatedInput(builder.ToArray());
     return this;
 }
开发者ID:himidori,项目名称:Sakura-Clicker,代码行数:11,代码来源:KeyboardSimulator.cs

示例7: ModifiedKeyStroke

        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;
        }
开发者ID:derjabkin,项目名称:eXpand,代码行数:11,代码来源:KeyboardSimulator.cs


注:本文中的InputBuilder.ToArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。