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 |
{ |
{ |
13 |
public static class ATSGlobals |
public static class ATSGlobals |
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.4"; // 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 |
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 |
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
|
|
{ |
|
328 |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
329 |
{ |
{ |
330 |
using (log4net.NDC.Push("Value is missing")) |
using (log4net.NDC.Push("Value is missing")) |
332 |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
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 |
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
|
|
{ |
|
344 |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
345 |
{ |
{ |
346 |
using (log4net.NDC.Push("Key is missing")) |
using (log4net.NDC.Push("Key is missing")) |
348 |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
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 |
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("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
|
{ |
|
|
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
|
519 |
{ |
{ |
520 |
using (log4net.NDC.Push("Key is missing")) |
using (log4net.NDC.Push("Key is missing")) |
521 |
{ |
{ |
522 |
Logging.ATSAdminLog.Error("Error when writing to registry."); |
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()))) |
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
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 |
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
|
|
{ |
|
600 |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
601 |
{ |
{ |
602 |
using (log4net.NDC.Push("Key is missing")) |
using (log4net.NDC.Push("Key is missing")) |
604 |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
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 |
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 |
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
|
|
{ |
|
780 |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
781 |
{ |
{ |
782 |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
783 |
} |
} |
784 |
} |
|
785 |
Application.Exit(); |
Application.Exit(); |
786 |
} |
} |
787 |
} |
} |
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 |
using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) |
|
|
{ |
|
857 |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) |
858 |
{ |
{ |
859 |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
Logging.ATSAdminLog.Error("Error when reading from registry."); |
860 |
} |
} |
861 |
} |
|
862 |
Application.Exit(); |
Application.Exit(); |
863 |
} |
} |
864 |
} |
} |