/[AnywhereTS-MSSQL]/trunk/TSAdminTool/ProSupport.cs
ViewVC logotype

Diff of /trunk/TSAdminTool/ProSupport.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/TSAdminTool/ProSupport.cs	2012/07/11 16:36:27	16
+++ trunk/TSAdminTool/ProSupport.cs	2012/07/12 18:56:31	64
@@ -11,6 +11,7 @@
 using System.IO;
 using System.Management;
 using System.Net;
+using log4net;
 
 // Support class for the AnywhereTS version. This file should only be included in the Pro version.
 namespace AnywhereTS
@@ -148,6 +149,7 @@
         }
 
         // Adds an ACL entry for RW access on the specified file for Remote desktop users.
+        [Obsolete("GrantRWaccessForRemoteDesktopUsers has been deprecated - define user access rights via SQL Server")]
         public static void GrantRWaccessForRemoteDesktopUsers(string fileName)
         {
             // Get a FileSecurity object that represents the current security settings.
@@ -163,6 +165,7 @@
         }
 
         // Adds an ACL entry for ReadWriteModify access on the specified file for Remote desktop users.
+        [Obsolete("GrantRWMaccessForRemoteDesktopUsers has been deprecated - define user access rights via SQL Server")]
         public static void GrantRWMaccessForRemoteDesktopUsers(string fileName)
         {
             // Get a FileSecurity object that represents the current security settings.
@@ -180,6 +183,7 @@
 
         // (obsolete)
         // Adds an ACL entry for to deny modify access on the specified file for all users.
+        [Obsolete("DenyAccessRightModifyForUsers has been deprecated - define user access rights via SQL Server")]
         public static void DenyAccessRightModifyForUsers(string fileName)
         {
             // Get a FileSecurity object that represents the current security settings.
@@ -223,7 +227,15 @@
                 }
             }
             else
-                throw new Exception("Unknown TFTP mode 28158");
+            {
+                string error = "Error: Unknown TFTP Config mode (28158)";
+                using (log4net.NDC.Push(string.Format("tftpConfig={0}", ATSGlobals.tftpConfig)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("tftpConfig={0}", ATSGlobals.tftpConfig)));
+                return;
+            }
         }
 
         // Copy image file to all external tftp directories/servers
@@ -245,6 +257,13 @@
                 catch (Exception e)
                 {
                     MessageBox.Show("Could not update TFTP server '" + GetTftpPath(row) + "' (22181). Error: " + 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("tftpPath={0}", GetTftpPath(row))))
+                        {
+                            Logging.ATSAdminLog.Error("Could not update TFTP server");
+                        }
+                    }
                 }
             
                 // Try to set rights for image the image file
@@ -280,6 +299,13 @@
                 catch (Exception e)
                 {
                     MessageBox.Show("Could not update TFTP server '" + GetTftpPath(row) + "' (22381). Error: " + 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("tftpPath={0}", GetTftpPath(row))))
+                        {
+                            Logging.ATSAdminLog.Error("Could not update TFTP server");
+                        }
+                    }
                 }
             }
         }
@@ -299,6 +325,10 @@
                 catch (Exception ex)
                 {
                     MessageBox.Show("Cannot set access rights for client configuration. Application will abort. Error: " + 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("Cannot set access rights for client configuration");
+                    }
                     Application.Exit();
                     return;
                 }
@@ -325,7 +355,15 @@
                 }
             }
             else
-                throw new Exception("Unknown TFTP mode 48158");
+            {
+                string error = "Error: Unknown TFTP Config mode (48158)";
+                using (log4net.NDC.Push(string.Format("tftpConfig={0}", ATSGlobals.tftpConfig)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("tftpConfig={0}", ATSGlobals.tftpConfig)));
+                return;
+            }
         }
 
 
@@ -361,6 +399,13 @@
             {
                 //improve autoretry
                 MessageBox.Show("Error: Could not write configuration data to disk. Possibly the data is being accessed by another component right now or you do not have the sufficient rights. Please retry this operation later (52044). 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("path={0}", path)))
+                    {
+                        Logging.ATSAdminLog.Error("Could not write configuration data to disk");
+                    }
+                }
             }
 
             finally
@@ -436,7 +481,15 @@
                 }
             }
             else
-                throw new Exception("Unknown TFTP mode 88158");
+            {
+                string error = "Error: Unknown TFTP Config mode (88158)";
+                using (log4net.NDC.Push(string.Format("tftpConfig={0}", ATSGlobals.tftpConfig)))
+                {
+                    Logging.ATSAdminLog.Error(error);
+                }
+                MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("tftpConfig={0}", ATSGlobals.tftpConfig)));
+                return;
+            }
 
             WriteHostsFiles();
             ATSImageRuntimeConfig currentConfig = new ATSImageRuntimeConfig();

 

  ViewVC Help
Powered by ViewVC 1.1.22