-
Notifications
You must be signed in to change notification settings - Fork 2
/
Globals.cs
283 lines (283 loc) · 5.8 KB
/
Globals.cs
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
namespace CollabClient
{
internal class Globals
{
public static string vmip = "IP here, node name ->";
public static string vmname = "here";
public static string vmusername = "collabvm-csharp-user";
public static bool vmdiscovery = false;
public static bool isSecure = false;
public static bool isCompressed = true;
public static bool autoReconnect = false;
public static bool disableTurnMessages = false;
public static ushort GetKeycodeByName(System.Windows.Forms.KeyEventArgs Keyevent, ushort fallback) {
System.Windows.Forms.Keys Keyname = Keyevent.KeyCode;
string keystring = Keyname.ToString();
ushort kc = (char) Keyevent.KeyValue;
ushort keycode = 0;
switch (keystring)
{
case "Escape":
keycode = 0xff1b;
break;
case "F1":
keycode = 0xffbe;
break;
case "F2":
keycode = 0xffbf;
break;
case "F3":
keycode = 0xffc0;
break;
case "F4":
keycode = 0xffc1;
break;
case "F5":
keycode = 0xffc2;
break;
case "F6":
keycode = 0xffc3;
break;
case "F7":
keycode = 0xffc4;
break;
case "F8":
keycode = 0xffc5;
break;
case "F9":
keycode = 0xffc6;
break;
case "F10":
keycode = 0xffc7;
break;
case "F11":
keycode = 0xffc8;
break;
case "F12":
keycode = 0xffc9;
break;
case "Oem8": // `/¬/¦
keycode = 0x0060;
break;
case "OemMinus":
keycode = 0x002d;
break;
case "Oemplus":
keycode = 0x002b;
break;
case "Back": //...space
keycode = 0xff08;
break;
case "Return": //...space
keycode = 0xff0d;
break;
case "ShiftKey": // both of them, lol .net
keycode = 0xffe1;
break;
case "Oemcomma":
keycode = 0x002c;
break;
case "OemPeriod":
keycode = 0x002e;
break;
case "OemQuestion":
keycode = 0x003f;
break;
case "ControlKey":
keycode = 0xffe3;
break;
case "Menu": // Alt, windows calls this Menu but XK_MENU is KC 93 lol
keycode = 0xffe9;
break;
case "LWin":
keycode = 0xffeb;
break;
case "Apps":
keycode = 0xff67;
break;
case "Insert":
keycode = 0xff63;
break;
case "Delete":
keycode = 0xffff;
break;
case "Home":
keycode = 0xff50;
break;
case "End":
keycode = 0xff57;
break;
case "PageUp":
keycode = 0xff55;
break;
case "Next":
keycode = 0xff56;
break;
case "Left":
keycode = 0xff51;
break;
case "Up":
keycode = 0xff52;
break;
case "Right":
keycode = 0xff53;
break;
case "Down":
keycode = 0xff54;
break;
/**
* Do you ever just feel pain? I do.
* This is the part where I put in the (ambigious) OEM keys.
* - yellows111
*/
case "OemOpenBrackets": {
switch (kc)
{
case 219:
keycode = 0x007b;
break;
case 251:
keycode = 0x005b;
break;
}
break;
}
case "Oem1":
keycode = 0x003b;
break;
case "Oem5": {
switch (kc)
{
case 220:
keycode = 0x007c;
break;
case 252:
keycode = 0x005c;
break;
}
break;
}
case "Oem6": {
switch (kc)
{
case 221:
keycode = 0x007d;
break;
case 253:
keycode = 0x005d;
break;
}
break;
}
case "Oem7": {
switch (kc)
{
case 222: // "
keycode = 0x0022;
break;
case 254: // '
keycode = 0x0027;
break;
}
break;
}
case "Oemtilde": { // not to be confused with Oem8
switch (kc)
{
case 192: // ~
keycode = 0x007e;
break;
case 224: // `
keycode = 0x0060;
break;
}
break;
}
case "OemBackslash": { // on 102-key US keyboards or equiv... dupe of Oem5
switch (kc)
{
case 194:
keycode = 0x007c;
break;
case 226:
keycode = 0x005c;
break;
}
break;
}
// Return to sanity?
case "Tab":
keycode = 0xff09;
break;
case "Capital":
keycode = 0xffe5;
break;
case "Pause":
keycode = 0xff6b;
break;
case "PrintScreen":
keycode = 0xff15;
break;
case "Scroll":
keycode = 0xff14;
break;
case "BrowserSearch": //X11 doesn't define Media Keys, so we have to do massive assumptions or make them keys you can't press normally
keycode = 0xff09;
break;
// bonus round: keypad with NL on
case "NumPad0":
keycode = 0xffb0;
break;
case "NumPad1":
keycode = 0xffb1;
break;
case "NumPad2":
keycode = 0xffb2;
break;
case "NumPad3":
keycode = 0xffb3;
break;
case "NumPad4":
keycode = 0xffb4;
break;
case "NumPad5":
keycode = 0xffb5;
break;
case "NumPad6":
keycode = 0xffb6;
break;
case "NumPad7":
keycode = 0xffb7;
break;
case "NumPad8":
keycode = 0xffb8;
break;
case "NumPad9":
keycode = 0xffb9;
break;
case "Decimal":
keycode = 0xffae;
break;
case "Add":
keycode = 0xffab;
break;
case "Divide":
keycode = 0xffaf;
break;
case "Multiply":
keycode = 0xffaa;
break;
case "Subtract":
keycode = 0xffad;
break;
case "NumLock":
keycode = 0xff7f;
break;
default: // every key *not* listed here fallbacks to this...
keycode = fallback;
break;
}
return keycode;
}
}
}