Table of Contents

Class EventSimulationSequenceBuilder

Namespace
SharpHook
Assembly
SharpHook.dll

Represents a builder for a sequence of events that can be simulated together.

public sealed class EventSimulationSequenceBuilder : IEventSimulationSequenceBuilder
Inheritance
EventSimulationSequenceBuilder
Implements
Inherited Members
Extension Methods

Constructors

EventSimulationSequenceBuilder(IEventSimulationProvider?)

Initializes a new instance of the EventSimulationSequenceBuilder class.

public EventSimulationSequenceBuilder(IEventSimulationProvider? simulationProvider = null)

Parameters

simulationProvider IEventSimulationProvider

The simulation functionality provider (or Instance if null).

Methods

AddEvent(UioHookEvent)

Adds the specified event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddEvent(UioHookEvent e)

Parameters

e UioHookEvent

The event to add to the sequence.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddEvents(params UioHookEvent[])

Adds the specified events to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddEvents(params UioHookEvent[] events)

Parameters

events UioHookEvent[]

The events to add to the sequence.

Returns

IEventSimulationSequenceBuilder

The current builder.

Exceptions

ArgumentNullException

events is null.

AddEvents(IEnumerable<UioHookEvent>)

Adds the specified events to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddEvents(IEnumerable<UioHookEvent> events)

Parameters

events IEnumerable<UioHookEvent>

The events to add to the sequence.

Returns

IEventSimulationSequenceBuilder

The current builder.

Exceptions

ArgumentNullException

events is null.

AddKeyPress(KeyCode)

Adds a key press event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddKeyPress(KeyCode keyCode)

Parameters

keyCode KeyCode

The code of the key to press.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddKeyRelease(KeyCode)

Adds a key release event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddKeyRelease(KeyCode keyCode)

Parameters

keyCode KeyCode

The code of the key to press.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseMovement(short, short)

Adds a mouse movement event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseMovement(short x, short y)

Parameters

x short

The target X-coordinate of the mouse pointer.

y short

The target Y-coordinate of the mouse pointer.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseMovementRelative(short, short)

Adds a relative mouse movement event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseMovementRelative(short x, short y)

Parameters

x short

The X-coordinate offset.

y short

The Y-coordinate offset.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMousePress(MouseButton)

Adds a mouse button press event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMousePress(MouseButton button)

Parameters

button MouseButton

The mouse button to press.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMousePress(MouseButton, ushort)

Adds a mouse button press event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMousePress(MouseButton button, ushort clicks)

Parameters

button MouseButton

The mouse button to press.

clicks ushort

The click count (used only on macOS).

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMousePress(short, short, MouseButton)

Adds a mouse button press event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMousePress(short x, short y, MouseButton button)

Parameters

x short

The target X-coordinate of the mouse pointer.

y short

The target Y-coordinate of the mouse pointer.

button MouseButton

The mouse button to press.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMousePress(short, short, MouseButton, ushort)

Adds a mouse button press event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMousePress(short x, short y, MouseButton button, ushort clicks)

Parameters

x short

The target X-coordinate of the mouse pointer.

y short

The target Y-coordinate of the mouse pointer.

button MouseButton

The mouse button to press.

clicks ushort

The click count (used only on macOS).

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseRelease(MouseButton)

Adds a mouse button release event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseRelease(MouseButton button)

Parameters

button MouseButton

The mouse button to release.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseRelease(MouseButton, ushort)

Adds a mouse button release event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseRelease(MouseButton button, ushort clicks)

Parameters

button MouseButton

The mouse button to release.

clicks ushort

The click count (used only on macOS).

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseRelease(short, short, MouseButton)

Adds a mouse button release event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseRelease(short x, short y, MouseButton button)

Parameters

x short

The target X-coordinate of the mouse pointer.

y short

The target Y-coordinate of the mouse pointer.

button MouseButton

The mouse button to release.

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseRelease(short, short, MouseButton, ushort)

Adds a mouse button release event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseRelease(short x, short y, MouseButton button, ushort clicks)

Parameters

x short

The target X-coordinate of the mouse pointer.

y short

The target Y-coordinate of the mouse pointer.

button MouseButton

The mouse button to release.

clicks ushort

The click count (used only on macOS).

Returns

IEventSimulationSequenceBuilder

The current builder.

AddMouseWheel(short, MouseWheelScrollDirection, MouseWheelScrollType)

Adds a mouse wheel scroll event to the sequence of events to simulate.

public IEventSimulationSequenceBuilder AddMouseWheel(short rotation, MouseWheelScrollDirection direction = MouseWheelScrollDirection.Vertical, MouseWheelScrollType type = MouseWheelScrollType.UnitScroll)

Parameters

rotation short

The wheel rotation. A positive value indicates that the wheel will be rotated up or left, and a negative value indicates that the wheel will be rotated down or right.

direction MouseWheelScrollDirection

The scroll direction.

type MouseWheelScrollType

The scroll type (considered only on macOS).

Returns

IEventSimulationSequenceBuilder

The current builder.

Remarks

On Windows, the value 120 represents the default wheel step. As such, multiples of 120 can be used, but it's not required. The value of type is ignored.

On macOS, it's recommended to use values between -10 and 10. This will result in quite a small scroll amount with pixel scrolling, so BlockScroll is recommended for line scrolling instead of pixel scrolling.

On Linux, there is no fixed recommendation, but multiples of 100 can be used. The value of type is ignored.

CreateTemplate()

Creates a template based on the events in this sequence.

public IEventSimulationSequenceTemplate CreateTemplate()

Returns

IEventSimulationSequenceTemplate

A template based on the events in this sequence.

RemoveEvent(UioHookEvent)

Removes the specified event from the sequence of events to simulate.

public IEventSimulationSequenceBuilder RemoveEvent(UioHookEvent e)

Parameters

e UioHookEvent

The event to remove from the sequence.

Returns

IEventSimulationSequenceBuilder

The current builder.

RemoveEvents(Func<UioHookEvent, bool>)

Removes the specified events from the sequence of events to simulate.

public IEventSimulationSequenceBuilder RemoveEvents(Func<UioHookEvent, bool> predicate)

Parameters

predicate Func<UioHookEvent, bool>

The predicate to check if the event should be removed from the sequence.

Returns

IEventSimulationSequenceBuilder

The current builder.

Simulate()

Simulates the events in this sequence.

public UioHookResult Simulate()

Returns

UioHookResult

The result of the operation.