-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyboardScancode.cs
More file actions
60 lines (57 loc) · 1.9 KB
/
KeyboardScancode.cs
File metadata and controls
60 lines (57 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ODIF;
using System.Windows.Media.Imaging;
namespace KeyboardScancode
{
[PluginInfo(
PluginName = "Keyboard Scancode",
PluginDescription = "",
PluginID = 53,
PluginAuthorName = "InputMapper",
PluginAuthorEmail = "jhebbel@gmail.com",
PluginAuthorURL = "http://inputmapper.com",
PluginIconPath = @""
)]
public class KeyboardScancode:OutputDevicePlugin
{
public KeyboardScancode()
{
KeyboardScancodeDevice Keyboard = new KeyboardScancodeDevice();
Devices.Add(Keyboard);
}
}
public class KeyboardScancodeDevice : OutputDevice
{
public KeyboardScancodeDevice()
{
this.DeviceName = "Keyboard Scancode Simulator";
this.StatusIcon = new BitmapImage(new Uri("pack://application:,,,/KeyboardScancode;component/Resources/Blank_White_Normal.png"));
foreach (var key in Enum.GetNames(typeof(statics.ScanCodeShort)))
{
if (key == null || key == "")
continue;
statics.ScanCodeShort keyEnum;
if (Enum.TryParse(key, out keyEnum))
{
InputChannelTypes.Button keyChannel = new InputChannelTypes.Button(key, ((short)keyEnum).ToString());
keyChannel.PropertyChanged += (s, e) =>
{
if (keyChannel.Value)
{
statics.SendKeyDown(keyEnum);
}
else
{
statics.SendKeyUp(keyEnum);
}
};
InputChannels.Add(keyChannel);
}
}
}
}
}