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

Diff of /trunk/TSAdminTool/ATSAmdin.Installer.cs

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

--- trunk/TSAdminTool/ATSAmdin.Installer.cs	2012/07/15 11:21:36	149
+++ trunk/TSAdminTool/ATSAmdin.Installer.cs	2012/07/15 11:41:39	150
@@ -20,61 +20,71 @@
         public override void Install(IDictionary stateSaver)
         {
             base.Install(stateSaver);
-            string path = this.Context.Parameters["targetdir"];
-            Logging.SetLogPath(path);
-            //// load files into app domain
-            //AssemblyName asm_log4net = Assembly.LoadFile(string.Format(@"{0}\log4net.dll", path)).GetName();
-            //AssemblyName asm_logging = Assembly.LoadFile(string.Format(@"{0}\AnywhereTS.Logging.dll", path)).GetName();
-            //AppDomain.CurrentDomain.Load(asm_log4net);
-            //AppDomain.CurrentDomain.Load(asm_logging);
-
-            using (log4net.NDC.Push("Logged from ATSAdmin.Installer"))
-            {                
-                // setup database
-                string DBServer = this.Context.Parameters["DBSERVER"];
-                string DBInstance = this.Context.Parameters["DBINSTANCE"];
-                // Log the entered data
-                Logging.ATSAdminLog.DebugFormat("Server={0} Instance={1}", DBServer, DBInstance);
-                CreateRegistryConfigKeys();               
-                ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseServer, DBServer);
-                ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseInstance, DBInstance);
-                // install the database 
-                try
+            try
+            {
+                string path = this.Context.Parameters["targetdir"];
+                Logging.UpdateLogPath(string.Format(@"{0}\logs", path));
+                using (log4net.NDC.Push("Logged from ATSAdmin.Installer"))
                 {
+                    // setup database
+                    string DBServer = this.Context.Parameters["DBSERVER"];
+                    string DBInstance = this.Context.Parameters["DBINSTANCE"];
+                    // Log the entered data
+                    Logging.ATSAdminInstallerLog.DebugFormat("Server={0} Instance={1}", DBServer, DBInstance);
+                    CreateRegistryConfigKeys();
+                    ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseServer, DBServer);
+                    ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseInstance, DBInstance);
+                    // install the database 
+
                     AnywhereTS.DatabaseSupport dbsup = new DatabaseSupport();
                     dbsup.SetupDatabase();
+
                 }
-                catch (Exception ex)
+            }
+            catch (Exception ex)
+            {
+                // database install failed
+                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
                 {
-                    // database install failed
-                    throw ex;
+                    Logging.ATSAdminInstallerLog.Error("Install() failed.");
                 }
+                throw ex;
             }
         }
 
         private void CreateRegistryConfigKeys()
         {
-            Microsoft.Win32.RegistryKey key =null;
-            if (IntPtr.Size == 8)
-            {   // 64 bit OS
-                //string t = @"SOFTWARE\Wow6432Node\" + ATSGlobals.ApplicationName + @"\ts-config";
-                key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\", true);
-                key.CreateSubKey("TFTPD32").CreateSubKey("DHCP");
-                key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config");             
+            try
+            {
+                Microsoft.Win32.RegistryKey key = null;
+                if (IntPtr.Size == 8)
+                {   // 64 bit OS
+                    //string t = @"SOFTWARE\Wow6432Node\" + ATSGlobals.ApplicationName + @"\ts-config";
+                    key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\", true);
+                    key.CreateSubKey("TFTPD32").CreateSubKey("DHCP");
+                    key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config");
+                }
+                else
+                {   // 32 bit OS
+                    //strATSregRoot = @"SOFTWARE\" + ATSGlobals.ApplicationName + @"\ts-config";
+                    key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software", true);
+                    key.CreateSubKey("TFTPD32").CreateSubKey("DHCP");
+                    key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config");
+                }
+
+                // AdminVersion = 2
+                key.SetValue("AdminVersion", 2);
+                // RunFirstTime = 1
+                key.SetValue("RunFirstTime", 1);
+                ATSGlobals.CreateRegistryValues();
             }
-            else
-            {   // 32 bit OS
-                //strATSregRoot = @"SOFTWARE\" + ATSGlobals.ApplicationName + @"\ts-config";
-                key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software",true);
-                key.CreateSubKey("TFTPD32").CreateSubKey("DHCP");
-                key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config");
+            catch (Exception ex)
+            {
+                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}",ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
+                {
+                    Logging.ATSAdminInstallerLog.Error("CreateRegistryConfigKeys() failed.");
+                }
             }
-
-            // AdminVersion = 2
-            key.SetValue("AdminVersion", 2);
-            // RunFirstTime = 1
-            key.SetValue("RunFirstTime", 1);
-            ATSGlobals.CreateRegistryValues();
         }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22