Parent Directory
|
Revision Log
|
Patch
--- trunk/TSAdminTool/Globals.cs 2012/07/11 14:19:13 4 +++ trunk/TSAdminTool/Globals.cs 2012/07/12 14:29:34 47 @@ -6,6 +6,7 @@ using System.Security; // Security Exception using System.Windows.Forms; // Message Box using System.Text.RegularExpressions; // For validate MAC address +using log4net; namespace AnywhereTS { @@ -160,21 +161,42 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); } - catch (ArgumentNullException) + catch (ArgumentNullException ex) { MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (22411)"); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) + { + using (log4net.NDC.Push("Installation info missing.")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return ""; } - catch (SecurityException e) + catch (SecurityException ex) { - 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); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) + { + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Invalid users rights.")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return ""; } - catch (Exception e) + catch (Exception ex) { - 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); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } Application.Exit(); return ""; } @@ -190,6 +212,10 @@ catch (Exception e) { MessageBox.Show("Error when reading from registry (22414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } Application.Exit(); return ""; } @@ -197,6 +223,13 @@ else { MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue); + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Value is missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return ""; } @@ -204,6 +237,13 @@ else { MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Key is missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); } return ""; // No value could be retrieved from registry @@ -218,21 +258,42 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); } - catch (ArgumentNullException) + catch (ArgumentNullException ex) { MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (22411)"); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) + { + using (log4net.NDC.Push("Installation info missing.")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return 0; } catch (SecurityException e) { MessageBox.Show("Error when reading from registry. You do not have the necessary permission (22412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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("Invalid user rights.")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return 0; } catch (Exception e) { MessageBox.Show("Error when reading from registry (22413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } Application.Exit(); return 0; } @@ -248,6 +309,13 @@ catch (Exception e) { MessageBox.Show("Error when reading from registry (22414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return 0; } @@ -255,6 +323,15 @@ else { MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue); + + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Value is missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + Application.Exit(); return 0; } @@ -262,6 +339,15 @@ else { MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + regValue); + + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Key is missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + Application.Exit(); } return 0; // No value could be retrieved from registry @@ -276,21 +362,45 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey,true); } - catch (ArgumentNullException) + catch (ArgumentNullException e) { MessageBox.Show("Error when writing to registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (62411)"); + using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString()))) + { + using (log4net.NDC.Push("Installation info missing")) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } Application.Exit(); return; } catch (SecurityException e) { MessageBox.Show("Error when writing to registry. You do not have the necessary permission (62412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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("Invalid user rights")) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } + } Application.Exit(); return; } catch (Exception e) { MessageBox.Show("Error when reading from registry (62413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return; } @@ -304,12 +414,28 @@ catch (Exception e) { MessageBox.Show("Error when writing to registry (62414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } Application.Exit(); } } else { MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue); + + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Key is missing")) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } + Application.Exit(); } } @@ -323,21 +449,45 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey, true); } - catch (ArgumentNullException) + catch (ArgumentNullException e) { MessageBox.Show("Error when writing to registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (62411)"); + 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))) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } Application.Exit(); return; } catch (SecurityException e) { MessageBox.Show("Error when writing to registry. You do not have the necessary permission (62412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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("Invalid user rights")) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } + } Application.Exit(); return; } catch (Exception e) { MessageBox.Show("Error when reading from registry (62413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return; } @@ -351,12 +501,27 @@ catch (Exception e) { MessageBox.Show("Error when writing to registry (62414). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } Application.Exit(); } } else { MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue); + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Key is missing")) + { + Logging.ATSAdminLog.Error("Error when writing to registry."); + } + } + Application.Exit(); } } @@ -370,21 +535,48 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); } - catch (ArgumentNullException) + catch (ArgumentNullException e) { MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (29411)"); + 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("Installation info missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return false; } catch (SecurityException e) { MessageBox.Show("Error when reading from registry. You do not have the necessary permission (29412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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("Invalid user rights")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return false; } catch (Exception e) { MessageBox.Show("Error when reading from registry (29413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return false; } @@ -403,6 +595,15 @@ else { MessageBox.Show("Error when reading from registry (59221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); + + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + using (log4net.NDC.Push("Key is missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + Application.Exit(); } return false; // No value could be retrieved from registry @@ -517,21 +718,49 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); } - catch (ArgumentNullException) + catch (ArgumentNullException e) { MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (92411)"); + 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("Installation info missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return; } catch (SecurityException e) { MessageBox.Show("Error when reading from registry. You do not have the necessary permission (92412). Key: "+ regKey + " Value: " + regValue + " Error details:" + e.Message); + 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("Invalid user rights")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return; } catch (Exception e) { MessageBox.Show("Error when reading from registry (92413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + + } + } Application.Exit(); return; } @@ -546,6 +775,12 @@ else { MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); + + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + Application.Exit(); } } @@ -561,21 +796,48 @@ { objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); } - catch (ArgumentNullException) + catch (ArgumentNullException e) { MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (92411)"); + 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("Installation info missing")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return; } catch (SecurityException e) { MessageBox.Show("Error when reading from registry. You do not have the necessary permission (92412). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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("Invalid users rights")) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } + } Application.Exit(); return; } catch (Exception e) { MessageBox.Show("Error when reading from registry (92413). Key: " + regKey + " Value: " + regValue + " Error details:" + e.Message); + 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))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + } Application.Exit(); return; } @@ -590,6 +852,12 @@ else { MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root); + + using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue))) + { + Logging.ATSAdminLog.Error("Error when reading from registry."); + } + Application.Exit(); } }
ViewVC Help | |
Powered by ViewVC 1.1.22 |