mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Code style - Use file scoped namespaces
Code style - Ran code cleanup
This commit is contained in:
1 parent
e68e16df4d
commit
f6090dc296
691 files changed
+37301
-38119
No files matched your search
@@ -1,23 +1,22 @@
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a device that provides input to the <see cref="IInputService" />
|
||||
/// </summary>
|
||||
public enum InputDeviceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a device that provides input to the <see cref="IInputService" />
|
||||
/// None
|
||||
/// </summary>
|
||||
public enum InputDeviceType
|
||||
{
|
||||
/// <summary>
|
||||
/// None
|
||||
/// </summary>
|
||||
None,
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// A keyboard
|
||||
/// </summary>
|
||||
Keyboard,
|
||||
/// <summary>
|
||||
/// A keyboard
|
||||
/// </summary>
|
||||
Keyboard,
|
||||
|
||||
/// <summary>
|
||||
/// A mouse
|
||||
/// </summary>
|
||||
Mouse
|
||||
}
|
||||
/// <summary>
|
||||
/// A mouse
|
||||
/// </summary>
|
||||
Mouse
|
||||
}
|
||||
@@ -1,537 +1,536 @@
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>Specifies the possible key values on a keyboard.</summary>
|
||||
public enum KeyboardKey
|
||||
{
|
||||
/// <summary>Specifies the possible key values on a keyboard.</summary>
|
||||
public enum KeyboardKey
|
||||
{
|
||||
/// <summary>No key pressed.</summary>
|
||||
None = 0,
|
||||
/// <summary>No key pressed.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>The Cancel key.</summary>
|
||||
Cancel = 1,
|
||||
/// <summary>The Cancel key.</summary>
|
||||
Cancel = 1,
|
||||
|
||||
/// <summary>The Backspace key.</summary>
|
||||
Back = 2,
|
||||
/// <summary>The Backspace key.</summary>
|
||||
Back = 2,
|
||||
|
||||
/// <summary>The Tab key.</summary>
|
||||
Tab = 3,
|
||||
/// <summary>The Tab key.</summary>
|
||||
Tab = 3,
|
||||
|
||||
/// <summary>The Linefeed key.</summary>
|
||||
LineFeed = 4,
|
||||
/// <summary>The Linefeed key.</summary>
|
||||
LineFeed = 4,
|
||||
|
||||
/// <summary>The Clear key.</summary>
|
||||
Clear = 5,
|
||||
/// <summary>The Clear key.</summary>
|
||||
Clear = 5,
|
||||
|
||||
/// <summary>The Enter key.</summary>
|
||||
Enter = 6,
|
||||
/// <summary>The Enter key.</summary>
|
||||
Enter = 6,
|
||||
|
||||
/// <summary>The Return key.</summary>
|
||||
Return = 6,
|
||||
/// <summary>The Return key.</summary>
|
||||
Return = 6,
|
||||
|
||||
/// <summary>The Pause key.</summary>
|
||||
Pause = 7,
|
||||
/// <summary>The Pause key.</summary>
|
||||
Pause = 7,
|
||||
|
||||
/// <summary>The Caps Lock key.</summary>
|
||||
CapsLock = 8,
|
||||
/// <summary>The Caps Lock key.</summary>
|
||||
CapsLock = 8,
|
||||
|
||||
/// <summary>The IME Hangul mode key.</summary>
|
||||
HangulMode = 9,
|
||||
/// <summary>The IME Hangul mode key.</summary>
|
||||
HangulMode = 9,
|
||||
|
||||
/// <summary>The IME Junja mode key.</summary>
|
||||
JunjaMode = 10, // 0x0000000A
|
||||
/// <summary>The IME Junja mode key.</summary>
|
||||
JunjaMode = 10, // 0x0000000A
|
||||
|
||||
/// <summary>The IME Final mode key.</summary>
|
||||
FinalMode = 11, // 0x0000000B
|
||||
/// <summary>The IME Final mode key.</summary>
|
||||
FinalMode = 11, // 0x0000000B
|
||||
|
||||
/// <summary>The IME Hanja mode key.</summary>
|
||||
HanjaMode = 12, // 0x0000000C
|
||||
/// <summary>The IME Hanja mode key.</summary>
|
||||
HanjaMode = 12, // 0x0000000C
|
||||
|
||||
/// <summary>The ESC key.</summary>
|
||||
Escape = 13, // 0x0000000D
|
||||
/// <summary>The ESC key.</summary>
|
||||
Escape = 13, // 0x0000000D
|
||||
|
||||
/// <summary>The IME Convert key.</summary>
|
||||
ImeConvert = 14, // 0x0000000E
|
||||
/// <summary>The IME Convert key.</summary>
|
||||
ImeConvert = 14, // 0x0000000E
|
||||
|
||||
/// <summary>The IME NonConvert key.</summary>
|
||||
ImeNonConvert = 15, // 0x0000000F
|
||||
/// <summary>The IME NonConvert key.</summary>
|
||||
ImeNonConvert = 15, // 0x0000000F
|
||||
|
||||
/// <summary>The IME Accept key.</summary>
|
||||
ImeAccept = 16, // 0x00000010
|
||||
/// <summary>The IME Accept key.</summary>
|
||||
ImeAccept = 16, // 0x00000010
|
||||
|
||||
/// <summary>The IME Mode change request.</summary>
|
||||
ImeModeChange = 17, // 0x00000011
|
||||
/// <summary>The IME Mode change request.</summary>
|
||||
ImeModeChange = 17, // 0x00000011
|
||||
|
||||
/// <summary>The Spacebar key.</summary>
|
||||
Space = 18, // 0x00000012
|
||||
/// <summary>The Spacebar key.</summary>
|
||||
Space = 18, // 0x00000012
|
||||
|
||||
/// <summary>The Page Up key.</summary>
|
||||
PageUp = 19, // 0x00000013
|
||||
/// <summary>The Page Up key.</summary>
|
||||
PageUp = 19, // 0x00000013
|
||||
|
||||
/// <summary>The Page Up key.</summary>
|
||||
Prior = 19, // 0x00000013
|
||||
/// <summary>The Page Up key.</summary>
|
||||
Prior = 19, // 0x00000013
|
||||
|
||||
/// <summary>The Page Down key.</summary>
|
||||
Next = 20, // 0x00000014
|
||||
/// <summary>The Page Down key.</summary>
|
||||
Next = 20, // 0x00000014
|
||||
|
||||
/// <summary>The Page Down key.</summary>
|
||||
PageDown = 20, // 0x00000014
|
||||
/// <summary>The Page Down key.</summary>
|
||||
PageDown = 20, // 0x00000014
|
||||
|
||||
/// <summary>The End key.</summary>
|
||||
End = 21, // 0x00000015
|
||||
/// <summary>The End key.</summary>
|
||||
End = 21, // 0x00000015
|
||||
|
||||
/// <summary>The Home key.</summary>
|
||||
Home = 22, // 0x00000016
|
||||
/// <summary>The Home key.</summary>
|
||||
Home = 22, // 0x00000016
|
||||
|
||||
/// <summary>The Left Arrow key.</summary>
|
||||
Left = 23, // 0x00000017
|
||||
/// <summary>The Left Arrow key.</summary>
|
||||
Left = 23, // 0x00000017
|
||||
|
||||
/// <summary>The Up Arrow key.</summary>
|
||||
Up = 24, // 0x00000018
|
||||
/// <summary>The Up Arrow key.</summary>
|
||||
Up = 24, // 0x00000018
|
||||
|
||||
/// <summary>The Right Arrow key.</summary>
|
||||
Right = 25, // 0x00000019
|
||||
/// <summary>The Right Arrow key.</summary>
|
||||
Right = 25, // 0x00000019
|
||||
|
||||
/// <summary>The Down Arrow key.</summary>
|
||||
Down = 26, // 0x0000001A
|
||||
/// <summary>The Down Arrow key.</summary>
|
||||
Down = 26, // 0x0000001A
|
||||
|
||||
/// <summary>The Select key.</summary>
|
||||
Select = 27, // 0x0000001B
|
||||
/// <summary>The Select key.</summary>
|
||||
Select = 27, // 0x0000001B
|
||||
|
||||
/// <summary>The Print key.</summary>
|
||||
Print = 28, // 0x0000001C
|
||||
/// <summary>The Print key.</summary>
|
||||
Print = 28, // 0x0000001C
|
||||
|
||||
/// <summary>The Execute key.</summary>
|
||||
Execute = 29, // 0x0000001D
|
||||
/// <summary>The Execute key.</summary>
|
||||
Execute = 29, // 0x0000001D
|
||||
|
||||
/// <summary>The Print Screen key.</summary>
|
||||
PrintScreen = 30, // 0x0000001E
|
||||
/// <summary>The Print Screen key.</summary>
|
||||
PrintScreen = 30, // 0x0000001E
|
||||
|
||||
/// <summary>The Insert key.</summary>
|
||||
Insert = 31, // 0x0000001F
|
||||
/// <summary>The Insert key.</summary>
|
||||
Insert = 31, // 0x0000001F
|
||||
|
||||
/// <summary>The Delete key.</summary>
|
||||
Delete = 32, // 0x00000020
|
||||
/// <summary>The Delete key.</summary>
|
||||
Delete = 32, // 0x00000020
|
||||
|
||||
/// <summary>The Help key.</summary>
|
||||
Help = 33, // 0x00000021
|
||||
/// <summary>The Help key.</summary>
|
||||
Help = 33, // 0x00000021
|
||||
|
||||
/// <summary>The 0 (zero) key.</summary>
|
||||
D0 = 34, // 0x00000022
|
||||
/// <summary>The 0 (zero) key.</summary>
|
||||
D0 = 34, // 0x00000022
|
||||
|
||||
/// <summary>The 1 (one) key.</summary>
|
||||
D1 = 35, // 0x00000023
|
||||
/// <summary>The 1 (one) key.</summary>
|
||||
D1 = 35, // 0x00000023
|
||||
|
||||
/// <summary>The 2 key.</summary>
|
||||
D2 = 36, // 0x00000024
|
||||
/// <summary>The 2 key.</summary>
|
||||
D2 = 36, // 0x00000024
|
||||
|
||||
/// <summary>The 3 key.</summary>
|
||||
D3 = 37, // 0x00000025
|
||||
/// <summary>The 3 key.</summary>
|
||||
D3 = 37, // 0x00000025
|
||||
|
||||
/// <summary>The 4 key.</summary>
|
||||
D4 = 38, // 0x00000026
|
||||
/// <summary>The 4 key.</summary>
|
||||
D4 = 38, // 0x00000026
|
||||
|
||||
/// <summary>The 5 key.</summary>
|
||||
D5 = 39, // 0x00000027
|
||||
/// <summary>The 5 key.</summary>
|
||||
D5 = 39, // 0x00000027
|
||||
|
||||
/// <summary>The 6 key.</summary>
|
||||
D6 = 40, // 0x00000028
|
||||
/// <summary>The 6 key.</summary>
|
||||
D6 = 40, // 0x00000028
|
||||
|
||||
/// <summary>The 7 key.</summary>
|
||||
D7 = 41, // 0x00000029
|
||||
/// <summary>The 7 key.</summary>
|
||||
D7 = 41, // 0x00000029
|
||||
|
||||
/// <summary>The 8 key.</summary>
|
||||
D8 = 42, // 0x0000002A
|
||||
/// <summary>The 8 key.</summary>
|
||||
D8 = 42, // 0x0000002A
|
||||
|
||||
/// <summary>The 9 key.</summary>
|
||||
D9 = 43, // 0x0000002B
|
||||
/// <summary>The 9 key.</summary>
|
||||
D9 = 43, // 0x0000002B
|
||||
|
||||
/// <summary>The A key.</summary>
|
||||
A = 44, // 0x0000002C
|
||||
/// <summary>The A key.</summary>
|
||||
A = 44, // 0x0000002C
|
||||
|
||||
/// <summary>The B key.</summary>
|
||||
B = 45, // 0x0000002D
|
||||
/// <summary>The B key.</summary>
|
||||
B = 45, // 0x0000002D
|
||||
|
||||
/// <summary>The C key.</summary>
|
||||
C = 46, // 0x0000002E
|
||||
/// <summary>The C key.</summary>
|
||||
C = 46, // 0x0000002E
|
||||
|
||||
/// <summary>The D key.</summary>
|
||||
D = 47, // 0x0000002F
|
||||
/// <summary>The D key.</summary>
|
||||
D = 47, // 0x0000002F
|
||||
|
||||
/// <summary>The E key.</summary>
|
||||
E = 48, // 0x00000030
|
||||
/// <summary>The E key.</summary>
|
||||
E = 48, // 0x00000030
|
||||
|
||||
/// <summary>The F key.</summary>
|
||||
F = 49, // 0x00000031
|
||||
/// <summary>The F key.</summary>
|
||||
F = 49, // 0x00000031
|
||||
|
||||
/// <summary>The G key.</summary>
|
||||
G = 50, // 0x00000032
|
||||
/// <summary>The G key.</summary>
|
||||
G = 50, // 0x00000032
|
||||
|
||||
/// <summary>The H key.</summary>
|
||||
H = 51, // 0x00000033
|
||||
/// <summary>The H key.</summary>
|
||||
H = 51, // 0x00000033
|
||||
|
||||
/// <summary>The I key.</summary>
|
||||
I = 52, // 0x00000034
|
||||
/// <summary>The I key.</summary>
|
||||
I = 52, // 0x00000034
|
||||
|
||||
/// <summary>The J key.</summary>
|
||||
J = 53, // 0x00000035
|
||||
/// <summary>The J key.</summary>
|
||||
J = 53, // 0x00000035
|
||||
|
||||
/// <summary>The K key.</summary>
|
||||
K = 54, // 0x00000036
|
||||
/// <summary>The K key.</summary>
|
||||
K = 54, // 0x00000036
|
||||
|
||||
/// <summary>The L key.</summary>
|
||||
L = 55, // 0x00000037
|
||||
/// <summary>The L key.</summary>
|
||||
L = 55, // 0x00000037
|
||||
|
||||
/// <summary>The M key.</summary>
|
||||
M = 56, // 0x00000038
|
||||
/// <summary>The M key.</summary>
|
||||
M = 56, // 0x00000038
|
||||
|
||||
/// <summary>The N key.</summary>
|
||||
N = 57, // 0x00000039
|
||||
/// <summary>The N key.</summary>
|
||||
N = 57, // 0x00000039
|
||||
|
||||
/// <summary>The O key.</summary>
|
||||
O = 58, // 0x0000003A
|
||||
/// <summary>The O key.</summary>
|
||||
O = 58, // 0x0000003A
|
||||
|
||||
/// <summary>The P key.</summary>
|
||||
P = 59, // 0x0000003B
|
||||
/// <summary>The P key.</summary>
|
||||
P = 59, // 0x0000003B
|
||||
|
||||
/// <summary>The Q key.</summary>
|
||||
Q = 60, // 0x0000003C
|
||||
/// <summary>The Q key.</summary>
|
||||
Q = 60, // 0x0000003C
|
||||
|
||||
/// <summary>The R key.</summary>
|
||||
R = 61, // 0x0000003D
|
||||
/// <summary>The R key.</summary>
|
||||
R = 61, // 0x0000003D
|
||||
|
||||
/// <summary>The S key.</summary>
|
||||
S = 62, // 0x0000003E
|
||||
/// <summary>The S key.</summary>
|
||||
S = 62, // 0x0000003E
|
||||
|
||||
/// <summary>The T key.</summary>
|
||||
T = 63, // 0x0000003F
|
||||
/// <summary>The T key.</summary>
|
||||
T = 63, // 0x0000003F
|
||||
|
||||
/// <summary>The U key.</summary>
|
||||
U = 64, // 0x00000040
|
||||
/// <summary>The U key.</summary>
|
||||
U = 64, // 0x00000040
|
||||
|
||||
/// <summary>The V key.</summary>
|
||||
V = 65, // 0x00000041
|
||||
/// <summary>The V key.</summary>
|
||||
V = 65, // 0x00000041
|
||||
|
||||
/// <summary>The W key.</summary>
|
||||
W = 66, // 0x00000042
|
||||
/// <summary>The W key.</summary>
|
||||
W = 66, // 0x00000042
|
||||
|
||||
/// <summary>The X key.</summary>
|
||||
X = 67, // 0x00000043
|
||||
/// <summary>The X key.</summary>
|
||||
X = 67, // 0x00000043
|
||||
|
||||
/// <summary>The Y key.</summary>
|
||||
Y = 68, // 0x00000044
|
||||
/// <summary>The Y key.</summary>
|
||||
Y = 68, // 0x00000044
|
||||
|
||||
/// <summary>The Z key.</summary>
|
||||
Z = 69, // 0x00000045
|
||||
/// <summary>The Z key.</summary>
|
||||
Z = 69, // 0x00000045
|
||||
|
||||
/// <summary>The left Windows logo key (Microsoft Natural Keyboard).</summary>
|
||||
LWin = 70, // 0x00000046
|
||||
/// <summary>The left Windows logo key (Microsoft Natural Keyboard).</summary>
|
||||
LWin = 70, // 0x00000046
|
||||
|
||||
/// <summary>The right Windows logo key (Microsoft Natural Keyboard).</summary>
|
||||
RWin = 71, // 0x00000047
|
||||
/// <summary>The right Windows logo key (Microsoft Natural Keyboard).</summary>
|
||||
RWin = 71, // 0x00000047
|
||||
|
||||
/// <summary>
|
||||
/// The Application key (Microsoft Natural Keyboard). Also known as the Menu key, as it displays an
|
||||
/// application-specific context menu.
|
||||
/// </summary>
|
||||
Apps = 72, // 0x00000048
|
||||
/// <summary>
|
||||
/// The Application key (Microsoft Natural Keyboard). Also known as the Menu key, as it displays an
|
||||
/// application-specific context menu.
|
||||
/// </summary>
|
||||
Apps = 72, // 0x00000048
|
||||
|
||||
/// <summary>The Computer Sleep key.</summary>
|
||||
Sleep = 73, // 0x00000049
|
||||
/// <summary>The Computer Sleep key.</summary>
|
||||
Sleep = 73, // 0x00000049
|
||||
|
||||
/// <summary>The 0 key on the numeric keypad.</summary>
|
||||
NumPad0 = 74, // 0x0000004A
|
||||
/// <summary>The 0 key on the numeric keypad.</summary>
|
||||
NumPad0 = 74, // 0x0000004A
|
||||
|
||||
/// <summary>The 1 key on the numeric keypad.</summary>
|
||||
NumPad1 = 75, // 0x0000004B
|
||||
/// <summary>The 1 key on the numeric keypad.</summary>
|
||||
NumPad1 = 75, // 0x0000004B
|
||||
|
||||
/// <summary>The 2 key on the numeric keypad.</summary>
|
||||
NumPad2 = 76, // 0x0000004C
|
||||
/// <summary>The 2 key on the numeric keypad.</summary>
|
||||
NumPad2 = 76, // 0x0000004C
|
||||
|
||||
/// <summary>The 3 key on the numeric keypad.</summary>
|
||||
NumPad3 = 77, // 0x0000004D
|
||||
/// <summary>The 3 key on the numeric keypad.</summary>
|
||||
NumPad3 = 77, // 0x0000004D
|
||||
|
||||
/// <summary>The 4 key on the numeric keypad.</summary>
|
||||
NumPad4 = 78, // 0x0000004E
|
||||
/// <summary>The 4 key on the numeric keypad.</summary>
|
||||
NumPad4 = 78, // 0x0000004E
|
||||
|
||||
/// <summary>The 5 key on the numeric keypad.</summary>
|
||||
NumPad5 = 79, // 0x0000004F
|
||||
/// <summary>The 5 key on the numeric keypad.</summary>
|
||||
NumPad5 = 79, // 0x0000004F
|
||||
|
||||
/// <summary>The 6 key on the numeric keypad.</summary>
|
||||
NumPad6 = 80, // 0x00000050
|
||||
/// <summary>The 6 key on the numeric keypad.</summary>
|
||||
NumPad6 = 80, // 0x00000050
|
||||
|
||||
/// <summary>The 7 key on the numeric keypad.</summary>
|
||||
NumPad7 = 81, // 0x00000051
|
||||
/// <summary>The 7 key on the numeric keypad.</summary>
|
||||
NumPad7 = 81, // 0x00000051
|
||||
|
||||
/// <summary>The 8 key on the numeric keypad.</summary>
|
||||
NumPad8 = 82, // 0x00000052
|
||||
/// <summary>The 8 key on the numeric keypad.</summary>
|
||||
NumPad8 = 82, // 0x00000052
|
||||
|
||||
/// <summary>The 9 key on the numeric keypad.</summary>
|
||||
NumPad9 = 83, // 0x00000053
|
||||
/// <summary>The 9 key on the numeric keypad.</summary>
|
||||
NumPad9 = 83, // 0x00000053
|
||||
|
||||
/// <summary>The Multiply key.</summary>
|
||||
Multiply = 84, // 0x00000054
|
||||
/// <summary>The Multiply key.</summary>
|
||||
Multiply = 84, // 0x00000054
|
||||
|
||||
/// <summary>The Add key.</summary>
|
||||
Add = 85, // 0x00000055
|
||||
/// <summary>The Add key.</summary>
|
||||
Add = 85, // 0x00000055
|
||||
|
||||
/// <summary>The Separator key.</summary>
|
||||
Separator = 86, // 0x00000056
|
||||
/// <summary>The Separator key.</summary>
|
||||
Separator = 86, // 0x00000056
|
||||
|
||||
/// <summary>The Subtract key.</summary>
|
||||
Subtract = 87, // 0x00000057
|
||||
/// <summary>The Subtract key.</summary>
|
||||
Subtract = 87, // 0x00000057
|
||||
|
||||
/// <summary>The Decimal key.</summary>
|
||||
Decimal = 88, // 0x00000058
|
||||
/// <summary>The Decimal key.</summary>
|
||||
Decimal = 88, // 0x00000058
|
||||
|
||||
/// <summary>The Divide key.</summary>
|
||||
Divide = 89, // 0x00000059
|
||||
/// <summary>The Divide key.</summary>
|
||||
Divide = 89, // 0x00000059
|
||||
|
||||
/// <summary>The F1 key.</summary>
|
||||
F1 = 90, // 0x0000005A
|
||||
/// <summary>The F1 key.</summary>
|
||||
F1 = 90, // 0x0000005A
|
||||
|
||||
/// <summary>The F2 key.</summary>
|
||||
F2 = 91, // 0x0000005B
|
||||
/// <summary>The F2 key.</summary>
|
||||
F2 = 91, // 0x0000005B
|
||||
|
||||
/// <summary>The F3 key.</summary>
|
||||
F3 = 92, // 0x0000005C
|
||||
/// <summary>The F3 key.</summary>
|
||||
F3 = 92, // 0x0000005C
|
||||
|
||||
/// <summary>The F4 key.</summary>
|
||||
F4 = 93, // 0x0000005D
|
||||
/// <summary>The F4 key.</summary>
|
||||
F4 = 93, // 0x0000005D
|
||||
|
||||
/// <summary>The F5 key.</summary>
|
||||
F5 = 94, // 0x0000005E
|
||||
/// <summary>The F5 key.</summary>
|
||||
F5 = 94, // 0x0000005E
|
||||
|
||||
/// <summary>The F6 key.</summary>
|
||||
F6 = 95, // 0x0000005F
|
||||
/// <summary>The F6 key.</summary>
|
||||
F6 = 95, // 0x0000005F
|
||||
|
||||
/// <summary>The F7 key.</summary>
|
||||
F7 = 96, // 0x00000060
|
||||
/// <summary>The F7 key.</summary>
|
||||
F7 = 96, // 0x00000060
|
||||
|
||||
/// <summary>The F8 key.</summary>
|
||||
F8 = 97, // 0x00000061
|
||||
/// <summary>The F8 key.</summary>
|
||||
F8 = 97, // 0x00000061
|
||||
|
||||
/// <summary>The F9 key.</summary>
|
||||
F9 = 98, // 0x00000062
|
||||
/// <summary>The F9 key.</summary>
|
||||
F9 = 98, // 0x00000062
|
||||
|
||||
/// <summary>The F10 key.</summary>
|
||||
F10 = 99, // 0x00000063
|
||||
/// <summary>The F10 key.</summary>
|
||||
F10 = 99, // 0x00000063
|
||||
|
||||
/// <summary>The F11 key.</summary>
|
||||
F11 = 100, // 0x00000064
|
||||
/// <summary>The F11 key.</summary>
|
||||
F11 = 100, // 0x00000064
|
||||
|
||||
/// <summary>The F12 key.</summary>
|
||||
F12 = 101, // 0x00000065
|
||||
/// <summary>The F12 key.</summary>
|
||||
F12 = 101, // 0x00000065
|
||||
|
||||
/// <summary>The F13 key.</summary>
|
||||
F13 = 102, // 0x00000066
|
||||
/// <summary>The F13 key.</summary>
|
||||
F13 = 102, // 0x00000066
|
||||
|
||||
/// <summary>The F14 key.</summary>
|
||||
F14 = 103, // 0x00000067
|
||||
/// <summary>The F14 key.</summary>
|
||||
F14 = 103, // 0x00000067
|
||||
|
||||
/// <summary>The F15 key.</summary>
|
||||
F15 = 104, // 0x00000068
|
||||
/// <summary>The F15 key.</summary>
|
||||
F15 = 104, // 0x00000068
|
||||
|
||||
/// <summary>The F16 key.</summary>
|
||||
F16 = 105, // 0x00000069
|
||||
/// <summary>The F16 key.</summary>
|
||||
F16 = 105, // 0x00000069
|
||||
|
||||
/// <summary>The F17 key.</summary>
|
||||
F17 = 106, // 0x0000006A
|
||||
/// <summary>The F17 key.</summary>
|
||||
F17 = 106, // 0x0000006A
|
||||
|
||||
/// <summary>The F18 key.</summary>
|
||||
F18 = 107, // 0x0000006B
|
||||
/// <summary>The F18 key.</summary>
|
||||
F18 = 107, // 0x0000006B
|
||||
|
||||
/// <summary>The F19 key.</summary>
|
||||
F19 = 108, // 0x0000006C
|
||||
/// <summary>The F19 key.</summary>
|
||||
F19 = 108, // 0x0000006C
|
||||
|
||||
/// <summary>The F20 key.</summary>
|
||||
F20 = 109, // 0x0000006D
|
||||
/// <summary>The F20 key.</summary>
|
||||
F20 = 109, // 0x0000006D
|
||||
|
||||
/// <summary>The F21 key.</summary>
|
||||
F21 = 110, // 0x0000006E
|
||||
/// <summary>The F21 key.</summary>
|
||||
F21 = 110, // 0x0000006E
|
||||
|
||||
/// <summary>The F22 key.</summary>
|
||||
F22 = 111, // 0x0000006F
|
||||
/// <summary>The F22 key.</summary>
|
||||
F22 = 111, // 0x0000006F
|
||||
|
||||
/// <summary>The F23 key.</summary>
|
||||
F23 = 112, // 0x00000070
|
||||
/// <summary>The F23 key.</summary>
|
||||
F23 = 112, // 0x00000070
|
||||
|
||||
/// <summary>The F24 key.</summary>
|
||||
F24 = 113, // 0x00000071
|
||||
/// <summary>The F24 key.</summary>
|
||||
F24 = 113, // 0x00000071
|
||||
|
||||
/// <summary>The Num Lock key.</summary>
|
||||
NumLock = 114, // 0x00000072
|
||||
/// <summary>The Num Lock key.</summary>
|
||||
NumLock = 114, // 0x00000072
|
||||
|
||||
/// <summary>The Scroll Lock key.</summary>
|
||||
Scroll = 115, // 0x00000073
|
||||
/// <summary>The Scroll Lock key.</summary>
|
||||
Scroll = 115, // 0x00000073
|
||||
|
||||
/// <summary>The left Shift key.</summary>
|
||||
LeftShift = 116, // 0x00000074
|
||||
/// <summary>The left Shift key.</summary>
|
||||
LeftShift = 116, // 0x00000074
|
||||
|
||||
/// <summary>The right Shift key.</summary>
|
||||
RightShift = 117, // 0x00000075
|
||||
/// <summary>The right Shift key.</summary>
|
||||
RightShift = 117, // 0x00000075
|
||||
|
||||
/// <summary>The left CTRL key.</summary>
|
||||
LeftCtrl = 118, // 0x00000076
|
||||
/// <summary>The left CTRL key.</summary>
|
||||
LeftCtrl = 118, // 0x00000076
|
||||
|
||||
/// <summary>The right CTRL key.</summary>
|
||||
RightCtrl = 119, // 0x00000077
|
||||
/// <summary>The right CTRL key.</summary>
|
||||
RightCtrl = 119, // 0x00000077
|
||||
|
||||
/// <summary>The left ALT key.</summary>
|
||||
LeftAlt = 120, // 0x00000078
|
||||
/// <summary>The left ALT key.</summary>
|
||||
LeftAlt = 120, // 0x00000078
|
||||
|
||||
/// <summary>The right ALT key.</summary>
|
||||
RightAlt = 121, // 0x00000079
|
||||
/// <summary>The right ALT key.</summary>
|
||||
RightAlt = 121, // 0x00000079
|
||||
|
||||
/// <summary>The Browser Back key.</summary>
|
||||
BrowserBack = 122, // 0x0000007A
|
||||
/// <summary>The Browser Back key.</summary>
|
||||
BrowserBack = 122, // 0x0000007A
|
||||
|
||||
/// <summary>The Browser Forward key.</summary>
|
||||
BrowserForward = 123, // 0x0000007B
|
||||
/// <summary>The Browser Forward key.</summary>
|
||||
BrowserForward = 123, // 0x0000007B
|
||||
|
||||
/// <summary>The Browser Refresh key.</summary>
|
||||
BrowserRefresh = 124, // 0x0000007C
|
||||
/// <summary>The Browser Refresh key.</summary>
|
||||
BrowserRefresh = 124, // 0x0000007C
|
||||
|
||||
/// <summary>The Browser Stop key.</summary>
|
||||
BrowserStop = 125, // 0x0000007D
|
||||
/// <summary>The Browser Stop key.</summary>
|
||||
BrowserStop = 125, // 0x0000007D
|
||||
|
||||
/// <summary>The Browser Search key.</summary>
|
||||
BrowserSearch = 126, // 0x0000007E
|
||||
/// <summary>The Browser Search key.</summary>
|
||||
BrowserSearch = 126, // 0x0000007E
|
||||
|
||||
/// <summary>The Browser Favorites key.</summary>
|
||||
BrowserFavorites = 127, // 0x0000007F
|
||||
/// <summary>The Browser Favorites key.</summary>
|
||||
BrowserFavorites = 127, // 0x0000007F
|
||||
|
||||
/// <summary>The Browser Home key.</summary>
|
||||
BrowserHome = 128, // 0x00000080
|
||||
/// <summary>The Browser Home key.</summary>
|
||||
BrowserHome = 128, // 0x00000080
|
||||
|
||||
/// <summary>The Volume Mute key.</summary>
|
||||
VolumeMute = 129, // 0x00000081
|
||||
/// <summary>The Volume Mute key.</summary>
|
||||
VolumeMute = 129, // 0x00000081
|
||||
|
||||
/// <summary>The Volume Down key.</summary>
|
||||
VolumeDown = 130, // 0x00000082
|
||||
/// <summary>The Volume Down key.</summary>
|
||||
VolumeDown = 130, // 0x00000082
|
||||
|
||||
/// <summary>The Volume Up key.</summary>
|
||||
VolumeUp = 131, // 0x00000083
|
||||
/// <summary>The Volume Up key.</summary>
|
||||
VolumeUp = 131, // 0x00000083
|
||||
|
||||
/// <summary>The Media Next Track key.</summary>
|
||||
MediaNextTrack = 132, // 0x00000084
|
||||
/// <summary>The Media Next Track key.</summary>
|
||||
MediaNextTrack = 132, // 0x00000084
|
||||
|
||||
/// <summary>The Media Previous Track key.</summary>
|
||||
MediaPreviousTrack = 133, // 0x00000085
|
||||
/// <summary>The Media Previous Track key.</summary>
|
||||
MediaPreviousTrack = 133, // 0x00000085
|
||||
|
||||
/// <summary>The Media Stop key.</summary>
|
||||
MediaStop = 134, // 0x00000086
|
||||
/// <summary>The Media Stop key.</summary>
|
||||
MediaStop = 134, // 0x00000086
|
||||
|
||||
/// <summary>The Media Play Pause key.</summary>
|
||||
MediaPlayPause = 135, // 0x00000087
|
||||
/// <summary>The Media Play Pause key.</summary>
|
||||
MediaPlayPause = 135, // 0x00000087
|
||||
|
||||
/// <summary>The Launch Mail key.</summary>
|
||||
LaunchMail = 136, // 0x00000088
|
||||
/// <summary>The Launch Mail key.</summary>
|
||||
LaunchMail = 136, // 0x00000088
|
||||
|
||||
/// <summary>The Select Media key.</summary>
|
||||
SelectMedia = 137, // 0x00000089
|
||||
/// <summary>The Select Media key.</summary>
|
||||
SelectMedia = 137, // 0x00000089
|
||||
|
||||
/// <summary>The Launch Application1 key.</summary>
|
||||
LaunchApplication1 = 138, // 0x0000008A
|
||||
/// <summary>The Launch Application1 key.</summary>
|
||||
LaunchApplication1 = 138, // 0x0000008A
|
||||
|
||||
/// <summary>The Launch Application2 key.</summary>
|
||||
LaunchApplication2 = 139, // 0x0000008B
|
||||
/// <summary>The Launch Application2 key.</summary>
|
||||
LaunchApplication2 = 139, // 0x0000008B
|
||||
|
||||
/// <summary>The OEM Semicolon key.</summary>
|
||||
OemSemicolon = 140, // 0x0000008C
|
||||
/// <summary>The OEM Semicolon key.</summary>
|
||||
OemSemicolon = 140, // 0x0000008C
|
||||
|
||||
/// <summary>The OEM Addition key.</summary>
|
||||
OemPlus = 141, // 0x0000008D
|
||||
/// <summary>The OEM Addition key.</summary>
|
||||
OemPlus = 141, // 0x0000008D
|
||||
|
||||
/// <summary>The OEM Comma key.</summary>
|
||||
OemComma = 142, // 0x0000008E
|
||||
/// <summary>The OEM Comma key.</summary>
|
||||
OemComma = 142, // 0x0000008E
|
||||
|
||||
/// <summary>The OEM Minus key.</summary>
|
||||
OemMinus = 143, // 0x0000008F
|
||||
/// <summary>The OEM Minus key.</summary>
|
||||
OemMinus = 143, // 0x0000008F
|
||||
|
||||
/// <summary>The OEM Period key.</summary>
|
||||
OemPeriod = 144, // 0x00000091
|
||||
/// <summary>The OEM Period key.</summary>
|
||||
OemPeriod = 144, // 0x00000091
|
||||
|
||||
/// <summary>The OEM Question key.</summary>
|
||||
OemQuestion = 145, // 0x00000092
|
||||
/// <summary>The OEM Question key.</summary>
|
||||
OemQuestion = 145, // 0x00000092
|
||||
|
||||
/// <summary>The OEM Tilde key.</summary>
|
||||
OemTilde = 146, // 0x00000092
|
||||
/// <summary>The OEM Tilde key.</summary>
|
||||
OemTilde = 146, // 0x00000092
|
||||
|
||||
/// <summary>The ABNT_C1 (Brazilian) key.</summary>
|
||||
AbntC1 = 147, // 0x00000093
|
||||
/// <summary>The ABNT_C1 (Brazilian) key.</summary>
|
||||
AbntC1 = 147, // 0x00000093
|
||||
|
||||
/// <summary>The ABNT_C2 (Brazilian) key.</summary>
|
||||
AbntC2 = 148, // 0x00000095
|
||||
/// <summary>The ABNT_C2 (Brazilian) key.</summary>
|
||||
AbntC2 = 148, // 0x00000095
|
||||
|
||||
/// <summary>The OEM Open Brackets key.</summary>
|
||||
OemOpenBrackets = 149, // 0x00000096
|
||||
/// <summary>The OEM Open Brackets key.</summary>
|
||||
OemOpenBrackets = 149, // 0x00000096
|
||||
|
||||
/// <summary>The OEM Pipe key.</summary>
|
||||
OemPipe = 150, // 0x00000096
|
||||
/// <summary>The OEM Pipe key.</summary>
|
||||
OemPipe = 150, // 0x00000096
|
||||
|
||||
/// <summary>The OEM Close Brackets key.</summary>
|
||||
OemCloseBrackets = 151, // 0x00000097
|
||||
/// <summary>The OEM Close Brackets key.</summary>
|
||||
OemCloseBrackets = 151, // 0x00000097
|
||||
|
||||
/// <summary>The OEM Quotes key.</summary>
|
||||
OemQuotes = 152, // 0x00000098
|
||||
/// <summary>The OEM Quotes key.</summary>
|
||||
OemQuotes = 152, // 0x00000098
|
||||
|
||||
/// <summary>The OEM Backslash key.</summary>
|
||||
OemBackslash = 154, // 0x0000009A
|
||||
/// <summary>The OEM Backslash key.</summary>
|
||||
OemBackslash = 154, // 0x0000009A
|
||||
|
||||
/// <summary>A special key masking the real key being processed by an IME.</summary>
|
||||
ImeProcessed = 155, // 0x0000009B
|
||||
/// <summary>A special key masking the real key being processed by an IME.</summary>
|
||||
ImeProcessed = 155, // 0x0000009B
|
||||
|
||||
/// <summary>A special key masking the real key being processed as a system key.</summary>
|
||||
System = 156, // 0x0000009C
|
||||
/// <summary>A special key masking the real key being processed as a system key.</summary>
|
||||
System = 156, // 0x0000009C
|
||||
|
||||
/// <summary>The OEM ATTN key.</summary>
|
||||
OemAttn = 157, // 0x0000009D
|
||||
/// <summary>The OEM ATTN key.</summary>
|
||||
OemAttn = 157, // 0x0000009D
|
||||
|
||||
/// <summary>The OEM FINISH key.</summary>
|
||||
OemFinish = 158, // 0x0000009E
|
||||
/// <summary>The OEM FINISH key.</summary>
|
||||
OemFinish = 158, // 0x0000009E
|
||||
|
||||
/// <summary>The OEM COPY key.</summary>
|
||||
OemCopy = 159, // 0x0000009F
|
||||
/// <summary>The OEM COPY key.</summary>
|
||||
OemCopy = 159, // 0x0000009F
|
||||
|
||||
/// <summary>The OEM AUTO key.</summary>
|
||||
OemAuto = 160, // 0x000000A0
|
||||
/// <summary>The OEM AUTO key.</summary>
|
||||
OemAuto = 160, // 0x000000A0
|
||||
|
||||
/// <summary>The OEM ENLW key.</summary>
|
||||
OemEnlw = 161, // 0x000000A1
|
||||
/// <summary>The OEM ENLW key.</summary>
|
||||
OemEnlw = 161, // 0x000000A1
|
||||
|
||||
/// <summary>The OEM BACKTAB key.</summary>
|
||||
OemBackTab = 162, // 0x000000A2
|
||||
/// <summary>The OEM BACKTAB key.</summary>
|
||||
OemBackTab = 162, // 0x000000A2
|
||||
|
||||
/// <summary>The ATTN key.</summary>
|
||||
Attn = 163, // 0x000000A3
|
||||
/// <summary>The ATTN key.</summary>
|
||||
Attn = 163, // 0x000000A3
|
||||
|
||||
/// <summary>The CRSEL key.</summary>
|
||||
CrSel = 164, // 0x000000A4
|
||||
/// <summary>The CRSEL key.</summary>
|
||||
CrSel = 164, // 0x000000A4
|
||||
|
||||
/// <summary>The EXSEL key.</summary>
|
||||
ExSel = 165, // 0x000000A5
|
||||
/// <summary>The EXSEL key.</summary>
|
||||
ExSel = 165, // 0x000000A5
|
||||
|
||||
/// <summary>The ERASE EOF key.</summary>
|
||||
EraseEof = 166, // 0x000000A6
|
||||
/// <summary>The ERASE EOF key.</summary>
|
||||
EraseEof = 166, // 0x000000A6
|
||||
|
||||
/// <summary>The PLAY key.</summary>
|
||||
Play = 167, // 0x000000A7
|
||||
/// <summary>The PLAY key.</summary>
|
||||
Play = 167, // 0x000000A7
|
||||
|
||||
/// <summary>The ZOOM key.</summary>
|
||||
Zoom = 168, // 0x000000A8
|
||||
/// <summary>The ZOOM key.</summary>
|
||||
Zoom = 168, // 0x000000A8
|
||||
|
||||
/// <summary>A constant reserved for future use.</summary>
|
||||
NoName = 169, // 0x000000A9
|
||||
/// <summary>A constant reserved for future use.</summary>
|
||||
NoName = 169, // 0x000000A9
|
||||
|
||||
/// <summary>The PA1 key.</summary>
|
||||
Pa1 = 170, // 0x000000AA
|
||||
/// <summary>The PA1 key.</summary>
|
||||
Pa1 = 170, // 0x000000AA
|
||||
|
||||
/// <summary>The OEM Clear key.</summary>
|
||||
OemClear = 171, // 0x000000AB
|
||||
/// <summary>The OEM Clear key.</summary>
|
||||
OemClear = 171, // 0x000000AB
|
||||
|
||||
/// <summary>The key is used with another key to create a single combined character.</summary>
|
||||
DeadCharProcessed = 172, // 0x000000AC,
|
||||
/// <summary>The key is used with another key to create a single combined character.</summary>
|
||||
DeadCharProcessed = 172, // 0x000000AC,
|
||||
|
||||
/// <summary>The NumPad enter key</summary>
|
||||
NumPadEnter
|
||||
}
|
||||
/// <summary>The NumPad enter key</summary>
|
||||
NumPadEnter
|
||||
}
|
||||
@@ -1,32 +1,26 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the set of modifier keys.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum KeyboardModifierKey
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the set of modifier keys.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum KeyboardModifierKey
|
||||
{
|
||||
/// <summary>No modifiers are pressed.</summary>
|
||||
[Description("None")]
|
||||
None = 0,
|
||||
/// <summary>No modifiers are pressed.</summary>
|
||||
[Description("None")] None = 0,
|
||||
|
||||
/// <summary>The ALT key.</summary>
|
||||
[Description("Alt")]
|
||||
Alt = 1,
|
||||
/// <summary>The ALT key.</summary>
|
||||
[Description("Alt")] Alt = 1,
|
||||
|
||||
/// <summary>The CTRL key.</summary>
|
||||
[Description("Ctrl")]
|
||||
Control = 2,
|
||||
/// <summary>The CTRL key.</summary>
|
||||
[Description("Ctrl")] Control = 2,
|
||||
|
||||
/// <summary>The SHIFT key.</summary>
|
||||
[Description("Shift")]
|
||||
Shift = 4,
|
||||
/// <summary>The SHIFT key.</summary>
|
||||
[Description("Shift")] Shift = 4,
|
||||
|
||||
/// <summary>The Windows logo key.</summary>
|
||||
[Description("Win")]
|
||||
Windows = 8
|
||||
}
|
||||
/// <summary>The Windows logo key.</summary>
|
||||
[Description("Win")] Windows = 8
|
||||
}
|
||||
@@ -1,33 +1,32 @@
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the buttons on a mouse
|
||||
/// </summary>
|
||||
public enum MouseButton
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the buttons on a mouse
|
||||
/// The left mouse button
|
||||
/// </summary>
|
||||
public enum MouseButton
|
||||
{
|
||||
/// <summary>
|
||||
/// The left mouse button
|
||||
/// </summary>
|
||||
Left,
|
||||
Left,
|
||||
|
||||
/// <summary>
|
||||
/// The middle mouse button
|
||||
/// </summary>
|
||||
Middle,
|
||||
/// <summary>
|
||||
/// The middle mouse button
|
||||
/// </summary>
|
||||
Middle,
|
||||
|
||||
/// <summary>
|
||||
/// The right mouse button
|
||||
/// </summary>
|
||||
Right,
|
||||
/// <summary>
|
||||
/// The right mouse button
|
||||
/// </summary>
|
||||
Right,
|
||||
|
||||
/// <summary>
|
||||
/// Extra mouse button 4 (backwards)
|
||||
/// </summary>
|
||||
Button4,
|
||||
/// <summary>
|
||||
/// Extra mouse button 4 (backwards)
|
||||
/// </summary>
|
||||
Button4,
|
||||
|
||||
/// <summary>
|
||||
/// Extra mouse button 5 (forwards)
|
||||
/// </summary>
|
||||
Button5
|
||||
}
|
||||
/// <summary>
|
||||
/// Extra mouse button 5 (forwards)
|
||||
/// </summary>
|
||||
Button5
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies mouse scrolling directions
|
||||
/// </summary>
|
||||
public enum MouseScrollDirection
|
||||
{
|
||||
/// <summary>A vertical scroll direction</summary>
|
||||
Vertical,
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>A horizontal scroll direction</summary>
|
||||
Horizontal
|
||||
}
|
||||
/// <summary>
|
||||
/// Specifies mouse scrolling directions
|
||||
/// </summary>
|
||||
public enum MouseScrollDirection
|
||||
{
|
||||
/// <summary>A vertical scroll direction</summary>
|
||||
Vertical,
|
||||
|
||||
/// <summary>A horizontal scroll direction</summary>
|
||||
Horizontal
|
||||
}
|
||||
@@ -1,38 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class ArtemisKeyboardKeyEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class ArtemisKeyboardKeyEventArgs : EventArgs
|
||||
internal ArtemisKeyboardKeyEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKey modifiers)
|
||||
{
|
||||
internal ArtemisKeyboardKeyEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKey modifiers)
|
||||
{
|
||||
Device = device;
|
||||
Led = led;
|
||||
Key = key;
|
||||
Modifiers = modifiers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LED that corresponds to the pressed key
|
||||
/// </summary>
|
||||
public ArtemisLed? Led { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key that triggered the event
|
||||
/// </summary>
|
||||
public KeyboardKey Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the modifiers that are pressed
|
||||
/// </summary>
|
||||
public KeyboardModifierKey Modifiers { get; }
|
||||
Device = device;
|
||||
Led = led;
|
||||
Key = key;
|
||||
Modifiers = modifiers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LED that corresponds to the pressed key
|
||||
/// </summary>
|
||||
public ArtemisLed? Led { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key that triggered the event
|
||||
/// </summary>
|
||||
public KeyboardKey Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the modifiers that are pressed
|
||||
/// </summary>
|
||||
public KeyboardModifierKey Modifiers { get; }
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class ArtemisKeyboardKeyUpDownEventArgs : ArtemisKeyboardKeyEventArgs
|
||||
{
|
||||
internal ArtemisKeyboardKeyUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKey modifiers, bool isDown) : base(device, led, key, modifiers)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the key is being pressed down, if <see langword="false"/> the key is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class ArtemisKeyboardKeyUpDownEventArgs : ArtemisKeyboardKeyEventArgs
|
||||
{
|
||||
internal ArtemisKeyboardKeyUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKey modifiers, bool isDown) : base(device, led, key, modifiers)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the key is being pressed down, if <see langword="false" /> the key is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
}
|
||||
@@ -1,26 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class ArtemisKeyboardToggleStatusArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class ArtemisKeyboardToggleStatusArgs : EventArgs
|
||||
internal ArtemisKeyboardToggleStatusArgs(KeyboardToggleStatus oldStatus, KeyboardToggleStatus newStatus)
|
||||
{
|
||||
internal ArtemisKeyboardToggleStatusArgs(KeyboardToggleStatus oldStatus, KeyboardToggleStatus newStatus)
|
||||
{
|
||||
OldStatus = oldStatus;
|
||||
NewStatus = newStatus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keyboard status before the change
|
||||
/// </summary>
|
||||
public KeyboardToggleStatus OldStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keyboard status after the change
|
||||
/// </summary>
|
||||
public KeyboardToggleStatus NewStatus { get; }
|
||||
OldStatus = oldStatus;
|
||||
NewStatus = newStatus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keyboard status before the change
|
||||
/// </summary>
|
||||
public KeyboardToggleStatus OldStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keyboard status after the change
|
||||
/// </summary>
|
||||
public KeyboardToggleStatus NewStatus { get; }
|
||||
}
|
||||
@@ -1,32 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for mouse input events
|
||||
/// </summary>
|
||||
public class ArtemisMouseButtonEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse input events
|
||||
/// </summary>
|
||||
public class ArtemisMouseButtonEventArgs : EventArgs
|
||||
internal ArtemisMouseButtonEventArgs(ArtemisDevice? device, ArtemisLed? led, MouseButton button)
|
||||
{
|
||||
internal ArtemisMouseButtonEventArgs(ArtemisDevice? device, ArtemisLed? led, MouseButton button)
|
||||
{
|
||||
Device = device;
|
||||
Led = led;
|
||||
Button = button;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LED that corresponds to the pressed key
|
||||
/// </summary>
|
||||
public ArtemisLed? Led { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the button that triggered the event
|
||||
/// </summary>
|
||||
public MouseButton Button { get; }
|
||||
Device = device;
|
||||
Led = led;
|
||||
Button = button;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LED that corresponds to the pressed key
|
||||
/// </summary>
|
||||
public ArtemisLed? Led { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the button that triggered the event
|
||||
/// </summary>
|
||||
public MouseButton Button { get; }
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse input events
|
||||
/// </summary>
|
||||
public class ArtemisMouseButtonUpDownEventArgs : ArtemisMouseButtonEventArgs
|
||||
{
|
||||
internal ArtemisMouseButtonUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, MouseButton button, bool isDown) : base(device, led, button)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the button is being pressed down, if <see langword="false"/> the button is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
/// <summary>
|
||||
/// Contains data for mouse input events
|
||||
/// </summary>
|
||||
public class ArtemisMouseButtonUpDownEventArgs : ArtemisMouseButtonEventArgs
|
||||
{
|
||||
internal ArtemisMouseButtonUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, MouseButton button, bool isDown) : base(device, led, button)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the button is being pressed down, if <see langword="false" /> the button is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
}
|
||||
@@ -1,51 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for mouse movement events
|
||||
/// </summary>
|
||||
public class ArtemisMouseMoveEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse movement events
|
||||
/// </summary>
|
||||
public class ArtemisMouseMoveEventArgs : EventArgs
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
internal ArtemisMouseMoveEventArgs(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
internal ArtemisMouseMoveEventArgs(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
Device = device;
|
||||
CursorX = cursorX;
|
||||
CursorY = cursorY;
|
||||
DeltaX = deltaX;
|
||||
DeltaY = deltaY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the X position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Y position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorY { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the horizontal direction
|
||||
/// </summary>
|
||||
public int DeltaX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the vertical direction
|
||||
/// </summary>
|
||||
public int DeltaY { get; }
|
||||
Device = device;
|
||||
CursorX = cursorX;
|
||||
CursorY = cursorY;
|
||||
DeltaX = deltaX;
|
||||
DeltaY = deltaY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the X position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Y position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorY { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the horizontal direction
|
||||
/// </summary>
|
||||
public int DeltaX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the vertical direction
|
||||
/// </summary>
|
||||
public int DeltaY { get; }
|
||||
}
|
||||
@@ -1,57 +1,56 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for mouse scroll events
|
||||
/// </summary>
|
||||
public class ArtemisMouseScrollEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse scroll events
|
||||
/// </summary>
|
||||
public class ArtemisMouseScrollEventArgs : EventArgs
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
internal ArtemisMouseScrollEventArgs(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
internal ArtemisMouseScrollEventArgs(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
Device = device;
|
||||
Direction = direction;
|
||||
Delta = delta;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the direction in which was scrolled
|
||||
/// </summary>
|
||||
public MouseScrollDirection Direction { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scroll delta (can positive or negative)
|
||||
/// </summary>
|
||||
public int Delta { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled up
|
||||
/// </summary>
|
||||
public bool IsScrollingUp => Direction == MouseScrollDirection.Vertical && Delta > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled down
|
||||
/// </summary>
|
||||
public bool IsScrollingDown => Direction == MouseScrollDirection.Vertical && Delta < 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled right
|
||||
/// </summary>
|
||||
public bool IsScrollingRight => Direction == MouseScrollDirection.Horizontal && Delta > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled left
|
||||
/// </summary>
|
||||
public bool IsScrollingLeft => Direction == MouseScrollDirection.Horizontal && Delta < 0;
|
||||
Device = device;
|
||||
Direction = direction;
|
||||
Delta = delta;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the direction in which was scrolled
|
||||
/// </summary>
|
||||
public MouseScrollDirection Direction { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scroll delta (can positive or negative)
|
||||
/// </summary>
|
||||
public int Delta { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled up
|
||||
/// </summary>
|
||||
public bool IsScrollingUp => Direction == MouseScrollDirection.Vertical && Delta > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled down
|
||||
/// </summary>
|
||||
public bool IsScrollingDown => Direction == MouseScrollDirection.Vertical && Delta < 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled right
|
||||
/// </summary>
|
||||
public bool IsScrollingRight => Direction == MouseScrollDirection.Horizontal && Delta > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled left
|
||||
/// </summary>
|
||||
public bool IsScrollingLeft => Direction == MouseScrollDirection.Horizontal && Delta < 0;
|
||||
}
|
||||
@@ -1,31 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for input provider identifier events
|
||||
/// </summary>
|
||||
public class InputProviderIdentifierEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider identifier events
|
||||
/// Creates a new instance of the <see cref="InputProviderIdentifierEventArgs" /> class
|
||||
/// </summary>
|
||||
public class InputProviderIdentifierEventArgs : EventArgs
|
||||
/// <param name="identifier">A value that can be used to identify this device</param>
|
||||
/// <param name="deviceType">The type of device this identifier belongs to</param>
|
||||
public InputProviderIdentifierEventArgs(object identifier, InputDeviceType deviceType)
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="InputProviderIdentifierEventArgs" /> class
|
||||
/// </summary>
|
||||
/// <param name="identifier">A value that can be used to identify this device</param>
|
||||
/// <param name="deviceType">The type of device this identifier belongs to</param>
|
||||
public InputProviderIdentifierEventArgs(object identifier, InputDeviceType deviceType)
|
||||
{
|
||||
Identifier = identifier;
|
||||
DeviceType = deviceType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value that can be used to identify this device
|
||||
/// </summary>
|
||||
public object Identifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of device this identifier belongs to
|
||||
/// </summary>
|
||||
public InputDeviceType DeviceType { get; }
|
||||
Identifier = identifier;
|
||||
DeviceType = deviceType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value that can be used to identify this device
|
||||
/// </summary>
|
||||
public object Identifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of device this identifier belongs to
|
||||
/// </summary>
|
||||
public InputDeviceType DeviceType { get; }
|
||||
}
|
||||
@@ -1,38 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for input provider keyboard events
|
||||
/// </summary>
|
||||
public class InputProviderKeyboardEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider keyboard events
|
||||
/// Creates a new instance of the <see cref="InputProviderKeyboardEventArgs " /> class
|
||||
/// </summary>
|
||||
public class InputProviderKeyboardEventArgs : EventArgs
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="key">The key that triggered the event</param>
|
||||
/// <param name="isDown">Whether the key is pressed down</param>
|
||||
public InputProviderKeyboardEventArgs(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="InputProviderKeyboardEventArgs " /> class
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="key">The key that triggered the event</param>
|
||||
/// <param name="isDown">Whether the key is pressed down</param>
|
||||
public InputProviderKeyboardEventArgs(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
Device = device;
|
||||
Key = key;
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key that triggered the event
|
||||
/// </summary>
|
||||
public KeyboardKey Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the key is pressed down
|
||||
/// </summary>
|
||||
public bool IsDown { get; }
|
||||
Device = device;
|
||||
Key = key;
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key that triggered the event
|
||||
/// </summary>
|
||||
public KeyboardKey Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the key is pressed down
|
||||
/// </summary>
|
||||
public bool IsDown { get; }
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for input provider keyboard status toggle events
|
||||
/// </summary>
|
||||
public class InputProviderKeyboardToggleEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider keyboard status toggle events
|
||||
/// Creates a new instance of the <see cref="InputProviderKeyboardToggleEventArgs " /> class
|
||||
/// </summary>
|
||||
public class InputProviderKeyboardToggleEventArgs : EventArgs
|
||||
/// <param name="keyboardToggleStatus">The toggle status of the keyboard</param>
|
||||
public InputProviderKeyboardToggleEventArgs(KeyboardToggleStatus keyboardToggleStatus)
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="InputProviderKeyboardToggleEventArgs " /> class
|
||||
/// </summary>
|
||||
/// <param name="keyboardToggleStatus">The toggle status of the keyboard</param>
|
||||
public InputProviderKeyboardToggleEventArgs(KeyboardToggleStatus keyboardToggleStatus)
|
||||
{
|
||||
KeyboardToggleStatus = keyboardToggleStatus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the toggle status of the keyboard
|
||||
/// </summary>
|
||||
public KeyboardToggleStatus KeyboardToggleStatus { get; }
|
||||
KeyboardToggleStatus = keyboardToggleStatus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the toggle status of the keyboard
|
||||
/// </summary>
|
||||
public KeyboardToggleStatus KeyboardToggleStatus { get; }
|
||||
}
|
||||
@@ -1,37 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for input provider mouse button events
|
||||
/// </summary>
|
||||
public class InputProviderMouseButtonEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider mouse button events
|
||||
/// </summary>
|
||||
public class InputProviderMouseButtonEventArgs : EventArgs
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="button">The button that triggered the event</param>
|
||||
/// <param name="isDown">Whether the button is pressed down</param>
|
||||
public InputProviderMouseButtonEventArgs(ArtemisDevice? device, MouseButton button, bool isDown)
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="button">The button that triggered the event</param>
|
||||
/// <param name="isDown">Whether the button is pressed down</param>
|
||||
public InputProviderMouseButtonEventArgs(ArtemisDevice? device, MouseButton button, bool isDown)
|
||||
{
|
||||
Device = device;
|
||||
Button = button;
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the button that triggered the event
|
||||
/// </summary>
|
||||
public MouseButton Button { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the button is pressed down
|
||||
/// </summary>
|
||||
public bool IsDown { get; }
|
||||
Device = device;
|
||||
Button = button;
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the button that triggered the event
|
||||
/// </summary>
|
||||
public MouseButton Button { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the button is pressed down
|
||||
/// </summary>
|
||||
public bool IsDown { get; }
|
||||
}
|
||||
@@ -1,51 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for input provider mouse movement events
|
||||
/// </summary>
|
||||
public class InputProviderMouseMoveEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider mouse movement events
|
||||
/// </summary>
|
||||
public class InputProviderMouseMoveEventArgs : EventArgs
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
public InputProviderMouseMoveEventArgs(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
public InputProviderMouseMoveEventArgs(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
Device = device;
|
||||
CursorX = cursorX;
|
||||
CursorY = cursorY;
|
||||
DeltaX = deltaX;
|
||||
DeltaY = deltaY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the X position of the mouse cursor in pixels (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Y position of the mouse cursor in pixels (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorY { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the horizontal direction in pixels
|
||||
/// </summary>
|
||||
public int DeltaX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the vertical direction in pixels
|
||||
/// </summary>
|
||||
public int DeltaY { get; }
|
||||
Device = device;
|
||||
CursorX = cursorX;
|
||||
CursorY = cursorY;
|
||||
DeltaX = deltaX;
|
||||
DeltaY = deltaY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the X position of the mouse cursor in pixels (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Y position of the mouse cursor in pixels (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorY { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the horizontal direction in pixels
|
||||
/// </summary>
|
||||
public int DeltaX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the vertical direction in pixels
|
||||
/// </summary>
|
||||
public int DeltaY { get; }
|
||||
}
|
||||
@@ -1,37 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for input provider mouse button events
|
||||
/// </summary>
|
||||
public class InputProviderMouseScrollEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider mouse button events
|
||||
/// </summary>
|
||||
public class InputProviderMouseScrollEventArgs : EventArgs
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
public InputProviderMouseScrollEventArgs(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
public InputProviderMouseScrollEventArgs(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
Device = device;
|
||||
Direction = direction;
|
||||
Delta = delta;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the direction in which was scrolled
|
||||
/// </summary>
|
||||
public MouseScrollDirection Direction { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scroll delta (can positive or negative)
|
||||
/// </summary>
|
||||
public int Delta { get; }
|
||||
Device = device;
|
||||
Direction = direction;
|
||||
Delta = delta;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the direction in which was scrolled
|
||||
/// </summary>
|
||||
public MouseScrollDirection Direction { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scroll delta (can positive or negative)
|
||||
/// </summary>
|
||||
public int Delta { get; }
|
||||
}
|
||||
@@ -1,203 +1,202 @@
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Utilities for mapping keys and buttons to LEDs
|
||||
/// </summary>
|
||||
public static class InputKeyUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Utilities for mapping keys and buttons to LEDs
|
||||
/// A dictionary of mappings between <see cref="KeyboardKey" /> and <see cref="LedId" />
|
||||
/// </summary>
|
||||
public static class InputKeyUtilities
|
||||
public static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new()
|
||||
{
|
||||
/// <summary>
|
||||
/// A dictionary of mappings between <see cref="KeyboardKey" /> and <see cref="LedId" />
|
||||
/// </summary>
|
||||
public static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new()
|
||||
{
|
||||
{KeyboardKey.None, LedId.Keyboard_Custom1},
|
||||
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
|
||||
{KeyboardKey.Back, LedId.Keyboard_Backspace},
|
||||
{KeyboardKey.Tab, LedId.Keyboard_Tab},
|
||||
{KeyboardKey.LineFeed, LedId.Keyboard_Custom3},
|
||||
{KeyboardKey.Clear, LedId.Keyboard_Custom4},
|
||||
{KeyboardKey.Enter, LedId.Keyboard_Enter},
|
||||
{KeyboardKey.Pause, LedId.Keyboard_PauseBreak},
|
||||
{KeyboardKey.CapsLock, LedId.Keyboard_CapsLock},
|
||||
{KeyboardKey.HangulMode, LedId.Keyboard_Custom4},
|
||||
{KeyboardKey.JunjaMode, LedId.Keyboard_Custom5},
|
||||
{KeyboardKey.FinalMode, LedId.Keyboard_Custom6},
|
||||
{KeyboardKey.HanjaMode, LedId.Keyboard_Custom7},
|
||||
{KeyboardKey.Escape, LedId.Keyboard_Escape},
|
||||
{KeyboardKey.ImeConvert, LedId.Keyboard_Custom8},
|
||||
{KeyboardKey.ImeNonConvert, LedId.Keyboard_Custom9},
|
||||
{KeyboardKey.ImeAccept, LedId.Keyboard_Custom10},
|
||||
{KeyboardKey.ImeModeChange, LedId.Keyboard_Custom11},
|
||||
{KeyboardKey.Space, LedId.Keyboard_Space},
|
||||
{KeyboardKey.PageUp, LedId.Keyboard_PageUp},
|
||||
{KeyboardKey.PageDown, LedId.Keyboard_PageDown},
|
||||
{KeyboardKey.End, LedId.Keyboard_End},
|
||||
{KeyboardKey.Home, LedId.Keyboard_Home},
|
||||
{KeyboardKey.Left, LedId.Keyboard_ArrowLeft},
|
||||
{KeyboardKey.Up, LedId.Keyboard_ArrowUp},
|
||||
{KeyboardKey.Right, LedId.Keyboard_ArrowRight},
|
||||
{KeyboardKey.Down, LedId.Keyboard_ArrowDown},
|
||||
{KeyboardKey.Select, LedId.Keyboard_Custom12},
|
||||
{KeyboardKey.Print, LedId.Keyboard_Custom13},
|
||||
{KeyboardKey.Execute, LedId.Keyboard_Custom14},
|
||||
{KeyboardKey.PrintScreen, LedId.Keyboard_PrintScreen},
|
||||
{KeyboardKey.Insert, LedId.Keyboard_Insert},
|
||||
{KeyboardKey.Delete, LedId.Keyboard_Delete},
|
||||
{KeyboardKey.Help, LedId.Keyboard_Custom15},
|
||||
{KeyboardKey.D0, LedId.Keyboard_0},
|
||||
{KeyboardKey.D1, LedId.Keyboard_1},
|
||||
{KeyboardKey.D2, LedId.Keyboard_2},
|
||||
{KeyboardKey.D3, LedId.Keyboard_3},
|
||||
{KeyboardKey.D4, LedId.Keyboard_4},
|
||||
{KeyboardKey.D5, LedId.Keyboard_5},
|
||||
{KeyboardKey.D6, LedId.Keyboard_6},
|
||||
{KeyboardKey.D7, LedId.Keyboard_7},
|
||||
{KeyboardKey.D8, LedId.Keyboard_8},
|
||||
{KeyboardKey.D9, LedId.Keyboard_9},
|
||||
{KeyboardKey.A, LedId.Keyboard_A},
|
||||
{KeyboardKey.B, LedId.Keyboard_B},
|
||||
{KeyboardKey.C, LedId.Keyboard_C},
|
||||
{KeyboardKey.D, LedId.Keyboard_D},
|
||||
{KeyboardKey.E, LedId.Keyboard_E},
|
||||
{KeyboardKey.F, LedId.Keyboard_F},
|
||||
{KeyboardKey.G, LedId.Keyboard_G},
|
||||
{KeyboardKey.H, LedId.Keyboard_H},
|
||||
{KeyboardKey.I, LedId.Keyboard_I},
|
||||
{KeyboardKey.J, LedId.Keyboard_J},
|
||||
{KeyboardKey.K, LedId.Keyboard_K},
|
||||
{KeyboardKey.L, LedId.Keyboard_L},
|
||||
{KeyboardKey.M, LedId.Keyboard_M},
|
||||
{KeyboardKey.N, LedId.Keyboard_N},
|
||||
{KeyboardKey.O, LedId.Keyboard_O},
|
||||
{KeyboardKey.P, LedId.Keyboard_P},
|
||||
{KeyboardKey.Q, LedId.Keyboard_Q},
|
||||
{KeyboardKey.R, LedId.Keyboard_R},
|
||||
{KeyboardKey.S, LedId.Keyboard_S},
|
||||
{KeyboardKey.T, LedId.Keyboard_T},
|
||||
{KeyboardKey.U, LedId.Keyboard_U},
|
||||
{KeyboardKey.V, LedId.Keyboard_V},
|
||||
{KeyboardKey.W, LedId.Keyboard_W},
|
||||
{KeyboardKey.X, LedId.Keyboard_X},
|
||||
{KeyboardKey.Y, LedId.Keyboard_Y},
|
||||
{KeyboardKey.Z, LedId.Keyboard_Z},
|
||||
{KeyboardKey.LWin, LedId.Keyboard_LeftGui},
|
||||
{KeyboardKey.RWin, LedId.Keyboard_RightGui},
|
||||
{KeyboardKey.Apps, LedId.Keyboard_Application},
|
||||
{KeyboardKey.Sleep, LedId.Keyboard_Custom16},
|
||||
{KeyboardKey.NumPad0, LedId.Keyboard_Num0},
|
||||
{KeyboardKey.NumPad1, LedId.Keyboard_Num1},
|
||||
{KeyboardKey.NumPad2, LedId.Keyboard_Num2},
|
||||
{KeyboardKey.NumPad3, LedId.Keyboard_Num3},
|
||||
{KeyboardKey.NumPad4, LedId.Keyboard_Num4},
|
||||
{KeyboardKey.NumPad5, LedId.Keyboard_Num5},
|
||||
{KeyboardKey.NumPad6, LedId.Keyboard_Num6},
|
||||
{KeyboardKey.NumPad7, LedId.Keyboard_Num7},
|
||||
{KeyboardKey.NumPad8, LedId.Keyboard_Num8},
|
||||
{KeyboardKey.NumPad9, LedId.Keyboard_Num9},
|
||||
{KeyboardKey.Multiply, LedId.Keyboard_NumAsterisk},
|
||||
{KeyboardKey.Add, LedId.Keyboard_NumPlus},
|
||||
{KeyboardKey.Separator, LedId.Keyboard_NumEnter}, // unverified
|
||||
{KeyboardKey.Subtract, LedId.Keyboard_NumMinus},
|
||||
{KeyboardKey.Decimal, LedId.Keyboard_NumPeriodAndDelete},
|
||||
{KeyboardKey.Divide, LedId.Keyboard_NumSlash},
|
||||
{KeyboardKey.F1, LedId.Keyboard_F1},
|
||||
{KeyboardKey.F2, LedId.Keyboard_F2},
|
||||
{KeyboardKey.F3, LedId.Keyboard_F3},
|
||||
{KeyboardKey.F4, LedId.Keyboard_F4},
|
||||
{KeyboardKey.F5, LedId.Keyboard_F5},
|
||||
{KeyboardKey.F6, LedId.Keyboard_F6},
|
||||
{KeyboardKey.F7, LedId.Keyboard_F7},
|
||||
{KeyboardKey.F8, LedId.Keyboard_F8},
|
||||
{KeyboardKey.F9, LedId.Keyboard_F9},
|
||||
{KeyboardKey.F10, LedId.Keyboard_F10},
|
||||
{KeyboardKey.F11, LedId.Keyboard_F11},
|
||||
{KeyboardKey.F12, LedId.Keyboard_F12},
|
||||
{KeyboardKey.F13, LedId.Keyboard_Custom17},
|
||||
{KeyboardKey.F14, LedId.Keyboard_Custom18},
|
||||
{KeyboardKey.F15, LedId.Keyboard_Custom19},
|
||||
{KeyboardKey.F16, LedId.Keyboard_Custom20},
|
||||
{KeyboardKey.F17, LedId.Keyboard_Custom21},
|
||||
{KeyboardKey.F18, LedId.Keyboard_Custom22},
|
||||
{KeyboardKey.F19, LedId.Keyboard_Custom23},
|
||||
{KeyboardKey.F20, LedId.Keyboard_Custom24},
|
||||
{KeyboardKey.F21, LedId.Keyboard_Custom25},
|
||||
{KeyboardKey.F22, LedId.Keyboard_Custom26},
|
||||
{KeyboardKey.F23, LedId.Keyboard_Custom27},
|
||||
{KeyboardKey.F24, LedId.Keyboard_Custom28},
|
||||
{KeyboardKey.NumLock, LedId.Keyboard_NumLock},
|
||||
{KeyboardKey.Scroll, LedId.Keyboard_ScrollLock},
|
||||
{KeyboardKey.LeftShift, LedId.Keyboard_LeftShift},
|
||||
{KeyboardKey.RightShift, LedId.Keyboard_RightShift},
|
||||
{KeyboardKey.LeftCtrl, LedId.Keyboard_LeftCtrl},
|
||||
{KeyboardKey.RightCtrl, LedId.Keyboard_RightCtrl},
|
||||
{KeyboardKey.LeftAlt, LedId.Keyboard_LeftAlt},
|
||||
{KeyboardKey.RightAlt, LedId.Keyboard_RightAlt},
|
||||
{KeyboardKey.BrowserBack, LedId.Keyboard_Custom29},
|
||||
{KeyboardKey.BrowserForward, LedId.Keyboard_Custom30},
|
||||
{KeyboardKey.BrowserRefresh, LedId.Keyboard_Custom31},
|
||||
{KeyboardKey.BrowserStop, LedId.Keyboard_Custom32},
|
||||
{KeyboardKey.BrowserSearch, LedId.Keyboard_Custom33},
|
||||
{KeyboardKey.BrowserFavorites, LedId.Keyboard_Custom34},
|
||||
{KeyboardKey.BrowserHome, LedId.Keyboard_Custom35},
|
||||
{KeyboardKey.VolumeMute, LedId.Keyboard_MediaMute},
|
||||
{KeyboardKey.VolumeDown, LedId.Keyboard_MediaVolumeDown},
|
||||
{KeyboardKey.VolumeUp, LedId.Keyboard_MediaVolumeUp},
|
||||
{KeyboardKey.MediaNextTrack, LedId.Keyboard_MediaNextTrack},
|
||||
{KeyboardKey.MediaPreviousTrack, LedId.Keyboard_MediaPreviousTrack},
|
||||
{KeyboardKey.MediaStop, LedId.Keyboard_MediaStop},
|
||||
{KeyboardKey.MediaPlayPause, LedId.Keyboard_MediaPlay},
|
||||
{KeyboardKey.LaunchMail, LedId.Keyboard_Custom36},
|
||||
{KeyboardKey.SelectMedia, LedId.Keyboard_Custom37},
|
||||
{KeyboardKey.LaunchApplication1, LedId.Keyboard_Custom38},
|
||||
{KeyboardKey.LaunchApplication2, LedId.Keyboard_Custom39},
|
||||
{KeyboardKey.OemSemicolon, LedId.Keyboard_SemicolonAndColon},
|
||||
{KeyboardKey.OemPlus, LedId.Keyboard_EqualsAndPlus},
|
||||
{KeyboardKey.OemMinus, LedId.Keyboard_MinusAndUnderscore},
|
||||
{KeyboardKey.OemComma, LedId.Keyboard_CommaAndLessThan},
|
||||
{KeyboardKey.OemPeriod, LedId.Keyboard_PeriodAndBiggerThan},
|
||||
{KeyboardKey.OemQuestion, LedId.Keyboard_SlashAndQuestionMark},
|
||||
{KeyboardKey.OemTilde, LedId.Keyboard_GraveAccentAndTilde},
|
||||
{KeyboardKey.AbntC1, LedId.Keyboard_Custom40},
|
||||
{KeyboardKey.AbntC2, LedId.Keyboard_Custom41},
|
||||
{KeyboardKey.OemOpenBrackets, LedId.Keyboard_BracketLeft},
|
||||
{KeyboardKey.OemPipe, LedId.Keyboard_Backslash},
|
||||
{KeyboardKey.OemCloseBrackets, LedId.Keyboard_BracketRight},
|
||||
{KeyboardKey.OemQuotes, LedId.Keyboard_ApostropheAndDoubleQuote},
|
||||
{KeyboardKey.OemBackslash, LedId.Keyboard_Custom42}, // unverified
|
||||
{KeyboardKey.ImeProcessed, LedId.Keyboard_Custom43},
|
||||
{KeyboardKey.System, LedId.Keyboard_Custom44},
|
||||
{KeyboardKey.OemAttn, LedId.Keyboard_Custom45},
|
||||
{KeyboardKey.OemFinish, LedId.Keyboard_Custom46},
|
||||
{KeyboardKey.OemCopy, LedId.Keyboard_Custom47},
|
||||
{KeyboardKey.OemAuto, LedId.Keyboard_Custom48},
|
||||
{KeyboardKey.OemEnlw, LedId.Keyboard_Custom49},
|
||||
{KeyboardKey.OemBackTab, LedId.Keyboard_Custom50},
|
||||
{KeyboardKey.Attn, LedId.Keyboard_Custom51},
|
||||
{KeyboardKey.CrSel, LedId.Keyboard_Custom52},
|
||||
{KeyboardKey.ExSel, LedId.Keyboard_Custom53},
|
||||
{KeyboardKey.EraseEof, LedId.Keyboard_Custom54},
|
||||
{KeyboardKey.Play, LedId.Keyboard_MediaPlay},
|
||||
{KeyboardKey.Zoom, LedId.Keyboard_Custom55},
|
||||
{KeyboardKey.NoName, LedId.Keyboard_Custom56},
|
||||
{KeyboardKey.Pa1, LedId.Keyboard_Custom57},
|
||||
{KeyboardKey.OemClear, LedId.Keyboard_Custom58},
|
||||
{KeyboardKey.DeadCharProcessed, LedId.Keyboard_Custom59},
|
||||
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
|
||||
};
|
||||
{KeyboardKey.None, LedId.Keyboard_Custom1},
|
||||
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
|
||||
{KeyboardKey.Back, LedId.Keyboard_Backspace},
|
||||
{KeyboardKey.Tab, LedId.Keyboard_Tab},
|
||||
{KeyboardKey.LineFeed, LedId.Keyboard_Custom3},
|
||||
{KeyboardKey.Clear, LedId.Keyboard_Custom4},
|
||||
{KeyboardKey.Enter, LedId.Keyboard_Enter},
|
||||
{KeyboardKey.Pause, LedId.Keyboard_PauseBreak},
|
||||
{KeyboardKey.CapsLock, LedId.Keyboard_CapsLock},
|
||||
{KeyboardKey.HangulMode, LedId.Keyboard_Custom4},
|
||||
{KeyboardKey.JunjaMode, LedId.Keyboard_Custom5},
|
||||
{KeyboardKey.FinalMode, LedId.Keyboard_Custom6},
|
||||
{KeyboardKey.HanjaMode, LedId.Keyboard_Custom7},
|
||||
{KeyboardKey.Escape, LedId.Keyboard_Escape},
|
||||
{KeyboardKey.ImeConvert, LedId.Keyboard_Custom8},
|
||||
{KeyboardKey.ImeNonConvert, LedId.Keyboard_Custom9},
|
||||
{KeyboardKey.ImeAccept, LedId.Keyboard_Custom10},
|
||||
{KeyboardKey.ImeModeChange, LedId.Keyboard_Custom11},
|
||||
{KeyboardKey.Space, LedId.Keyboard_Space},
|
||||
{KeyboardKey.PageUp, LedId.Keyboard_PageUp},
|
||||
{KeyboardKey.PageDown, LedId.Keyboard_PageDown},
|
||||
{KeyboardKey.End, LedId.Keyboard_End},
|
||||
{KeyboardKey.Home, LedId.Keyboard_Home},
|
||||
{KeyboardKey.Left, LedId.Keyboard_ArrowLeft},
|
||||
{KeyboardKey.Up, LedId.Keyboard_ArrowUp},
|
||||
{KeyboardKey.Right, LedId.Keyboard_ArrowRight},
|
||||
{KeyboardKey.Down, LedId.Keyboard_ArrowDown},
|
||||
{KeyboardKey.Select, LedId.Keyboard_Custom12},
|
||||
{KeyboardKey.Print, LedId.Keyboard_Custom13},
|
||||
{KeyboardKey.Execute, LedId.Keyboard_Custom14},
|
||||
{KeyboardKey.PrintScreen, LedId.Keyboard_PrintScreen},
|
||||
{KeyboardKey.Insert, LedId.Keyboard_Insert},
|
||||
{KeyboardKey.Delete, LedId.Keyboard_Delete},
|
||||
{KeyboardKey.Help, LedId.Keyboard_Custom15},
|
||||
{KeyboardKey.D0, LedId.Keyboard_0},
|
||||
{KeyboardKey.D1, LedId.Keyboard_1},
|
||||
{KeyboardKey.D2, LedId.Keyboard_2},
|
||||
{KeyboardKey.D3, LedId.Keyboard_3},
|
||||
{KeyboardKey.D4, LedId.Keyboard_4},
|
||||
{KeyboardKey.D5, LedId.Keyboard_5},
|
||||
{KeyboardKey.D6, LedId.Keyboard_6},
|
||||
{KeyboardKey.D7, LedId.Keyboard_7},
|
||||
{KeyboardKey.D8, LedId.Keyboard_8},
|
||||
{KeyboardKey.D9, LedId.Keyboard_9},
|
||||
{KeyboardKey.A, LedId.Keyboard_A},
|
||||
{KeyboardKey.B, LedId.Keyboard_B},
|
||||
{KeyboardKey.C, LedId.Keyboard_C},
|
||||
{KeyboardKey.D, LedId.Keyboard_D},
|
||||
{KeyboardKey.E, LedId.Keyboard_E},
|
||||
{KeyboardKey.F, LedId.Keyboard_F},
|
||||
{KeyboardKey.G, LedId.Keyboard_G},
|
||||
{KeyboardKey.H, LedId.Keyboard_H},
|
||||
{KeyboardKey.I, LedId.Keyboard_I},
|
||||
{KeyboardKey.J, LedId.Keyboard_J},
|
||||
{KeyboardKey.K, LedId.Keyboard_K},
|
||||
{KeyboardKey.L, LedId.Keyboard_L},
|
||||
{KeyboardKey.M, LedId.Keyboard_M},
|
||||
{KeyboardKey.N, LedId.Keyboard_N},
|
||||
{KeyboardKey.O, LedId.Keyboard_O},
|
||||
{KeyboardKey.P, LedId.Keyboard_P},
|
||||
{KeyboardKey.Q, LedId.Keyboard_Q},
|
||||
{KeyboardKey.R, LedId.Keyboard_R},
|
||||
{KeyboardKey.S, LedId.Keyboard_S},
|
||||
{KeyboardKey.T, LedId.Keyboard_T},
|
||||
{KeyboardKey.U, LedId.Keyboard_U},
|
||||
{KeyboardKey.V, LedId.Keyboard_V},
|
||||
{KeyboardKey.W, LedId.Keyboard_W},
|
||||
{KeyboardKey.X, LedId.Keyboard_X},
|
||||
{KeyboardKey.Y, LedId.Keyboard_Y},
|
||||
{KeyboardKey.Z, LedId.Keyboard_Z},
|
||||
{KeyboardKey.LWin, LedId.Keyboard_LeftGui},
|
||||
{KeyboardKey.RWin, LedId.Keyboard_RightGui},
|
||||
{KeyboardKey.Apps, LedId.Keyboard_Application},
|
||||
{KeyboardKey.Sleep, LedId.Keyboard_Custom16},
|
||||
{KeyboardKey.NumPad0, LedId.Keyboard_Num0},
|
||||
{KeyboardKey.NumPad1, LedId.Keyboard_Num1},
|
||||
{KeyboardKey.NumPad2, LedId.Keyboard_Num2},
|
||||
{KeyboardKey.NumPad3, LedId.Keyboard_Num3},
|
||||
{KeyboardKey.NumPad4, LedId.Keyboard_Num4},
|
||||
{KeyboardKey.NumPad5, LedId.Keyboard_Num5},
|
||||
{KeyboardKey.NumPad6, LedId.Keyboard_Num6},
|
||||
{KeyboardKey.NumPad7, LedId.Keyboard_Num7},
|
||||
{KeyboardKey.NumPad8, LedId.Keyboard_Num8},
|
||||
{KeyboardKey.NumPad9, LedId.Keyboard_Num9},
|
||||
{KeyboardKey.Multiply, LedId.Keyboard_NumAsterisk},
|
||||
{KeyboardKey.Add, LedId.Keyboard_NumPlus},
|
||||
{KeyboardKey.Separator, LedId.Keyboard_NumEnter}, // unverified
|
||||
{KeyboardKey.Subtract, LedId.Keyboard_NumMinus},
|
||||
{KeyboardKey.Decimal, LedId.Keyboard_NumPeriodAndDelete},
|
||||
{KeyboardKey.Divide, LedId.Keyboard_NumSlash},
|
||||
{KeyboardKey.F1, LedId.Keyboard_F1},
|
||||
{KeyboardKey.F2, LedId.Keyboard_F2},
|
||||
{KeyboardKey.F3, LedId.Keyboard_F3},
|
||||
{KeyboardKey.F4, LedId.Keyboard_F4},
|
||||
{KeyboardKey.F5, LedId.Keyboard_F5},
|
||||
{KeyboardKey.F6, LedId.Keyboard_F6},
|
||||
{KeyboardKey.F7, LedId.Keyboard_F7},
|
||||
{KeyboardKey.F8, LedId.Keyboard_F8},
|
||||
{KeyboardKey.F9, LedId.Keyboard_F9},
|
||||
{KeyboardKey.F10, LedId.Keyboard_F10},
|
||||
{KeyboardKey.F11, LedId.Keyboard_F11},
|
||||
{KeyboardKey.F12, LedId.Keyboard_F12},
|
||||
{KeyboardKey.F13, LedId.Keyboard_Custom17},
|
||||
{KeyboardKey.F14, LedId.Keyboard_Custom18},
|
||||
{KeyboardKey.F15, LedId.Keyboard_Custom19},
|
||||
{KeyboardKey.F16, LedId.Keyboard_Custom20},
|
||||
{KeyboardKey.F17, LedId.Keyboard_Custom21},
|
||||
{KeyboardKey.F18, LedId.Keyboard_Custom22},
|
||||
{KeyboardKey.F19, LedId.Keyboard_Custom23},
|
||||
{KeyboardKey.F20, LedId.Keyboard_Custom24},
|
||||
{KeyboardKey.F21, LedId.Keyboard_Custom25},
|
||||
{KeyboardKey.F22, LedId.Keyboard_Custom26},
|
||||
{KeyboardKey.F23, LedId.Keyboard_Custom27},
|
||||
{KeyboardKey.F24, LedId.Keyboard_Custom28},
|
||||
{KeyboardKey.NumLock, LedId.Keyboard_NumLock},
|
||||
{KeyboardKey.Scroll, LedId.Keyboard_ScrollLock},
|
||||
{KeyboardKey.LeftShift, LedId.Keyboard_LeftShift},
|
||||
{KeyboardKey.RightShift, LedId.Keyboard_RightShift},
|
||||
{KeyboardKey.LeftCtrl, LedId.Keyboard_LeftCtrl},
|
||||
{KeyboardKey.RightCtrl, LedId.Keyboard_RightCtrl},
|
||||
{KeyboardKey.LeftAlt, LedId.Keyboard_LeftAlt},
|
||||
{KeyboardKey.RightAlt, LedId.Keyboard_RightAlt},
|
||||
{KeyboardKey.BrowserBack, LedId.Keyboard_Custom29},
|
||||
{KeyboardKey.BrowserForward, LedId.Keyboard_Custom30},
|
||||
{KeyboardKey.BrowserRefresh, LedId.Keyboard_Custom31},
|
||||
{KeyboardKey.BrowserStop, LedId.Keyboard_Custom32},
|
||||
{KeyboardKey.BrowserSearch, LedId.Keyboard_Custom33},
|
||||
{KeyboardKey.BrowserFavorites, LedId.Keyboard_Custom34},
|
||||
{KeyboardKey.BrowserHome, LedId.Keyboard_Custom35},
|
||||
{KeyboardKey.VolumeMute, LedId.Keyboard_MediaMute},
|
||||
{KeyboardKey.VolumeDown, LedId.Keyboard_MediaVolumeDown},
|
||||
{KeyboardKey.VolumeUp, LedId.Keyboard_MediaVolumeUp},
|
||||
{KeyboardKey.MediaNextTrack, LedId.Keyboard_MediaNextTrack},
|
||||
{KeyboardKey.MediaPreviousTrack, LedId.Keyboard_MediaPreviousTrack},
|
||||
{KeyboardKey.MediaStop, LedId.Keyboard_MediaStop},
|
||||
{KeyboardKey.MediaPlayPause, LedId.Keyboard_MediaPlay},
|
||||
{KeyboardKey.LaunchMail, LedId.Keyboard_Custom36},
|
||||
{KeyboardKey.SelectMedia, LedId.Keyboard_Custom37},
|
||||
{KeyboardKey.LaunchApplication1, LedId.Keyboard_Custom38},
|
||||
{KeyboardKey.LaunchApplication2, LedId.Keyboard_Custom39},
|
||||
{KeyboardKey.OemSemicolon, LedId.Keyboard_SemicolonAndColon},
|
||||
{KeyboardKey.OemPlus, LedId.Keyboard_EqualsAndPlus},
|
||||
{KeyboardKey.OemMinus, LedId.Keyboard_MinusAndUnderscore},
|
||||
{KeyboardKey.OemComma, LedId.Keyboard_CommaAndLessThan},
|
||||
{KeyboardKey.OemPeriod, LedId.Keyboard_PeriodAndBiggerThan},
|
||||
{KeyboardKey.OemQuestion, LedId.Keyboard_SlashAndQuestionMark},
|
||||
{KeyboardKey.OemTilde, LedId.Keyboard_GraveAccentAndTilde},
|
||||
{KeyboardKey.AbntC1, LedId.Keyboard_Custom40},
|
||||
{KeyboardKey.AbntC2, LedId.Keyboard_Custom41},
|
||||
{KeyboardKey.OemOpenBrackets, LedId.Keyboard_BracketLeft},
|
||||
{KeyboardKey.OemPipe, LedId.Keyboard_Backslash},
|
||||
{KeyboardKey.OemCloseBrackets, LedId.Keyboard_BracketRight},
|
||||
{KeyboardKey.OemQuotes, LedId.Keyboard_ApostropheAndDoubleQuote},
|
||||
{KeyboardKey.OemBackslash, LedId.Keyboard_Custom42}, // unverified
|
||||
{KeyboardKey.ImeProcessed, LedId.Keyboard_Custom43},
|
||||
{KeyboardKey.System, LedId.Keyboard_Custom44},
|
||||
{KeyboardKey.OemAttn, LedId.Keyboard_Custom45},
|
||||
{KeyboardKey.OemFinish, LedId.Keyboard_Custom46},
|
||||
{KeyboardKey.OemCopy, LedId.Keyboard_Custom47},
|
||||
{KeyboardKey.OemAuto, LedId.Keyboard_Custom48},
|
||||
{KeyboardKey.OemEnlw, LedId.Keyboard_Custom49},
|
||||
{KeyboardKey.OemBackTab, LedId.Keyboard_Custom50},
|
||||
{KeyboardKey.Attn, LedId.Keyboard_Custom51},
|
||||
{KeyboardKey.CrSel, LedId.Keyboard_Custom52},
|
||||
{KeyboardKey.ExSel, LedId.Keyboard_Custom53},
|
||||
{KeyboardKey.EraseEof, LedId.Keyboard_Custom54},
|
||||
{KeyboardKey.Play, LedId.Keyboard_MediaPlay},
|
||||
{KeyboardKey.Zoom, LedId.Keyboard_Custom55},
|
||||
{KeyboardKey.NoName, LedId.Keyboard_Custom56},
|
||||
{KeyboardKey.Pa1, LedId.Keyboard_Custom57},
|
||||
{KeyboardKey.OemClear, LedId.Keyboard_Custom58},
|
||||
{KeyboardKey.DeadCharProcessed, LedId.Keyboard_Custom59},
|
||||
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary of mappings between <see cref="MouseButton" /> and <see cref="LedId" />
|
||||
/// </summary>
|
||||
public static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new()
|
||||
{
|
||||
{MouseButton.Left, LedId.Mouse1},
|
||||
{MouseButton.Middle, LedId.Mouse2},
|
||||
{MouseButton.Right, LedId.Mouse3},
|
||||
{MouseButton.Button4, LedId.Mouse4},
|
||||
{MouseButton.Button5, LedId.Mouse5}
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// A dictionary of mappings between <see cref="MouseButton" /> and <see cref="LedId" />
|
||||
/// </summary>
|
||||
public static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new()
|
||||
{
|
||||
{MouseButton.Left, LedId.Mouse1},
|
||||
{MouseButton.Middle, LedId.Mouse2},
|
||||
{MouseButton.Right, LedId.Mouse3},
|
||||
{MouseButton.Button4, LedId.Mouse4},
|
||||
{MouseButton.Button5, LedId.Mouse5}
|
||||
};
|
||||
}
|
||||
@@ -1,147 +1,142 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an interface for an input provider that provides and implementation for sending and receiving device
|
||||
/// input
|
||||
/// </summary>
|
||||
public abstract class InputProvider : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an interface for an input provider that provides and implementation for sending and receiving device
|
||||
/// input
|
||||
/// Called when the input service requests a <see cref="KeyboardToggleStatusReceived" /> event
|
||||
/// </summary>
|
||||
public abstract class InputProvider : IDisposable
|
||||
public virtual void OnKeyboardToggleStatusRequested()
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when the input service requests a <see cref="KeyboardToggleStatusReceived"/> event
|
||||
/// </summary>
|
||||
public virtual void OnKeyboardToggleStatusRequested()
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received keyboard data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderKeyboardEventArgs>? KeyboardDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provider has received new toggle data for keyboards
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderKeyboardToggleEventArgs>? KeyboardToggleStatusReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received mouse button data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderMouseButtonEventArgs>? MouseButtonDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received mouse scroll data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderMouseScrollEventArgs>? MouseScrollDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received mouse move data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderMouseMoveEventArgs>? MouseMoveDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided received a device identifier
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderIdentifierEventArgs>? IdentifierReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyboardDataReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="key">The key that triggered the event</param>
|
||||
/// <param name="isDown">Whether the key is pressed down</param>
|
||||
protected virtual void OnKeyboardDataReceived(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
KeyboardDataReceived?.Invoke(this, new InputProviderKeyboardEventArgs(device, key, isDown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseButtonDataReceived" /> event which the <see cref="IInputService" /> listens to as long
|
||||
/// as this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="button">The button that triggered the event</param>
|
||||
/// <param name="isDown">Whether the button is pressed down</param>
|
||||
protected virtual void OnMouseButtonDataReceived(ArtemisDevice? device, MouseButton button, bool isDown)
|
||||
{
|
||||
MouseButtonDataReceived?.Invoke(this, new InputProviderMouseButtonEventArgs(device, button, isDown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseScrollDataReceived" /> event which the <see cref="IInputService" /> listens to as long
|
||||
/// as this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
protected virtual void OnMouseScrollDataReceived(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
MouseScrollDataReceived?.Invoke(this, new InputProviderMouseScrollEventArgs(device, direction, delta));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseMoveDataReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
protected virtual void OnMouseMoveDataReceived(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
MouseMoveDataReceived?.Invoke(this, new InputProviderMouseMoveEventArgs(device, cursorX, cursorY, deltaX, deltaY));
|
||||
}
|
||||
|
||||
// TODO: Remove this as the core should handle this in GetDeviceByIdentifier
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="IdentifierReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// <para>Except for on mouse movement, call this whenever you have an identifier ready for the core to process</para>
|
||||
/// </summary>
|
||||
/// <param name="identifier">A value that can be used to identify this device</param>
|
||||
/// <param name="deviceType">The type of device this identifier belongs to</param>
|
||||
protected virtual void OnIdentifierReceived(object identifier, InputDeviceType deviceType)
|
||||
{
|
||||
IdentifierReceived?.Invoke(this, new InputProviderIdentifierEventArgs(identifier, deviceType));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyboardToggleStatusReceived" /> event which the <see cref="IInputService" /> listens to as
|
||||
/// long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="keyboardToggleStatus">The toggle status of the keyboard</param>
|
||||
protected virtual void OnKeyboardToggleStatusReceived(KeyboardToggleStatus keyboardToggleStatus)
|
||||
{
|
||||
KeyboardToggleStatusReceived?.Invoke(this, new InputProviderKeyboardToggleEventArgs(keyboardToggleStatus));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// <see langword="true" /> to release both managed and unmanaged resources;
|
||||
/// <see langword="false" /> to release only unmanaged resources.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received keyboard data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderKeyboardEventArgs>? KeyboardDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provider has received new toggle data for keyboards
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderKeyboardToggleEventArgs>? KeyboardToggleStatusReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received mouse button data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderMouseButtonEventArgs>? MouseButtonDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received mouse scroll data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderMouseScrollEventArgs>? MouseScrollDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided has received mouse move data
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderMouseMoveEventArgs>? MouseMoveDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the input provided received a device identifier
|
||||
/// </summary>
|
||||
public event EventHandler<InputProviderIdentifierEventArgs>? IdentifierReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyboardDataReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="key">The key that triggered the event</param>
|
||||
/// <param name="isDown">Whether the key is pressed down</param>
|
||||
protected virtual void OnKeyboardDataReceived(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
KeyboardDataReceived?.Invoke(this, new InputProviderKeyboardEventArgs(device, key, isDown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseButtonDataReceived" /> event which the <see cref="IInputService" /> listens to as long
|
||||
/// as this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="button">The button that triggered the event</param>
|
||||
/// <param name="isDown">Whether the button is pressed down</param>
|
||||
protected virtual void OnMouseButtonDataReceived(ArtemisDevice? device, MouseButton button, bool isDown)
|
||||
{
|
||||
MouseButtonDataReceived?.Invoke(this, new InputProviderMouseButtonEventArgs(device, button, isDown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseScrollDataReceived" /> event which the <see cref="IInputService" /> listens to as long
|
||||
/// as this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
protected virtual void OnMouseScrollDataReceived(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
MouseScrollDataReceived?.Invoke(this, new InputProviderMouseScrollEventArgs(device, direction, delta));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseMoveDataReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
protected virtual void OnMouseMoveDataReceived(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
MouseMoveDataReceived?.Invoke(this, new InputProviderMouseMoveEventArgs(device, cursorX, cursorY, deltaX, deltaY));
|
||||
}
|
||||
|
||||
// TODO: Remove this as the core should handle this in GetDeviceByIdentifier
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="IdentifierReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// <para>Except for on mouse movement, call this whenever you have an identifier ready for the core to process</para>
|
||||
/// </summary>
|
||||
/// <param name="identifier">A value that can be used to identify this device</param>
|
||||
/// <param name="deviceType">The type of device this identifier belongs to</param>
|
||||
protected virtual void OnIdentifierReceived(object identifier, InputDeviceType deviceType)
|
||||
{
|
||||
IdentifierReceived?.Invoke(this, new InputProviderIdentifierEventArgs(identifier, deviceType));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyboardToggleStatusReceived" /> event which the <see cref="IInputService" /> listens to as
|
||||
/// long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
/// <param name="keyboardToggleStatus">The toggle status of the keyboard</param>
|
||||
protected virtual void OnKeyboardToggleStatusReceived(KeyboardToggleStatus keyboardToggleStatus)
|
||||
{
|
||||
KeyboardToggleStatusReceived?.Invoke(this, new InputProviderKeyboardToggleEventArgs(keyboardToggleStatus));
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// <see langword="true" /> to release both managed and unmanaged resources;
|
||||
/// <see langword="false" /> to release only unmanaged resources.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@@ -4,434 +4,423 @@ using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using Serilog;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
internal class InputService : IInputService
|
||||
{
|
||||
internal class InputService : IInputService
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRgbService _rgbService;
|
||||
|
||||
public InputService(ILogger logger, IRgbService rgbService)
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRgbService _rgbService;
|
||||
_logger = logger;
|
||||
_rgbService = rgbService;
|
||||
|
||||
public InputService(ILogger logger, IRgbService rgbService)
|
||||
{
|
||||
_logger = logger;
|
||||
_rgbService = rgbService;
|
||||
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
while (_inputProviders.Any())
|
||||
{
|
||||
InputProvider provider = _inputProviders.First();
|
||||
RemoveInputProvider(provider);
|
||||
provider.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Providers
|
||||
|
||||
private readonly List<InputProvider> _inputProviders = new();
|
||||
|
||||
public KeyboardToggleStatus KeyboardToggleStatus { get; private set; } = new(false, false, false);
|
||||
|
||||
public void AddInputProvider(InputProvider inputProvider)
|
||||
{
|
||||
inputProvider.IdentifierReceived += InputProviderOnIdentifierReceived;
|
||||
inputProvider.KeyboardDataReceived += InputProviderOnKeyboardDataReceived;
|
||||
inputProvider.KeyboardToggleStatusReceived += InputProviderOnKeyboardToggleStatusReceived;
|
||||
inputProvider.MouseButtonDataReceived += InputProviderOnMouseButtonDataReceived;
|
||||
inputProvider.MouseScrollDataReceived += InputProviderOnMouseScrollDataReceived;
|
||||
inputProvider.MouseMoveDataReceived += InputProviderOnMouseMoveDataReceived;
|
||||
_inputProviders.Add(inputProvider);
|
||||
|
||||
inputProvider.OnKeyboardToggleStatusRequested();
|
||||
}
|
||||
|
||||
|
||||
public void RemoveInputProvider(InputProvider inputProvider)
|
||||
{
|
||||
if (!_inputProviders.Contains(inputProvider))
|
||||
return;
|
||||
|
||||
_inputProviders.Remove(inputProvider);
|
||||
inputProvider.IdentifierReceived -= InputProviderOnIdentifierReceived;
|
||||
inputProvider.KeyboardDataReceived -= InputProviderOnKeyboardDataReceived;
|
||||
inputProvider.KeyboardToggleStatusReceived -= InputProviderOnKeyboardToggleStatusReceived;
|
||||
inputProvider.MouseButtonDataReceived -= InputProviderOnMouseButtonDataReceived;
|
||||
inputProvider.MouseScrollDataReceived -= InputProviderOnMouseScrollDataReceived;
|
||||
inputProvider.MouseMoveDataReceived -= InputProviderOnMouseMoveDataReceived;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Identification
|
||||
|
||||
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache = new();
|
||||
private List<ArtemisDevice> _devices = new();
|
||||
private ArtemisDevice? _cachedFallbackKeyboard;
|
||||
private ArtemisDevice? _cachedFallbackMouse;
|
||||
private ArtemisDevice? _identifyingDevice;
|
||||
|
||||
public void IdentifyDevice(ArtemisDevice device)
|
||||
{
|
||||
if (device.DeviceType != RGBDeviceType.Keyboard && device.DeviceType != RGBDeviceType.Mouse)
|
||||
throw new ArtemisCoreException($"Cannot initialize input-identification for a device of type {device.DeviceType}. \r\n" +
|
||||
"Only keyboard and mouse is supported.");
|
||||
|
||||
_identifyingDevice = device;
|
||||
_logger.Debug("Start identifying device {device}", device);
|
||||
}
|
||||
|
||||
public void StopIdentify()
|
||||
{
|
||||
if (_identifyingDevice == null)
|
||||
return;
|
||||
|
||||
_logger.Debug("Stop identifying device {device}", _identifyingDevice);
|
||||
_identifyingDevice = null;
|
||||
_rgbService.SaveDevices();
|
||||
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
// TODO: Move the OnIdentifierReceived logic into here and get rid of OnIdentifierReceived, this and OnIdentifierReceived are always called in combination with each other
|
||||
public ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputDeviceType type)
|
||||
{
|
||||
if (provider == null) throw new ArgumentNullException(nameof(provider));
|
||||
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
|
||||
|
||||
// Try cache first
|
||||
ArtemisDevice? cacheMatch = GetDeviceFromCache(provider, identifier);
|
||||
if (cacheMatch != null)
|
||||
return cacheMatch;
|
||||
|
||||
string providerName = provider.GetType().FullName!;
|
||||
ArtemisDevice? match = _devices.FirstOrDefault(m => m.InputIdentifiers.Any(i => Equals(i.InputProvider, providerName) && Equals(i.Identifier, identifier)));
|
||||
|
||||
// If a match was found cache it to speed up the next event and return the match
|
||||
if (match != null)
|
||||
{
|
||||
AddDeviceToCache(match, provider, identifier);
|
||||
return match;
|
||||
}
|
||||
|
||||
// If there is no match, apply our fallback type
|
||||
if (type == InputDeviceType.None)
|
||||
return null;
|
||||
if (type == InputDeviceType.Keyboard)
|
||||
{
|
||||
if (_cachedFallbackKeyboard != null)
|
||||
return _cachedFallbackKeyboard;
|
||||
_cachedFallbackKeyboard = _rgbService.EnabledDevices.FirstOrDefault(d => d.DeviceType == RGBDeviceType.Keyboard);
|
||||
return _cachedFallbackKeyboard;
|
||||
}
|
||||
|
||||
if (type == InputDeviceType.Mouse)
|
||||
{
|
||||
if (_cachedFallbackMouse != null)
|
||||
return _cachedFallbackMouse;
|
||||
_cachedFallbackMouse = _rgbService.EnabledDevices.FirstOrDefault(d => d.DeviceType == RGBDeviceType.Mouse);
|
||||
return _cachedFallbackMouse;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void BustIdentifierCache()
|
||||
{
|
||||
_deviceCache.Clear();
|
||||
_cachedFallbackKeyboard = null;
|
||||
_cachedFallbackMouse = null;
|
||||
|
||||
_devices = _rgbService.EnabledDevices.Where(d => d.InputIdentifiers.Any()).ToList();
|
||||
}
|
||||
|
||||
private void AddDeviceToCache(ArtemisDevice match, InputProvider provider, object identifier)
|
||||
{
|
||||
_deviceCache.TryAdd(new Tuple<InputProvider, object>(provider, identifier), match);
|
||||
}
|
||||
|
||||
private ArtemisDevice? GetDeviceFromCache(InputProvider provider, object identifier)
|
||||
{
|
||||
_deviceCache.TryGetValue(new Tuple<InputProvider, object>(provider, identifier), out ArtemisDevice? device);
|
||||
return device;
|
||||
}
|
||||
|
||||
private void SurfaceConfigurationChanged(object? sender, SurfaceConfigurationEventArgs e)
|
||||
{
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
private void InputProviderOnIdentifierReceived(object? sender, InputProviderIdentifierEventArgs e)
|
||||
{
|
||||
// Don't match if there is no device or if the device type differs from the event device type
|
||||
if (_identifyingDevice == null ||
|
||||
_identifyingDevice.DeviceType == RGBDeviceType.Keyboard && e.DeviceType == InputDeviceType.Mouse ||
|
||||
_identifyingDevice.DeviceType == RGBDeviceType.Mouse && e.DeviceType == InputDeviceType.Keyboard)
|
||||
return;
|
||||
if (!(sender is InputProvider inputProvider))
|
||||
return;
|
||||
|
||||
string providerName = inputProvider.GetType().FullName!;
|
||||
|
||||
// Remove existing identification
|
||||
_identifyingDevice.InputIdentifiers.RemoveAll(i => i.InputProvider == providerName);
|
||||
_identifyingDevice.InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(providerName, e.Identifier));
|
||||
|
||||
StopIdentify();
|
||||
OnDeviceIdentified();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard
|
||||
|
||||
private readonly Dictionary<ArtemisDevice, HashSet<KeyboardKey>> _pressedKeys = new();
|
||||
private readonly Dictionary<ArtemisDevice, KeyboardModifierKey> _keyboardModifier = new();
|
||||
private KeyboardModifierKey _globalModifiers;
|
||||
|
||||
private void InputProviderOnKeyboardDataReceived(object? sender, InputProviderKeyboardEventArgs e)
|
||||
{
|
||||
KeyboardModifierKey keyboardModifierKey = UpdateModifierKeys(e.Device, e.Key, e.IsDown);
|
||||
|
||||
// if UpdatePressedKeys is true, the key is already pressed, then we skip this event
|
||||
if (UpdatePressedKeys(e.Device, e.Key, e.IsDown))
|
||||
return;
|
||||
|
||||
// Get the LED
|
||||
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
|
||||
ArtemisLed? led = null;
|
||||
if (foundLedId && e.Device != null)
|
||||
led = e.Device.GetLed(ledId, true);
|
||||
|
||||
// Create the UpDown event args because it can be used for every event
|
||||
ArtemisKeyboardKeyUpDownEventArgs eventArgs = new(e.Device, led, e.Key, keyboardModifierKey, e.IsDown);
|
||||
OnKeyboardKeyUpDown(eventArgs);
|
||||
if (e.IsDown)
|
||||
OnKeyboardKeyDown(eventArgs);
|
||||
else
|
||||
OnKeyboardKeyUp(eventArgs);
|
||||
|
||||
// _logger.Verbose("Keyboard data: LED ID: {ledId}, key: {key}, is down: {isDown}, modifiers: {modifiers}, device: {device} ", ledId, e.Key, e.IsDown, keyboardModifierKey, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnKeyboardToggleStatusReceived(object? sender, InputProviderKeyboardToggleEventArgs e)
|
||||
{
|
||||
KeyboardToggleStatus old = KeyboardToggleStatus;
|
||||
if (KeyboardToggleStatus.CapsLock == e.KeyboardToggleStatus.CapsLock &&
|
||||
KeyboardToggleStatus.NumLock == e.KeyboardToggleStatus.NumLock &&
|
||||
KeyboardToggleStatus.ScrollLock == e.KeyboardToggleStatus.ScrollLock)
|
||||
return;
|
||||
|
||||
KeyboardToggleStatus = e.KeyboardToggleStatus;
|
||||
OnKeyboardToggleStatusChanged(new ArtemisKeyboardToggleStatusArgs(old, KeyboardToggleStatus));
|
||||
}
|
||||
|
||||
private bool UpdatePressedKeys(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
if (device != null)
|
||||
{
|
||||
// Ensure the device is in the dictionary
|
||||
_pressedKeys.TryAdd(device, new HashSet<KeyboardKey>());
|
||||
// Get the hash set of the device
|
||||
HashSet<KeyboardKey> pressedDeviceKeys = _pressedKeys[device];
|
||||
// See if the key is already pressed
|
||||
bool alreadyPressed = pressedDeviceKeys.Contains(key);
|
||||
|
||||
// Prevent triggering already down keys again. When a key is held, we don't want to spam events like Windows does
|
||||
if (isDown && alreadyPressed)
|
||||
return true;
|
||||
|
||||
// Either add or remove the key depending on its status
|
||||
if (isDown && !alreadyPressed)
|
||||
pressedDeviceKeys.Add(key);
|
||||
else if (!isDown && alreadyPressed)
|
||||
pressedDeviceKeys.Remove(key);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private KeyboardModifierKey UpdateModifierKeys(ArtemisDevice? device, KeyboardKey key, in bool isDown)
|
||||
{
|
||||
KeyboardModifierKey modifiers = _globalModifiers;
|
||||
if (device != null)
|
||||
_keyboardModifier.TryGetValue(device, out modifiers);
|
||||
|
||||
if (key == KeyboardKey.LeftAlt || key == KeyboardKey.RightAlt)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Alt;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Alt;
|
||||
}
|
||||
else if (key == KeyboardKey.LeftCtrl || key == KeyboardKey.RightCtrl)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Control;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Control;
|
||||
}
|
||||
else if (key == KeyboardKey.LeftShift || key == KeyboardKey.RightShift)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Shift;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Shift;
|
||||
}
|
||||
else if (key == KeyboardKey.LWin || key == KeyboardKey.RWin)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Windows;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Windows;
|
||||
}
|
||||
|
||||
if (device != null)
|
||||
_keyboardModifier[device] = modifiers;
|
||||
else
|
||||
_globalModifiers = modifiers;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public void ReleaseAll()
|
||||
{
|
||||
foreach ((ArtemisDevice? device, HashSet<KeyboardKey>? keys) in _pressedKeys.ToList())
|
||||
{
|
||||
foreach (KeyboardKey keyboardKey in keys)
|
||||
{
|
||||
InputProviderOnKeyboardDataReceived(this, new InputProviderKeyboardEventArgs(device, keyboardKey, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsKeyDown(KeyboardKey key)
|
||||
{
|
||||
return _pressedKeys.Any(p => p.Value.Contains(key));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse
|
||||
|
||||
private readonly HashSet<MouseButton> _pressedButtons = new();
|
||||
|
||||
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
|
||||
{
|
||||
bool foundLedId = InputKeyUtilities.MouseButtonLedIdMap.TryGetValue(e.Button, out LedId ledId);
|
||||
ArtemisLed? led = null;
|
||||
if (foundLedId && e.Device != null)
|
||||
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
||||
|
||||
// Create the UpDown event args because it can be used for every event
|
||||
ArtemisMouseButtonUpDownEventArgs eventArgs = new(e.Device, led, e.Button, e.IsDown);
|
||||
OnMouseButtonUpDown(eventArgs);
|
||||
if (e.IsDown)
|
||||
{
|
||||
if (!_pressedButtons.Contains(e.Button))
|
||||
_pressedButtons.Add(e.Button);
|
||||
OnMouseButtonDown(eventArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_pressedButtons.Contains(e.Button))
|
||||
_pressedButtons.Remove(e.Button);
|
||||
OnMouseButtonUp(eventArgs);
|
||||
}
|
||||
|
||||
// _logger.Verbose("Mouse button data: LED ID: {ledId}, button: {button}, is down: {isDown}, device: {device} ", ledId, e.Button, e.IsDown, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnMouseScrollDataReceived(object? sender, InputProviderMouseScrollEventArgs e)
|
||||
{
|
||||
OnMouseScroll(new ArtemisMouseScrollEventArgs(e.Device, e.Direction, e.Delta));
|
||||
// _logger.Verbose("Mouse scroll data: Direction: {direction}, delta: {delta}, device: {device} ", e.Direction, e.Delta, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnMouseMoveDataReceived(object? sender, InputProviderMouseMoveEventArgs e)
|
||||
{
|
||||
OnMouseMove(new ArtemisMouseMoveEventArgs(e.Device, e.CursorX, e.CursorY, e.DeltaX, e.DeltaY));
|
||||
// _logger.Verbose("Mouse move data: XY: {X},{Y} - delta XY: {deltaX},{deltaY} - device: {device} ", e.CursorX, e.CursorY, e.DeltaX, e.DeltaY, e.Device);
|
||||
}
|
||||
|
||||
public bool IsButtonDown(MouseButton button)
|
||||
{
|
||||
return _pressedButtons.Contains(button);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<ArtemisKeyboardKeyUpDownEventArgs>? KeyboardKeyUpDown;
|
||||
public event EventHandler<ArtemisKeyboardKeyEventArgs>? KeyboardKeyDown;
|
||||
public event EventHandler<ArtemisKeyboardKeyEventArgs>? KeyboardKeyUp;
|
||||
public event EventHandler<ArtemisKeyboardToggleStatusArgs>? KeyboardToggleStatusChanged;
|
||||
|
||||
public event EventHandler<ArtemisMouseButtonUpDownEventArgs>? MouseButtonUpDown;
|
||||
public event EventHandler<ArtemisMouseButtonEventArgs>? MouseButtonDown;
|
||||
public event EventHandler<ArtemisMouseButtonEventArgs>? MouseButtonUp;
|
||||
public event EventHandler<ArtemisMouseScrollEventArgs>? MouseScroll;
|
||||
public event EventHandler<ArtemisMouseMoveEventArgs>? MouseMove;
|
||||
public event EventHandler? DeviceIdentified;
|
||||
|
||||
protected virtual void OnKeyboardKeyUpDown(ArtemisKeyboardKeyUpDownEventArgs e)
|
||||
{
|
||||
KeyboardKeyUpDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyDown(ArtemisKeyboardKeyEventArgs e)
|
||||
{
|
||||
KeyboardKeyDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyUp(ArtemisKeyboardKeyEventArgs e)
|
||||
{
|
||||
KeyboardKeyUp?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardToggleStatusChanged(ArtemisKeyboardToggleStatusArgs e)
|
||||
{
|
||||
KeyboardToggleStatusChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonUpDown(ArtemisMouseButtonUpDownEventArgs e)
|
||||
{
|
||||
MouseButtonUpDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonDown(ArtemisMouseButtonEventArgs e)
|
||||
{
|
||||
MouseButtonDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonUp(ArtemisMouseButtonEventArgs e)
|
||||
{
|
||||
MouseButtonUp?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseScroll(ArtemisMouseScrollEventArgs e)
|
||||
{
|
||||
MouseScroll?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseMove(ArtemisMouseMoveEventArgs e)
|
||||
{
|
||||
MouseMove?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnDeviceIdentified()
|
||||
{
|
||||
DeviceIdentified?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyUpDown(ArtemisKeyboardKeyUpDownEventArgs e)
|
||||
{
|
||||
KeyboardKeyUpDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyDown(ArtemisKeyboardKeyEventArgs e)
|
||||
{
|
||||
KeyboardKeyDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyUp(ArtemisKeyboardKeyEventArgs e)
|
||||
{
|
||||
KeyboardKeyUp?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardToggleStatusChanged(ArtemisKeyboardToggleStatusArgs e)
|
||||
{
|
||||
KeyboardToggleStatusChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonUpDown(ArtemisMouseButtonUpDownEventArgs e)
|
||||
{
|
||||
MouseButtonUpDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonDown(ArtemisMouseButtonEventArgs e)
|
||||
{
|
||||
MouseButtonDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonUp(ArtemisMouseButtonEventArgs e)
|
||||
{
|
||||
MouseButtonUp?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseScroll(ArtemisMouseScrollEventArgs e)
|
||||
{
|
||||
MouseScroll?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseMove(ArtemisMouseMoveEventArgs e)
|
||||
{
|
||||
MouseMove?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnDeviceIdentified()
|
||||
{
|
||||
DeviceIdentified?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
while (_inputProviders.Any())
|
||||
{
|
||||
InputProvider provider = _inputProviders.First();
|
||||
RemoveInputProvider(provider);
|
||||
provider.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ArtemisKeyboardKeyUpDownEventArgs>? KeyboardKeyUpDown;
|
||||
public event EventHandler<ArtemisKeyboardKeyEventArgs>? KeyboardKeyDown;
|
||||
public event EventHandler<ArtemisKeyboardKeyEventArgs>? KeyboardKeyUp;
|
||||
public event EventHandler<ArtemisKeyboardToggleStatusArgs>? KeyboardToggleStatusChanged;
|
||||
|
||||
public event EventHandler<ArtemisMouseButtonUpDownEventArgs>? MouseButtonUpDown;
|
||||
public event EventHandler<ArtemisMouseButtonEventArgs>? MouseButtonDown;
|
||||
public event EventHandler<ArtemisMouseButtonEventArgs>? MouseButtonUp;
|
||||
public event EventHandler<ArtemisMouseScrollEventArgs>? MouseScroll;
|
||||
public event EventHandler<ArtemisMouseMoveEventArgs>? MouseMove;
|
||||
public event EventHandler? DeviceIdentified;
|
||||
|
||||
#region Providers
|
||||
|
||||
private readonly List<InputProvider> _inputProviders = new();
|
||||
|
||||
public KeyboardToggleStatus KeyboardToggleStatus { get; private set; } = new(false, false, false);
|
||||
|
||||
public void AddInputProvider(InputProvider inputProvider)
|
||||
{
|
||||
inputProvider.IdentifierReceived += InputProviderOnIdentifierReceived;
|
||||
inputProvider.KeyboardDataReceived += InputProviderOnKeyboardDataReceived;
|
||||
inputProvider.KeyboardToggleStatusReceived += InputProviderOnKeyboardToggleStatusReceived;
|
||||
inputProvider.MouseButtonDataReceived += InputProviderOnMouseButtonDataReceived;
|
||||
inputProvider.MouseScrollDataReceived += InputProviderOnMouseScrollDataReceived;
|
||||
inputProvider.MouseMoveDataReceived += InputProviderOnMouseMoveDataReceived;
|
||||
_inputProviders.Add(inputProvider);
|
||||
|
||||
inputProvider.OnKeyboardToggleStatusRequested();
|
||||
}
|
||||
|
||||
|
||||
public void RemoveInputProvider(InputProvider inputProvider)
|
||||
{
|
||||
if (!_inputProviders.Contains(inputProvider))
|
||||
return;
|
||||
|
||||
_inputProviders.Remove(inputProvider);
|
||||
inputProvider.IdentifierReceived -= InputProviderOnIdentifierReceived;
|
||||
inputProvider.KeyboardDataReceived -= InputProviderOnKeyboardDataReceived;
|
||||
inputProvider.KeyboardToggleStatusReceived -= InputProviderOnKeyboardToggleStatusReceived;
|
||||
inputProvider.MouseButtonDataReceived -= InputProviderOnMouseButtonDataReceived;
|
||||
inputProvider.MouseScrollDataReceived -= InputProviderOnMouseScrollDataReceived;
|
||||
inputProvider.MouseMoveDataReceived -= InputProviderOnMouseMoveDataReceived;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Identification
|
||||
|
||||
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache = new();
|
||||
private List<ArtemisDevice> _devices = new();
|
||||
private ArtemisDevice? _cachedFallbackKeyboard;
|
||||
private ArtemisDevice? _cachedFallbackMouse;
|
||||
private ArtemisDevice? _identifyingDevice;
|
||||
|
||||
public void IdentifyDevice(ArtemisDevice device)
|
||||
{
|
||||
if (device.DeviceType != RGBDeviceType.Keyboard && device.DeviceType != RGBDeviceType.Mouse)
|
||||
throw new ArtemisCoreException($"Cannot initialize input-identification for a device of type {device.DeviceType}. \r\n" +
|
||||
"Only keyboard and mouse is supported.");
|
||||
|
||||
_identifyingDevice = device;
|
||||
_logger.Debug("Start identifying device {device}", device);
|
||||
}
|
||||
|
||||
public void StopIdentify()
|
||||
{
|
||||
if (_identifyingDevice == null)
|
||||
return;
|
||||
|
||||
_logger.Debug("Stop identifying device {device}", _identifyingDevice);
|
||||
_identifyingDevice = null;
|
||||
_rgbService.SaveDevices();
|
||||
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
// TODO: Move the OnIdentifierReceived logic into here and get rid of OnIdentifierReceived, this and OnIdentifierReceived are always called in combination with each other
|
||||
public ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputDeviceType type)
|
||||
{
|
||||
if (provider == null) throw new ArgumentNullException(nameof(provider));
|
||||
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
|
||||
|
||||
// Try cache first
|
||||
ArtemisDevice? cacheMatch = GetDeviceFromCache(provider, identifier);
|
||||
if (cacheMatch != null)
|
||||
return cacheMatch;
|
||||
|
||||
string providerName = provider.GetType().FullName!;
|
||||
ArtemisDevice? match = _devices.FirstOrDefault(m => m.InputIdentifiers.Any(i => Equals(i.InputProvider, providerName) && Equals(i.Identifier, identifier)));
|
||||
|
||||
// If a match was found cache it to speed up the next event and return the match
|
||||
if (match != null)
|
||||
{
|
||||
AddDeviceToCache(match, provider, identifier);
|
||||
return match;
|
||||
}
|
||||
|
||||
// If there is no match, apply our fallback type
|
||||
if (type == InputDeviceType.None)
|
||||
return null;
|
||||
if (type == InputDeviceType.Keyboard)
|
||||
{
|
||||
if (_cachedFallbackKeyboard != null)
|
||||
return _cachedFallbackKeyboard;
|
||||
_cachedFallbackKeyboard = _rgbService.EnabledDevices.FirstOrDefault(d => d.DeviceType == RGBDeviceType.Keyboard);
|
||||
return _cachedFallbackKeyboard;
|
||||
}
|
||||
|
||||
if (type == InputDeviceType.Mouse)
|
||||
{
|
||||
if (_cachedFallbackMouse != null)
|
||||
return _cachedFallbackMouse;
|
||||
_cachedFallbackMouse = _rgbService.EnabledDevices.FirstOrDefault(d => d.DeviceType == RGBDeviceType.Mouse);
|
||||
return _cachedFallbackMouse;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void BustIdentifierCache()
|
||||
{
|
||||
_deviceCache.Clear();
|
||||
_cachedFallbackKeyboard = null;
|
||||
_cachedFallbackMouse = null;
|
||||
|
||||
_devices = _rgbService.EnabledDevices.Where(d => d.InputIdentifiers.Any()).ToList();
|
||||
}
|
||||
|
||||
private void AddDeviceToCache(ArtemisDevice match, InputProvider provider, object identifier)
|
||||
{
|
||||
_deviceCache.TryAdd(new Tuple<InputProvider, object>(provider, identifier), match);
|
||||
}
|
||||
|
||||
private ArtemisDevice? GetDeviceFromCache(InputProvider provider, object identifier)
|
||||
{
|
||||
_deviceCache.TryGetValue(new Tuple<InputProvider, object>(provider, identifier), out ArtemisDevice? device);
|
||||
return device;
|
||||
}
|
||||
|
||||
private void SurfaceConfigurationChanged(object? sender, SurfaceConfigurationEventArgs e)
|
||||
{
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
private void InputProviderOnIdentifierReceived(object? sender, InputProviderIdentifierEventArgs e)
|
||||
{
|
||||
// Don't match if there is no device or if the device type differs from the event device type
|
||||
if (_identifyingDevice == null ||
|
||||
(_identifyingDevice.DeviceType == RGBDeviceType.Keyboard && e.DeviceType == InputDeviceType.Mouse) ||
|
||||
(_identifyingDevice.DeviceType == RGBDeviceType.Mouse && e.DeviceType == InputDeviceType.Keyboard))
|
||||
return;
|
||||
if (!(sender is InputProvider inputProvider))
|
||||
return;
|
||||
|
||||
string providerName = inputProvider.GetType().FullName!;
|
||||
|
||||
// Remove existing identification
|
||||
_identifyingDevice.InputIdentifiers.RemoveAll(i => i.InputProvider == providerName);
|
||||
_identifyingDevice.InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(providerName, e.Identifier));
|
||||
|
||||
StopIdentify();
|
||||
OnDeviceIdentified();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard
|
||||
|
||||
private readonly Dictionary<ArtemisDevice, HashSet<KeyboardKey>> _pressedKeys = new();
|
||||
private readonly Dictionary<ArtemisDevice, KeyboardModifierKey> _keyboardModifier = new();
|
||||
private KeyboardModifierKey _globalModifiers;
|
||||
|
||||
private void InputProviderOnKeyboardDataReceived(object? sender, InputProviderKeyboardEventArgs e)
|
||||
{
|
||||
KeyboardModifierKey keyboardModifierKey = UpdateModifierKeys(e.Device, e.Key, e.IsDown);
|
||||
|
||||
// if UpdatePressedKeys is true, the key is already pressed, then we skip this event
|
||||
if (UpdatePressedKeys(e.Device, e.Key, e.IsDown))
|
||||
return;
|
||||
|
||||
// Get the LED
|
||||
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
|
||||
ArtemisLed? led = null;
|
||||
if (foundLedId && e.Device != null)
|
||||
led = e.Device.GetLed(ledId, true);
|
||||
|
||||
// Create the UpDown event args because it can be used for every event
|
||||
ArtemisKeyboardKeyUpDownEventArgs eventArgs = new(e.Device, led, e.Key, keyboardModifierKey, e.IsDown);
|
||||
OnKeyboardKeyUpDown(eventArgs);
|
||||
if (e.IsDown)
|
||||
OnKeyboardKeyDown(eventArgs);
|
||||
else
|
||||
OnKeyboardKeyUp(eventArgs);
|
||||
|
||||
// _logger.Verbose("Keyboard data: LED ID: {ledId}, key: {key}, is down: {isDown}, modifiers: {modifiers}, device: {device} ", ledId, e.Key, e.IsDown, keyboardModifierKey, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnKeyboardToggleStatusReceived(object? sender, InputProviderKeyboardToggleEventArgs e)
|
||||
{
|
||||
KeyboardToggleStatus old = KeyboardToggleStatus;
|
||||
if (KeyboardToggleStatus.CapsLock == e.KeyboardToggleStatus.CapsLock &&
|
||||
KeyboardToggleStatus.NumLock == e.KeyboardToggleStatus.NumLock &&
|
||||
KeyboardToggleStatus.ScrollLock == e.KeyboardToggleStatus.ScrollLock)
|
||||
return;
|
||||
|
||||
KeyboardToggleStatus = e.KeyboardToggleStatus;
|
||||
OnKeyboardToggleStatusChanged(new ArtemisKeyboardToggleStatusArgs(old, KeyboardToggleStatus));
|
||||
}
|
||||
|
||||
private bool UpdatePressedKeys(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
if (device != null)
|
||||
{
|
||||
// Ensure the device is in the dictionary
|
||||
_pressedKeys.TryAdd(device, new HashSet<KeyboardKey>());
|
||||
// Get the hash set of the device
|
||||
HashSet<KeyboardKey> pressedDeviceKeys = _pressedKeys[device];
|
||||
// See if the key is already pressed
|
||||
bool alreadyPressed = pressedDeviceKeys.Contains(key);
|
||||
|
||||
// Prevent triggering already down keys again. When a key is held, we don't want to spam events like Windows does
|
||||
if (isDown && alreadyPressed)
|
||||
return true;
|
||||
|
||||
// Either add or remove the key depending on its status
|
||||
if (isDown && !alreadyPressed)
|
||||
pressedDeviceKeys.Add(key);
|
||||
else if (!isDown && alreadyPressed)
|
||||
pressedDeviceKeys.Remove(key);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private KeyboardModifierKey UpdateModifierKeys(ArtemisDevice? device, KeyboardKey key, in bool isDown)
|
||||
{
|
||||
KeyboardModifierKey modifiers = _globalModifiers;
|
||||
if (device != null)
|
||||
_keyboardModifier.TryGetValue(device, out modifiers);
|
||||
|
||||
if (key == KeyboardKey.LeftAlt || key == KeyboardKey.RightAlt)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Alt;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Alt;
|
||||
}
|
||||
else if (key == KeyboardKey.LeftCtrl || key == KeyboardKey.RightCtrl)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Control;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Control;
|
||||
}
|
||||
else if (key == KeyboardKey.LeftShift || key == KeyboardKey.RightShift)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Shift;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Shift;
|
||||
}
|
||||
else if (key == KeyboardKey.LWin || key == KeyboardKey.RWin)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers |= KeyboardModifierKey.Windows;
|
||||
else
|
||||
modifiers &= ~KeyboardModifierKey.Windows;
|
||||
}
|
||||
|
||||
if (device != null)
|
||||
_keyboardModifier[device] = modifiers;
|
||||
else
|
||||
_globalModifiers = modifiers;
|
||||
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public void ReleaseAll()
|
||||
{
|
||||
foreach ((ArtemisDevice? device, HashSet<KeyboardKey>? keys) in _pressedKeys.ToList())
|
||||
{
|
||||
foreach (KeyboardKey keyboardKey in keys)
|
||||
InputProviderOnKeyboardDataReceived(this, new InputProviderKeyboardEventArgs(device, keyboardKey, false));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsKeyDown(KeyboardKey key)
|
||||
{
|
||||
return _pressedKeys.Any(p => p.Value.Contains(key));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse
|
||||
|
||||
private readonly HashSet<MouseButton> _pressedButtons = new();
|
||||
|
||||
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
|
||||
{
|
||||
bool foundLedId = InputKeyUtilities.MouseButtonLedIdMap.TryGetValue(e.Button, out LedId ledId);
|
||||
ArtemisLed? led = null;
|
||||
if (foundLedId && e.Device != null)
|
||||
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
||||
|
||||
// Create the UpDown event args because it can be used for every event
|
||||
ArtemisMouseButtonUpDownEventArgs eventArgs = new(e.Device, led, e.Button, e.IsDown);
|
||||
OnMouseButtonUpDown(eventArgs);
|
||||
if (e.IsDown)
|
||||
{
|
||||
if (!_pressedButtons.Contains(e.Button))
|
||||
_pressedButtons.Add(e.Button);
|
||||
OnMouseButtonDown(eventArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_pressedButtons.Contains(e.Button))
|
||||
_pressedButtons.Remove(e.Button);
|
||||
OnMouseButtonUp(eventArgs);
|
||||
}
|
||||
|
||||
// _logger.Verbose("Mouse button data: LED ID: {ledId}, button: {button}, is down: {isDown}, device: {device} ", ledId, e.Button, e.IsDown, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnMouseScrollDataReceived(object? sender, InputProviderMouseScrollEventArgs e)
|
||||
{
|
||||
OnMouseScroll(new ArtemisMouseScrollEventArgs(e.Device, e.Direction, e.Delta));
|
||||
// _logger.Verbose("Mouse scroll data: Direction: {direction}, delta: {delta}, device: {device} ", e.Direction, e.Delta, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnMouseMoveDataReceived(object? sender, InputProviderMouseMoveEventArgs e)
|
||||
{
|
||||
OnMouseMove(new ArtemisMouseMoveEventArgs(e.Device, e.CursorX, e.CursorY, e.DeltaX, e.DeltaY));
|
||||
// _logger.Verbose("Mouse move data: XY: {X},{Y} - delta XY: {deltaX},{deltaY} - device: {device} ", e.CursorX, e.CursorY, e.DeltaX, e.DeltaY, e.Device);
|
||||
}
|
||||
|
||||
public bool IsButtonDown(MouseButton button)
|
||||
{
|
||||
return _pressedButtons.Contains(button);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,125 +1,124 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// A service that allows you to interact with keyboard and mice input events
|
||||
/// </summary>
|
||||
public interface IInputService : IArtemisService, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// A service that allows you to interact with keyboard and mice input events
|
||||
/// Gets the current keyboard toggle status
|
||||
/// </summary>
|
||||
public interface IInputService : IArtemisService, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current keyboard toggle status
|
||||
/// </summary>
|
||||
KeyboardToggleStatus KeyboardToggleStatus { get; }
|
||||
KeyboardToggleStatus KeyboardToggleStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Adds an input provided
|
||||
/// </summary>
|
||||
/// <param name="inputProvider">The input provider the add</param>
|
||||
void AddInputProvider(InputProvider inputProvider);
|
||||
/// <summary>
|
||||
/// Adds an input provided
|
||||
/// </summary>
|
||||
/// <param name="inputProvider">The input provider the add</param>
|
||||
void AddInputProvider(InputProvider inputProvider);
|
||||
|
||||
/// <summary>
|
||||
/// Removes an input provided
|
||||
/// </summary>
|
||||
/// <param name="inputProvider">The input provider the remove</param>
|
||||
void RemoveInputProvider(InputProvider inputProvider);
|
||||
/// <summary>
|
||||
/// Removes an input provided
|
||||
/// </summary>
|
||||
/// <param name="inputProvider">The input provider the remove</param>
|
||||
void RemoveInputProvider(InputProvider inputProvider);
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the provided <paramref name="device" /> by assigning the next received device identification to it
|
||||
/// </summary>
|
||||
/// <param name="device">The device to identify - Must be a keyboard or mouse</param>
|
||||
void IdentifyDevice(ArtemisDevice device);
|
||||
/// <summary>
|
||||
/// Identifies the provided <paramref name="device" /> by assigning the next received device identification to it
|
||||
/// </summary>
|
||||
/// <param name="device">The device to identify - Must be a keyboard or mouse</param>
|
||||
void IdentifyDevice(ArtemisDevice device);
|
||||
|
||||
/// <summary>
|
||||
/// Cancels identifying the device last passed to <see cref="IdentifyDevice" />
|
||||
/// </summary>
|
||||
void StopIdentify();
|
||||
/// <summary>
|
||||
/// Cancels identifying the device last passed to <see cref="IdentifyDevice" />
|
||||
/// </summary>
|
||||
void StopIdentify();
|
||||
|
||||
/// <summary>
|
||||
/// Flush all currently pressed buttons/keys
|
||||
/// </summary>
|
||||
void ReleaseAll();
|
||||
/// <summary>
|
||||
/// Flush all currently pressed buttons/keys
|
||||
/// </summary>
|
||||
void ReleaseAll();
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the provided key is pressed by any device
|
||||
/// </summary>
|
||||
/// <param name="key">The key to check</param>
|
||||
/// <returns><see langword="true" /> if the key is pressed; otherwise <see langword="false" /></returns>
|
||||
bool IsKeyDown(KeyboardKey key);
|
||||
/// <summary>
|
||||
/// Determines whether the provided key is pressed by any device
|
||||
/// </summary>
|
||||
/// <param name="key">The key to check</param>
|
||||
/// <returns><see langword="true" /> if the key is pressed; otherwise <see langword="false" /></returns>
|
||||
bool IsKeyDown(KeyboardKey key);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the button key is pressed by any device
|
||||
/// </summary>
|
||||
/// <param name="button">The button to check</param>
|
||||
/// <returns><see langword="true" /> if the button is pressed; otherwise <see langword="false" /></returns>
|
||||
bool IsButtonDown(MouseButton button);
|
||||
/// <summary>
|
||||
/// Determines whether the button key is pressed by any device
|
||||
/// </summary>
|
||||
/// <param name="button">The button to check</param>
|
||||
/// <returns><see langword="true" /> if the button is pressed; otherwise <see langword="false" /></returns>
|
||||
bool IsButtonDown(MouseButton button);
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was pressed or released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardKeyUpDownEventArgs> KeyboardKeyUpDown;
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was pressed or released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardKeyUpDownEventArgs> KeyboardKeyUpDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was pressed
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardKeyEventArgs> KeyboardKeyDown;
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was pressed
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardKeyEventArgs> KeyboardKeyDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardKeyEventArgs> KeyboardKeyUp;
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardKeyEventArgs> KeyboardKeyUp;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a one or more of the keyboard toggle statuses changed
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardToggleStatusArgs> KeyboardToggleStatusChanged;
|
||||
/// <summary>
|
||||
/// Occurs whenever a one or more of the keyboard toggle statuses changed
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisKeyboardToggleStatusArgs> KeyboardToggleStatusChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was pressed or released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseButtonUpDownEventArgs> MouseButtonUpDown;
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was pressed or released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseButtonUpDownEventArgs> MouseButtonUpDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was pressed
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseButtonEventArgs> MouseButtonDown;
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was pressed
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseButtonEventArgs> MouseButtonDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseButtonEventArgs> MouseButtonUp;
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was released
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseButtonEventArgs> MouseButtonUp;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a the scroll wheel of a mouse is turned
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseScrollEventArgs> MouseScroll;
|
||||
/// <summary>
|
||||
/// Occurs whenever a the scroll wheel of a mouse is turned
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseScrollEventArgs> MouseScroll;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a a mouse is moved
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseMoveEventArgs> MouseMove;
|
||||
/// <summary>
|
||||
/// Occurs whenever a a mouse is moved
|
||||
/// </summary>
|
||||
event EventHandler<ArtemisMouseMoveEventArgs> MouseMove;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a device has been identified after calling <see cref="IdentifyDevice" />
|
||||
/// </summary>
|
||||
public event EventHandler DeviceIdentified;
|
||||
/// <summary>
|
||||
/// Occurs when a device has been identified after calling <see cref="IdentifyDevice" />
|
||||
/// </summary>
|
||||
public event EventHandler DeviceIdentified;
|
||||
|
||||
#region Identification
|
||||
#region Identification
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to identify the device using the provided <paramref name="identifier" />
|
||||
/// </summary>
|
||||
/// <param name="provider">The input provider to identify the device for</param>
|
||||
/// <param name="identifier">The value to use to identify the device</param>
|
||||
/// <param name="type">A device type to fall back to if no match is found</param>
|
||||
/// <returns>If found, the Artemis device matching the provider and identifier</returns>
|
||||
ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputDeviceType type);
|
||||
/// <summary>
|
||||
/// Attempts to identify the device using the provided <paramref name="identifier" />
|
||||
/// </summary>
|
||||
/// <param name="provider">The input provider to identify the device for</param>
|
||||
/// <param name="identifier">The value to use to identify the device</param>
|
||||
/// <param name="type">A device type to fall back to if no match is found</param>
|
||||
/// <returns>If found, the Artemis device matching the provider and identifier</returns>
|
||||
ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputDeviceType type);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the identifier cache
|
||||
/// </summary>
|
||||
void BustIdentifierCache();
|
||||
/// <summary>
|
||||
/// Clears the identifier cache
|
||||
/// </summary>
|
||||
void BustIdentifierCache();
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,36 +1,35 @@
|
||||
namespace Artemis.Core.Services
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the status of a keyboards special toggles
|
||||
/// </summary>
|
||||
public readonly struct KeyboardToggleStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the status of a keyboards special toggles
|
||||
/// Creates a new <see cref="KeyboardToggleStatus" />
|
||||
/// </summary>
|
||||
public readonly struct KeyboardToggleStatus
|
||||
/// <param name="numLock">A boolean indicating whether num lock is on</param>
|
||||
/// <param name="capsLock">A boolean indicating whether caps lock is on</param>
|
||||
/// <param name="scrollLock">A boolean indicating whether scroll lock is on</param>
|
||||
public KeyboardToggleStatus(bool numLock, bool capsLock, bool scrollLock)
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="KeyboardToggleStatus" />
|
||||
/// </summary>
|
||||
/// <param name="numLock">A boolean indicating whether num lock is on</param>
|
||||
/// <param name="capsLock">A boolean indicating whether caps lock is on</param>
|
||||
/// <param name="scrollLock">A boolean indicating whether scroll lock is on</param>
|
||||
public KeyboardToggleStatus(bool numLock, bool capsLock, bool scrollLock)
|
||||
{
|
||||
NumLock = numLock;
|
||||
CapsLock = capsLock;
|
||||
ScrollLock = scrollLock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether num lock is on
|
||||
/// </summary>
|
||||
public bool NumLock { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether caps lock is on
|
||||
/// </summary>
|
||||
public bool CapsLock { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether scroll lock is on
|
||||
/// </summary>
|
||||
public bool ScrollLock { get; }
|
||||
NumLock = numLock;
|
||||
CapsLock = capsLock;
|
||||
ScrollLock = scrollLock;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether num lock is on
|
||||
/// </summary>
|
||||
public bool NumLock { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether caps lock is on
|
||||
/// </summary>
|
||||
public bool CapsLock { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether scroll lock is on
|
||||
/// </summary>
|
||||
public bool ScrollLock { get; }
|
||||
}
|
||||
Reference in new issue
Block a user