ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/TSAdminTool/Globals.cs
(Generate patch)

Comparing trunk/TSAdminTool/Globals.cs (file contents):
Revision 46 by william, Thu Jul 12 14:17:14 2012 UTC vs.
Revision 47 by william, Thu Jul 12 14:29:34 2012 UTC

# Line 6 | Line 6 | using System.IO; // For Path
6   using System.Security; // Security Exception
7   using System.Windows.Forms; // Message Box
8   using System.Text.RegularExpressions; // For validate MAC address
9 + using log4net;
10  
11   namespace AnywhereTS
12   {
# Line 322 | Line 323 | namespace AnywhereTS
323                  else
324                  {
325                      MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue);
326 <                    using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
326 <                    {
326 >                
327                          using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
328                          {
329                              using (log4net.NDC.Push("Value is missing"))
# Line 331 | Line 331 | namespace AnywhereTS
331                                  Logging.ATSAdminLog.Error("Error when reading from registry.");
332                              }
333                          }
334 <                    }
334 >                    
335                      Application.Exit();
336                      return 0;
337                  }
# Line 339 | Line 339 | namespace AnywhereTS
339              else
340              {
341                  MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + regValue);
342 <                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
343 <                {
342 >              
343                      using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
344                      {
345                          using (log4net.NDC.Push("Key is missing"))
# Line 348 | Line 347 | namespace AnywhereTS
347                              Logging.ATSAdminLog.Error("Error when reading from registry.");
348                          }
349                      }
350 <                }
350 >                
351                  Application.Exit();
352              }
353              return 0; // No value could be retrieved from registry
# Line 515 | Line 514 | namespace AnywhereTS
514              else
515              {
516                  MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue);
517 <                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
519 <                {
520 <                    using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, 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 <                }
524 >                
525                  Application.Exit();
526              }
527          }
# Line 538 | Line 535 | namespace AnywhereTS
535              {
536                  objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey);
537              }
538 <            catch (ArgumentNullException)
538 >            catch (ArgumentNullException e)
539              {
540                  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())))
# Line 598 | Line 595 | namespace AnywhereTS
595              else
596              {
597                  MessageBox.Show("Error when reading from registry (59221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root);
598 <                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
602 <                {
598 >          
599                      using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
600                      {
601                          using (log4net.NDC.Push("Key is missing"))
# Line 607 | Line 603 | namespace AnywhereTS
603                              Logging.ATSAdminLog.Error("Error when reading from registry.");
604                          }
605                      }
606 <                }
606 >                
607                  Application.Exit();
608              }
609              return false; // No value could be retrieved from registry
# Line 779 | Line 775 | namespace AnywhereTS
775              else
776              {
777                  MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root);
778 <                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
783 <                {
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 <                }
783 >                
784                  Application.Exit();
785              }
786          }
# Line 857 | Line 852 | namespace AnywhereTS
852              else
853              {
854                  MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root);
855 <                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
861 <                {
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 <                }
860 >                
861                  Application.Exit();
862              }
863          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines