6 |
using System.Security; // Security Exception |
using System.Security; // Security Exception |
7 |
using System.Windows.Forms; // Message Box |
using System.Windows.Forms; // Message Box |
8 |
using System.Text.RegularExpressions; // For validate MAC address |
using System.Text.RegularExpressions; // For validate MAC address |
9 |
|
using log4net; |
10 |
|
|
11 |
namespace AnywhereTS |
namespace AnywhereTS |
12 |
{ |
{ |
14 |
{ |
{ |
15 |
// Version |
// Version |
16 |
public const string strDatabaseVersion = "1.0.0.3"; // The version string for the ATS database |
public const string strDatabaseVersion = "1.0.0.3"; // The version string for the ATS database |
17 |
|
public const string strDatabaseName = "AnywhereTS"; // THe name of the ATS database |
18 |
//[SerializableAttribute] public struct Color; |
//[SerializableAttribute] public struct Color; |
19 |
|
|
20 |
// Registry keys |
// Registry keys |
162 |
{ |
{ |
163 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
164 |
} |
} |
165 |
catch (ArgumentNullException) |
catch (ArgumentNullException ex) |
166 |
{ |
{ |
167 |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (22411)"); |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (22411)"); |
168 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
169 |
|
{ |
170 |
|
using (log4net.NDC.Push("Installation info missing.")) |
171 |
|
{ |
172 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
173 |
|
} |
174 |
|
} |
175 |
Application.Exit(); |
Application.Exit(); |
176 |
return ""; |
return ""; |
177 |
} |
} |
178 |
catch (SecurityException e) |
catch (SecurityException ex) |
179 |
{ |
{ |
180 |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (22412). Key: "+ regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (22412). Key: "+ regKey + " Value: " + regValue + " Error details:" + ex.Message); |
181 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
182 |
|
{ |
183 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
184 |
|
{ |
185 |
|
using (log4net.NDC.Push("Invalid users rights.")) |
186 |
|
{ |
187 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
188 |
|
} |
189 |
|
} |
190 |
|
} |
191 |
Application.Exit(); |
Application.Exit(); |
192 |
return ""; |
return ""; |
193 |
} |
} |
194 |
catch (Exception e) |
catch (Exception ex) |
195 |
{ |
{ |
196 |
MessageBox.Show("Error when reading from registry (22413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (22413). Key: " + regKey + " Value: " + regValue + " Error details:" + ex.Message); |
197 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
198 |
|
{ |
199 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
200 |
|
} |
201 |
Application.Exit(); |
Application.Exit(); |
202 |
return ""; |
return ""; |
203 |
} |
} |
213 |
catch (Exception e) |
catch (Exception e) |
214 |
{ |
{ |
215 |
MessageBox.Show("Error when reading from registry (22414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (22414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
216 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
217 |
|
{ |
218 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
219 |
|
} |
220 |
Application.Exit(); |
Application.Exit(); |
221 |
return ""; |
return ""; |
222 |
} |
} |
224 |
else |
else |
225 |
{ |
{ |
226 |
MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue); |
MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue); |
227 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
228 |
|
{ |
229 |
|
using (log4net.NDC.Push("Value is missing")) |
230 |
|
{ |
231 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
232 |
|
} |
233 |
|
} |
234 |
Application.Exit(); |
Application.Exit(); |
235 |
return ""; |
return ""; |
236 |
} |
} |
238 |
else |
else |
239 |
{ |
{ |
240 |
MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
241 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
242 |
|
{ |
243 |
|
using (log4net.NDC.Push("Key is missing")) |
244 |
|
{ |
245 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
246 |
|
} |
247 |
|
} |
248 |
Application.Exit(); |
Application.Exit(); |
249 |
} |
} |
250 |
return ""; // No value could be retrieved from registry |
return ""; // No value could be retrieved from registry |
259 |
{ |
{ |
260 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
261 |
} |
} |
262 |
catch (ArgumentNullException) |
catch (ArgumentNullException ex) |
263 |
{ |
{ |
264 |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (22411)"); |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (22411)"); |
265 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
266 |
|
{ |
267 |
|
using (log4net.NDC.Push("Installation info missing.")) |
268 |
|
{ |
269 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
270 |
|
} |
271 |
|
} |
272 |
Application.Exit(); |
Application.Exit(); |
273 |
return 0; |
return 0; |
274 |
} |
} |
275 |
catch (SecurityException e) |
catch (SecurityException e) |
276 |
{ |
{ |
277 |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (22412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (22412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
278 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
279 |
|
{ |
280 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
281 |
|
{ |
282 |
|
using (log4net.NDC.Push("Invalid user rights.")) |
283 |
|
{ |
284 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
285 |
|
} |
286 |
|
} |
287 |
|
} |
288 |
Application.Exit(); |
Application.Exit(); |
289 |
return 0; |
return 0; |
290 |
} |
} |
291 |
catch (Exception e) |
catch (Exception e) |
292 |
{ |
{ |
293 |
MessageBox.Show("Error when reading from registry (22413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (22413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
294 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
295 |
|
{ |
296 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
297 |
|
} |
298 |
Application.Exit(); |
Application.Exit(); |
299 |
return 0; |
return 0; |
300 |
} |
} |
310 |
catch (Exception e) |
catch (Exception e) |
311 |
{ |
{ |
312 |
MessageBox.Show("Error when reading from registry (22414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (22414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
313 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
314 |
|
{ |
315 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
316 |
|
{ |
317 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
318 |
|
} |
319 |
|
} |
320 |
Application.Exit(); |
Application.Exit(); |
321 |
return 0; |
return 0; |
322 |
} |
} |
324 |
else |
else |
325 |
{ |
{ |
326 |
MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue); |
MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue); |
327 |
|
|
328 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
329 |
|
{ |
330 |
|
using (log4net.NDC.Push("Value is missing")) |
331 |
|
{ |
332 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
333 |
|
} |
334 |
|
} |
335 |
|
|
336 |
Application.Exit(); |
Application.Exit(); |
337 |
return 0; |
return 0; |
338 |
} |
} |
340 |
else |
else |
341 |
{ |
{ |
342 |
MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + regValue); |
MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + regValue); |
343 |
|
|
344 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
345 |
|
{ |
346 |
|
using (log4net.NDC.Push("Key is missing")) |
347 |
|
{ |
348 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
349 |
|
} |
350 |
|
} |
351 |
|
|
352 |
Application.Exit(); |
Application.Exit(); |
353 |
} |
} |
354 |
return 0; // No value could be retrieved from registry |
return 0; // No value could be retrieved from registry |
363 |
{ |
{ |
364 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey,true); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey,true); |
365 |
} |
} |
366 |
catch (ArgumentNullException) |
catch (ArgumentNullException e) |
367 |
{ |
{ |
368 |
MessageBox.Show("Error when writing to registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (62411)"); |
MessageBox.Show("Error when writing to registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (62411)"); |
369 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
370 |
|
{ |
371 |
|
using (log4net.NDC.Push("Installation info missing")) |
372 |
|
{ |
373 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
374 |
|
} |
375 |
|
} |
376 |
Application.Exit(); |
Application.Exit(); |
377 |
return; |
return; |
378 |
} |
} |
379 |
catch (SecurityException e) |
catch (SecurityException e) |
380 |
{ |
{ |
381 |
MessageBox.Show("Error when writing to registry. You do not have the necessary permission (62412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when writing to registry. You do not have the necessary permission (62412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
382 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
383 |
|
{ |
384 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
385 |
|
{ |
386 |
|
using (log4net.NDC.Push("Invalid user rights")) |
387 |
|
{ |
388 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
389 |
|
} |
390 |
|
} |
391 |
|
} |
392 |
Application.Exit(); |
Application.Exit(); |
393 |
return; |
return; |
394 |
} |
} |
395 |
catch (Exception e) |
catch (Exception e) |
396 |
{ |
{ |
397 |
MessageBox.Show("Error when reading from registry (62413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (62413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
398 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
399 |
|
{ |
400 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
401 |
|
{ |
402 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
403 |
|
} |
404 |
|
} |
405 |
Application.Exit(); |
Application.Exit(); |
406 |
return; |
return; |
407 |
} |
} |
415 |
catch (Exception e) |
catch (Exception e) |
416 |
{ |
{ |
417 |
MessageBox.Show("Error when writing to registry (62414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when writing to registry (62414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
418 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
419 |
|
{ |
420 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
421 |
|
{ |
422 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
423 |
|
} |
424 |
|
} |
425 |
Application.Exit(); |
Application.Exit(); |
426 |
} |
} |
427 |
} |
} |
428 |
else |
else |
429 |
{ |
{ |
430 |
MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue); |
MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue); |
431 |
|
|
432 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
433 |
|
{ |
434 |
|
using (log4net.NDC.Push("Key is missing")) |
435 |
|
{ |
436 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
437 |
|
} |
438 |
|
} |
439 |
|
|
440 |
Application.Exit(); |
Application.Exit(); |
441 |
} |
} |
442 |
} |
} |
450 |
{ |
{ |
451 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey, true); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey, true); |
452 |
} |
} |
453 |
catch (ArgumentNullException) |
catch (ArgumentNullException e) |
454 |
{ |
{ |
455 |
MessageBox.Show("Error when writing to registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (62411)"); |
MessageBox.Show("Error when writing to registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (62411)"); |
456 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
457 |
|
{ |
458 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
459 |
|
{ |
460 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
461 |
|
} |
462 |
|
} |
463 |
Application.Exit(); |
Application.Exit(); |
464 |
return; |
return; |
465 |
} |
} |
466 |
catch (SecurityException e) |
catch (SecurityException e) |
467 |
{ |
{ |
468 |
MessageBox.Show("Error when writing to registry. You do not have the necessary permission (62412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when writing to registry. You do not have the necessary permission (62412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
469 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
470 |
|
{ |
471 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
472 |
|
{ |
473 |
|
using (log4net.NDC.Push("Invalid user rights")) |
474 |
|
{ |
475 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
476 |
|
} |
477 |
|
} |
478 |
|
} |
479 |
Application.Exit(); |
Application.Exit(); |
480 |
return; |
return; |
481 |
} |
} |
482 |
catch (Exception e) |
catch (Exception e) |
483 |
{ |
{ |
484 |
MessageBox.Show("Error when reading from registry (62413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (62413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
485 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
486 |
|
{ |
487 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
488 |
|
{ |
489 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
490 |
|
} |
491 |
|
} |
492 |
Application.Exit(); |
Application.Exit(); |
493 |
return; |
return; |
494 |
} |
} |
502 |
catch (Exception e) |
catch (Exception e) |
503 |
{ |
{ |
504 |
MessageBox.Show("Error when writing to registry (62414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when writing to registry (62414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
505 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
506 |
|
{ |
507 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
508 |
|
{ |
509 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
510 |
|
} |
511 |
|
} |
512 |
Application.Exit(); |
Application.Exit(); |
513 |
} |
} |
514 |
} |
} |
515 |
else |
else |
516 |
{ |
{ |
517 |
MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue); |
MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue); |
518 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
519 |
|
{ |
520 |
|
using (log4net.NDC.Push("Key is missing")) |
521 |
|
{ |
522 |
|
Logging.ATSAdminLog.Error("Error when writing to registry."); |
523 |
|
} |
524 |
|
} |
525 |
|
|
526 |
Application.Exit(); |
Application.Exit(); |
527 |
} |
} |
528 |
} |
} |
536 |
{ |
{ |
537 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
538 |
} |
} |
539 |
catch (ArgumentNullException) |
catch (ArgumentNullException e) |
540 |
{ |
{ |
541 |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (29411)"); |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (29411)"); |
542 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
543 |
|
{ |
544 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
545 |
|
{ |
546 |
|
using (log4net.NDC.Push("Installation info missing")) |
547 |
|
{ |
548 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
549 |
|
} |
550 |
|
} |
551 |
|
} |
552 |
Application.Exit(); |
Application.Exit(); |
553 |
return false; |
return false; |
554 |
} |
} |
555 |
catch (SecurityException e) |
catch (SecurityException e) |
556 |
{ |
{ |
557 |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (29412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (29412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
558 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
559 |
|
{ |
560 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
561 |
|
{ |
562 |
|
using (log4net.NDC.Push("Invalid user rights")) |
563 |
|
{ |
564 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
565 |
|
} |
566 |
|
} |
567 |
|
} |
568 |
Application.Exit(); |
Application.Exit(); |
569 |
return false; |
return false; |
570 |
} |
} |
571 |
catch (Exception e) |
catch (Exception e) |
572 |
{ |
{ |
573 |
MessageBox.Show("Error when reading from registry (29413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (29413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
574 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
575 |
|
{ |
576 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
577 |
|
{ |
578 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
579 |
|
} |
580 |
|
} |
581 |
Application.Exit(); |
Application.Exit(); |
582 |
return false; |
return false; |
583 |
} |
} |
596 |
else |
else |
597 |
{ |
{ |
598 |
MessageBox.Show("Error when reading from registry (59221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
MessageBox.Show("Error when reading from registry (59221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
599 |
|
|
600 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
601 |
|
{ |
602 |
|
using (log4net.NDC.Push("Key is missing")) |
603 |
|
{ |
604 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
605 |
|
} |
606 |
|
} |
607 |
|
|
608 |
Application.Exit(); |
Application.Exit(); |
609 |
} |
} |
610 |
return false; // No value could be retrieved from registry |
return false; // No value could be retrieved from registry |
719 |
{ |
{ |
720 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
721 |
} |
} |
722 |
catch (ArgumentNullException) |
catch (ArgumentNullException e) |
723 |
{ |
{ |
724 |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (92411)"); |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (92411)"); |
725 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
726 |
|
{ |
727 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
728 |
|
{ |
729 |
|
using (log4net.NDC.Push("Installation info missing")) |
730 |
|
{ |
731 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
732 |
|
} |
733 |
|
} |
734 |
|
} |
735 |
Application.Exit(); |
Application.Exit(); |
736 |
return; |
return; |
737 |
} |
} |
738 |
catch (SecurityException e) |
catch (SecurityException e) |
739 |
{ |
{ |
740 |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (92412). Key: "+ regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (92412). Key: "+ regKey + " Value: " + regValue + " Error details:" + e.Message); |
741 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
742 |
|
{ |
743 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
744 |
|
{ |
745 |
|
using (log4net.NDC.Push("Invalid user rights")) |
746 |
|
{ |
747 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
748 |
|
} |
749 |
|
} |
750 |
|
} |
751 |
Application.Exit(); |
Application.Exit(); |
752 |
return; |
return; |
753 |
} |
} |
754 |
catch (Exception e) |
catch (Exception e) |
755 |
{ |
{ |
756 |
MessageBox.Show("Error when reading from registry (92413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (92413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
757 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
758 |
|
{ |
759 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
760 |
|
{ |
761 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
762 |
|
|
763 |
|
} |
764 |
|
} |
765 |
Application.Exit(); |
Application.Exit(); |
766 |
return; |
return; |
767 |
} |
} |
776 |
else |
else |
777 |
{ |
{ |
778 |
MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
779 |
|
|
780 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
781 |
|
{ |
782 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
783 |
|
} |
784 |
|
|
785 |
Application.Exit(); |
Application.Exit(); |
786 |
} |
} |
787 |
} |
} |
797 |
{ |
{ |
798 |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); |
799 |
} |
} |
800 |
catch (ArgumentNullException) |
catch (ArgumentNullException e) |
801 |
{ |
{ |
802 |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (92411)"); |
MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (92411)"); |
803 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
804 |
|
{ |
805 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
806 |
|
{ |
807 |
|
using (log4net.NDC.Push("Installation info missing")) |
808 |
|
{ |
809 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
810 |
|
} |
811 |
|
} |
812 |
|
} |
813 |
Application.Exit(); |
Application.Exit(); |
814 |
return; |
return; |
815 |
} |
} |
816 |
catch (SecurityException e) |
catch (SecurityException e) |
817 |
{ |
{ |
818 |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (92412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry. You do not have the necessary permission (92412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
819 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
820 |
|
{ |
821 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
822 |
|
{ |
823 |
|
using (log4net.NDC.Push("Invalid users rights")) |
824 |
|
{ |
825 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
826 |
|
} |
827 |
|
} |
828 |
|
} |
829 |
Application.Exit(); |
Application.Exit(); |
830 |
return; |
return; |
831 |
} |
} |
832 |
catch (Exception e) |
catch (Exception e) |
833 |
{ |
{ |
834 |
MessageBox.Show("Error when reading from registry (92413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
MessageBox.Show("Error when reading from registry (92413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); |
835 |
|
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
836 |
|
{ |
837 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
838 |
|
{ |
839 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
840 |
|
} |
841 |
|
} |
842 |
Application.Exit(); |
Application.Exit(); |
843 |
return; |
return; |
844 |
} |
} |
853 |
else |
else |
854 |
{ |
{ |
855 |
MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); |
856 |
|
|
857 |
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
858 |
|
{ |
859 |
|
Logging.ATSAdminLog.Error("Error when reading from registry."); |
860 |
|
} |
861 |
|
|
862 |
Application.Exit(); |
Application.Exit(); |
863 |
} |
} |
864 |
} |
} |