[go: up one dir, main page]

Menu

[r91]: / Machine.cs  Maximize  Restore  History

Download this file

346 lines (330 with data), 9.1 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
 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Diagnostics;
using System.Data;
using System.Net;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
using System.Runtime.Serialization.Formatters.Binary;
using Microsoft.Win32;
namespace RDPManager
{
[Serializable]
public class Credentials
{
private String userName = "";
public String UserName
{
get { return userName; }
set { userName = value; }
}
private String passWord = "";
public String Password
{
get { return passWord; }
set { passWord = value; }
}
private String domain = "";
public String Domain
{
get { return domain; }
set { domain = value; }
}
}
[Serializable]
public class Machine
{
private Int32 hashCode = -1;
//private bool hashCodeSet = false;
private string machineName = "";
private string displayName = "";
private string screenMode = "";
private string desktopWidth = "";
private string desktopHeight = "";
private string sessionBpp = "";
private string compression = "";
private string keyboardHook = "";
private string audioMode = "";
private string drivesToRedirect = "";
private string redirectPrinters = "";
private string redirectComPorts = "";
private string redirectSmartCards = "";
private string disableWallpaper = "";
private string disableWindowDrag = "";
private string disableAnims = "";
private string disableThemes = "";
private string disableCursor = "";
private string serverPort = "";
private string displayConnectionBar = "";
private string connectToConsole = "";
private string cmdLine = "";
private string cmdArgs = "";
private bool disableCredsSPSupport = false;
private Credentials manualCred = new Credentials();
private bool isManual = false;
public Machine()
{
}
public void SetDefault()
{
machineName = "Default";
displayName = "Default";
screenMode = "1";
displayConnectionBar = "1";
desktopWidth = "1024";
desktopHeight = "768";
sessionBpp = "16";
compression = "1";
keyboardHook = "2";
audioMode = "2";
drivesToRedirect = "";
redirectPrinters = "";
redirectComPorts = "0";
redirectSmartCards = "0";
disableWallpaper = "1";
disableWindowDrag = "1";
disableAnims = "1";
disableThemes = "1";
disableCursor = "0";
serverPort = "3389";
connectToConsole = "0";
cmdLine = "";
cmdArgs = "";
disableCredsSPSupport = false;
hashCode = -1;
}
public void Clear()
{
machineName = "";
displayName = "";
screenMode = "";
displayConnectionBar = "";
desktopWidth = "";
desktopHeight = "";
sessionBpp = "";
compression = "";
keyboardHook = "";
audioMode = "";
drivesToRedirect = "";
redirectPrinters = "";
redirectComPorts = "";
redirectSmartCards = "";
disableWallpaper = "";
disableWindowDrag = "";
disableAnims = "";
disableThemes = "";
disableCursor = "";
serverPort = "";
connectToConsole = "";
cmdLine = "";
cmdArgs = "";
disableCredsSPSupport = false;
hashCode = -1;
}
public void CopyFrom(Machine mach)
{
screenMode = mach.ScreenMode;
displayConnectionBar = mach.DisplayConnectionBar;
desktopWidth = mach.DesktopWidth;
desktopHeight = mach.DesktopHeight;
sessionBpp = mach.SessionBpp;
compression = mach.Compression;
keyboardHook = mach.KeyboardHook;
audioMode = mach.audioMode;
drivesToRedirect = mach.DrivesToRedirect;
redirectPrinters = mach.RedirectPrinters;
redirectComPorts = mach.RedirectComPorts;
redirectSmartCards = mach.redirectSmartCards;
disableWindowDrag = mach.DisableWindowDrag;
disableAnims = mach.DisableAnims;
disableThemes = mach.DisableThemes;
disableCursor = mach.DisableCursor;
disableWallpaper = mach.DisableWallpaper;
serverPort = mach.ServerPort;
connectToConsole = mach.ConnectToConsole;
machineName = mach.MachineName;
displayName = mach.DisplayName;
cmdLine = mach.CmdLine;
cmdArgs = mach.CmdArgs;
disableCredsSPSupport = mach.DisableCredsSPSupport;
}
public override int GetHashCode()
{
if( true ) //hashCode == -1 )
{
StringBuilder tmpStr = new StringBuilder();
tmpStr.Append(machineName);
tmpStr.Append(displayName);
tmpStr.Append(screenMode);
tmpStr.Append(displayConnectionBar);
tmpStr.Append(desktopWidth);
tmpStr.Append(desktopHeight);
tmpStr.Append(compression);
tmpStr.Append(keyboardHook);
tmpStr.Append(audioMode);
tmpStr.Append(sessionBpp);
tmpStr.Append(drivesToRedirect);
tmpStr.Append(redirectPrinters);
tmpStr.Append(redirectComPorts);
tmpStr.Append(redirectSmartCards);
tmpStr.Append(disableWallpaper);
tmpStr.Append(disableWindowDrag);
tmpStr.Append(disableAnims);
tmpStr.Append(disableThemes);
tmpStr.Append(disableCursor);
tmpStr.Append(serverPort);
tmpStr.Append(connectToConsole);
tmpStr.Append(cmdLine);
tmpStr.Append(cmdArgs);
hashCode = tmpStr.ToString().GetHashCode();
}
return hashCode;
}
public void SetHashCode(Int32 Value)
{
hashCode = Value;
//hashCodeSet = true;
return;
}
#region properties
public string MachineName
{
get { return machineName; }
set { machineName = value; }
}
public string DisplayName
{
get { return displayName; }
set { displayName = value; }
}
public string CmdLine
{
get { return cmdLine; }
set { cmdLine = value; }
}
public string CmdArgs
{
get { return cmdArgs; }
set { cmdArgs = value; }
}
public string ScreenMode
{
get { return screenMode; }
set { screenMode = value; }
}
public string DesktopWidth
{
get { return desktopWidth; }
set { desktopWidth = value; }
}
public string DesktopHeight
{
get { return desktopHeight; }
set { desktopHeight = value; }
}
public string SessionBpp
{
get { return sessionBpp; }
set { sessionBpp = value; }
}
public string Compression
{
get { return compression; }
set { compression = value; }
}
public string KeyboardHook
{
get { return keyboardHook; }
set { keyboardHook = value; }
}
public string AudioMode
{
get { return audioMode; }
set { audioMode = value; }
}
public string DrivesToRedirect
{
get { return drivesToRedirect; }
set { drivesToRedirect = value; }
}
public string RedirectPrinters
{
get { return redirectPrinters; }
set { redirectPrinters = value; }
}
public string RedirectComPorts
{
get { return redirectComPorts; }
set { redirectComPorts = value; }
}
public string RedirectSmartCards
{
get { return redirectSmartCards; }
set { redirectSmartCards = value; }
}
public string DisableWallpaper
{
get { return disableWallpaper; }
set { disableWallpaper = value; }
}
public string DisableWindowDrag
{
get { return disableWindowDrag; }
set { disableWindowDrag = value; }
}
public string DisableAnims
{
get { return disableAnims; }
set { disableAnims = value; }
}
public string DisableThemes
{
get { return disableThemes; }
set { disableThemes = value; }
}
public string DisableCursor
{
get { return disableCursor; }
set { disableCursor = value; }
}
public string ServerPort
{
get { return serverPort; }
set { serverPort = value; }
}
public string ConnectToConsole
{
get { return connectToConsole; }
set { connectToConsole = value; }
}
public string DisplayConnectionBar
{
get { return displayConnectionBar; }
set { displayConnectionBar = value; }
}
public bool DisableCredsSPSupport
{
get { return disableCredsSPSupport; }
set { disableCredsSPSupport = value; }
}
public Credentials ManualCred
{
get { return manualCred; }
set { manualCred = value; }
}
public bool IsManual
{
get { return isManual; }
set { isManual = value; }
}
#endregion
public override String ToString()
{
return displayName;
}
}
}