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