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

Comparing trunk/TSAdminTool/ImageRuntimeConfig.cs (file contents):
Revision 47 by william, Thu Jul 12 14:29:34 2012 UTC vs.
Revision 64 by william, Thu Jul 12 18:56:31 2012 UTC

--- trunk/TSAdminTool/ImageRuntimeConfig.cs	2012/07/12 14:29:34	47
+++ trunk/TSAdminTool/ImageRuntimeConfig.cs	2012/07/12 18:56:31	64
@@ -142,7 +142,15 @@ namespace AnywhereTS
                     ReadFromDatabase(row);
                 }
                 else
-                    throw new Exception("Error: Default record not written (27773).");
+                {
+                    string error = "Error: Default record not written (27773)";
+                    using (log4net.NDC.Push(string.Format("recordname={0}", ProSupport.DEFAULT_RECORD_MAC)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("recordname={0}", ProSupport.DEFAULT_RECORD_MAC)));
+                    return;
+                }
             }
         }
 
@@ -159,7 +167,13 @@ namespace AnywhereTS
                     ScreenColorDepth = ATSScreenColorDepth.ATS24Bit;
                     break;
                 default:
-                    throw new Exception("Error: Invalid color depth: " + row["ScreenColorDepth"].ToString());
+                    string error = "Error: Invalid color depth";
+                    using (log4net.NDC.Push(string.Format("ScreenColorDepth={0}", row["ScreenColorDepth"].ToString())))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("ScreenColorDepth={0}", row["ScreenColorDepth"].ToString())));
+                    return;
             }
 
             ServerName = row["ServerName"].ToString();
@@ -176,7 +190,16 @@ namespace AnywhereTS
                 SessionType = ATSSessionType.ATSICA;
             else if (row["SessionType"].ToString() == "PNA")
                 SessionType = ATSSessionType.ATSPNA;
-            else throw new Exception("Data conversion error 44539");
+            else
+            {
+                string error = "Error: Data conversion error (44539)";
+                using (log4net.NDC.Push(string.Format("RawSessionType={0}", row["SessionType"].ToString())))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("RawSessionType={0}", row["SessionType"].ToString())));
+                return;
+            }
 
             ReconnectPrompt = (bool)row["ReconnectPrompt"];
             RedirectFloppy = (bool)row["RedirectFloppy"];
@@ -198,7 +221,15 @@ namespace AnywhereTS
             else if (row["IcaProtocol"].ToString() == "HTTPonTCP")
                 ICAProtocol = ATSIcaProtocol.ATSHTTPOnTCP;
             else
-                throw new Exception("Unknown ICA protocol. Error 19732");
+            {
+                string error = "Error: Unknown ICA protocol. Error (19732)";
+                using (log4net.NDC.Push(string.Format("RawIcaProtocol={0}", row["IcaProtocol"].ToString())))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("RawIcaProtocol={0}", row["IcaProtocol"].ToString())));
+                return;
+            }
             ICAEncryption = row["IcaEncryption"].ToString();
 
             ICACompression = (bool)row["IcaCompression"];
@@ -210,7 +241,15 @@ namespace AnywhereTS
             else if (row["IcaAudioQuality"].ToString() == "High")
                 IcaAudioQuality = ATSIcaAudioQuality.High;
             else
-                throw new Exception("Unknown ICA audio quality. Error 34732");
+            {
+                string error = "Error: Unknown ICA audio quality. Error (34732)";
+                using (log4net.NDC.Push(string.Format("RawIcaAudioQuality={0}", row["IcaAudioQuality"].ToString())))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("RawIcaAudioQuality={0}", row["IcaAudioQuality"].ToString())));
+                return;
+            }
 
             ICAServer = row["IcaServer"].ToString();
             ICAApplicationSet = row["IcaApplicationSet"].ToString();
@@ -244,7 +283,13 @@ namespace AnywhereTS
                         UsbDrive = ATSUsbDrive.Many;
                         break;
                     default:
-                        throw new Exception("Error: Invalid USB Drive config:" + row["UsbDrive"].ToString());
+                        string error = "Error: Invalid USB Drive config";
+                        using (log4net.NDC.Push(string.Format("UsbDrive={0}", row["UsbDrive"].ToString())))
+                        {
+                            Logging.ATSAdminLog.Error(error);
+                        }
+                        MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("UsbDrive={0}", row["UsbDrive"].ToString())));
+                        return;
                 }
             }
             else
@@ -311,7 +356,13 @@ namespace AnywhereTS
                     row["ScreenColorDepth"] = "24";
                     break;
                 default:
-                    throw new Exception("Data conversion error 76532");
+                    string error = "Error: Data conversion error (76532)";
+                    using (log4net.NDC.Push(string.Format("ScreenColorDepth={0}", ScreenColorDepth)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("ScreenColorDepth={0}", ScreenColorDepth)));
+                    return;
             }
             row["ServerName"] = ServerName;
             row["ServerDomain"] = ServerDomain;
@@ -333,7 +384,13 @@ namespace AnywhereTS
                     row["SessionType"] = "PNA";
                     break;
                 default:
-                    throw new Exception("Data conversion error 44532");
+                    string error = "Error: Data conversion error (44532)";
+                    using (log4net.NDC.Push(string.Format("SessionType={0}", SessionType)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("SessionType={0}", SessionType)));
+                    return;
             }
             row["ReconnectPrompt"] = ReconnectPrompt;
             row["RedirectFloppy"] = RedirectFloppy;
@@ -356,7 +413,15 @@ namespace AnywhereTS
             else if (ICAProtocol == ATSIcaProtocol.ATSHTTPOnTCP)
                 row["IcaProtocol"] = "HTTPonTCP";
             else
-                throw new Exception("Unknown ICA protocol. Error 19732");
+            {
+                string error = "Error: Unknown ICA protocol. Error (19732)";
+                using (log4net.NDC.Push(string.Format("IcaProtocol={0}", ICAProtocol)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("IcaProtocol={0}", ICAProtocol)));
+                return;
+            }
 
             row["IcaEncryption"] = ICAEncryption;
             row["IcaCompression"] = ICACompression;
@@ -366,9 +431,17 @@ namespace AnywhereTS
             else if (IcaAudioQuality == ATSIcaAudioQuality.Medium)
                 row["IcaAudioQuality"]= "Medium";
             else if (IcaAudioQuality == ATSIcaAudioQuality.High)
-                row["IcaAudioQuality"]= "High";
+                row["IcaAudioQuality"] = "High";
             else
-                throw new Exception("Unknown ICA audio quality. Error 39702");
+            {
+                string error = "Error: Unknown ICA audio quality. Error (39702)";
+                using (log4net.NDC.Push(string.Format("IcaAudioQuality={0}", IcaAudioQuality)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("IcaAudioQuality={0}", IcaAudioQuality)));
+                return;
+            }
 
             row["IcaServer"] = ICAServer;
             row["IcaApplicationSet"] = ICAApplicationSet;
@@ -393,7 +466,13 @@ namespace AnywhereTS
                     row["UsbDrive"] = 2;
                     break;
                 default:
-                    throw new Exception("Data conversion error 32244");
+                    string error = "Error: Data conversion error (32244)";
+                    using (log4net.NDC.Push(string.Format("UsbDrive={0}", UsbDrive)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("UsbDrive={0}", UsbDrive)));
+                    return;
             }
             row["UsbDrivename"] = UsbDriveName;
 
@@ -426,7 +505,15 @@ namespace AnywhereTS
             else if (ScreenColorDepth == ATSScreenColorDepth.ATS24Bit)
                 writer.WriteLine("24");
             else
-                throw new Exception("Error: Unknown color depth 63342");
+            {
+                string error = "Error: Unknown color depth (63342)";
+                using (log4net.NDC.Push(string.Format("ScreenColorDepth={0}", ScreenColorDepth)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("ScreenColorDepth={0}", ScreenColorDepth)));
+                return;
+            }
             if (UsbDrive == ATSUsbDrive.One)
                 writer.WriteLine(@"USB_STORAGE_MULTI=OFF");
             if (UsbDrive == ATSUsbDrive.Many)
@@ -488,7 +575,15 @@ namespace AnywhereTS
                 writer.WriteLine("pnabrowse");
             }
             else
-                throw new Exception("Error: Unknown color depth 61132");
+            {
+                string error = "Error: Unknown SessionType (61132)";
+                using (log4net.NDC.Push(string.Format("SessionType={0}", SessionType)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("SessionType={0}", SessionType)));
+                return;
+            }
 
             // Server
             if (ServerPort == -1)
@@ -521,7 +616,15 @@ namespace AnywhereTS
                 else if (ScreenColorDepth == ATSScreenColorDepth.ATS24Bit)
                     writer.Write(" -a 24");
                 else
-                    throw new Exception("Error: Unknown color depth 63342");
+                {
+                    string error = "Error: Unknown ScreenColorDepth depth (63342)";
+                    using (log4net.NDC.Push(string.Format("ScreenColorDepth={0}", ScreenColorDepth)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("ScreenColorDepth={0}", ScreenColorDepth)));
+                    return;
+                }
             }
 
             // RDP sound
@@ -611,7 +714,15 @@ namespace AnywhereTS
                 else if (ICAProtocol == ATSIcaProtocol.ATSHTTPOnTCP)
                     writer.WriteLine("ICA_BROWSER_PROTOCOL=HTTPonTCP");
                 else
-                    throw new Exception("Unknown ICA protocol Error: 34211");
+                {
+                    string error = "Error: Unknown ICA protocol Error: (34211)";
+                    using (log4net.NDC.Push(string.Format("ICAProtocol={0}", ICAProtocol)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("ICAProtocol={0}", ICAProtocol)));
+                    return;
+                }
 
                 writer.WriteLine("SESSION_0_ICA_SERVER=" + ServerName);
                 writer.WriteLine(@"ICA_ENCRYPTION=""" + ICAEncryption + @"""");
@@ -633,7 +744,15 @@ namespace AnywhereTS
                 else if (IcaAudioQuality == ATSIcaAudioQuality.High)
                     writer.WriteLine("ICA_AUDIO_QUALITY=High");
                 else
-                    throw new Exception("Unknown ICA audio quality. Error 23165");
+                {
+                    string error = "Error: ICA audio quality. Error (23165)";
+                    using (log4net.NDC.Push(string.Format("IcaAudioQuality={0}", IcaAudioQuality)))
+                    {
+                        Logging.ATSAdminLog.Error(error);
+                    }
+                    MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("IcaAudioQuality={0}", IcaAudioQuality)));
+                    return;
+                }
 
                 writer.WriteLine("ICA_PRINTER=OFF"); //tabort
                 writer.WriteLine("ICA_SEAMLESS_WINDOW=OFF"); //tabort