20 |
public override void Install(IDictionary stateSaver) |
public override void Install(IDictionary stateSaver) |
21 |
{ |
{ |
22 |
base.Install(stateSaver); |
base.Install(stateSaver); |
23 |
string path = this.Context.Parameters["targetdir"]; |
try |
24 |
Logging.SetLogPath(path); |
{ |
25 |
//// load files into app domain |
string path = this.Context.Parameters["targetdir"]; |
26 |
//AssemblyName asm_log4net = Assembly.LoadFile(string.Format(@"{0}\log4net.dll", path)).GetName(); |
Logging.UpdateLogPath(string.Format(@"{0}\logs", path)); |
27 |
//AssemblyName asm_logging = Assembly.LoadFile(string.Format(@"{0}\AnywhereTS.Logging.dll", path)).GetName(); |
using (log4net.NDC.Push("Logged from ATSAdmin.Installer")) |
|
//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 |
|
28 |
{ |
{ |
29 |
|
// setup database |
30 |
|
string DBServer = this.Context.Parameters["DBSERVER"]; |
31 |
|
string DBInstance = this.Context.Parameters["DBINSTANCE"]; |
32 |
|
// Log the entered data |
33 |
|
Logging.ATSAdminInstallerLog.DebugFormat("Server={0} Instance={1}", DBServer, DBInstance); |
34 |
|
CreateRegistryConfigKeys(); |
35 |
|
ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseServer, DBServer); |
36 |
|
ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseInstance, DBInstance); |
37 |
|
// install the database |
38 |
|
|
39 |
AnywhereTS.DatabaseSupport dbsup = new DatabaseSupport(); |
AnywhereTS.DatabaseSupport dbsup = new DatabaseSupport(); |
40 |
dbsup.SetupDatabase(); |
dbsup.SetupDatabase(); |
41 |
|
|
42 |
} |
} |
43 |
catch (Exception ex) |
} |
44 |
|
catch (Exception ex) |
45 |
|
{ |
46 |
|
// database install failed |
47 |
|
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString()))) |
48 |
{ |
{ |
49 |
// database install failed |
Logging.ATSAdminInstallerLog.Error("Install() failed."); |
|
throw ex; |
|
50 |
} |
} |
51 |
|
throw ex; |
52 |
} |
} |
53 |
} |
} |
54 |
|
|
55 |
private void CreateRegistryConfigKeys() |
private void CreateRegistryConfigKeys() |
56 |
{ |
{ |
57 |
Microsoft.Win32.RegistryKey key =null; |
try |
58 |
if (IntPtr.Size == 8) |
{ |
59 |
{ // 64 bit OS |
Microsoft.Win32.RegistryKey key = null; |
60 |
//string t = @"SOFTWARE\Wow6432Node\" + ATSGlobals.ApplicationName + @"\ts-config"; |
if (IntPtr.Size == 8) |
61 |
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\", true); |
{ // 64 bit OS |
62 |
key.CreateSubKey("TFTPD32").CreateSubKey("DHCP"); |
//string t = @"SOFTWARE\Wow6432Node\" + ATSGlobals.ApplicationName + @"\ts-config"; |
63 |
key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config"); |
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\", true); |
64 |
|
key.CreateSubKey("TFTPD32").CreateSubKey("DHCP"); |
65 |
|
key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config"); |
66 |
|
} |
67 |
|
else |
68 |
|
{ // 32 bit OS |
69 |
|
//strATSregRoot = @"SOFTWARE\" + ATSGlobals.ApplicationName + @"\ts-config"; |
70 |
|
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software", true); |
71 |
|
key.CreateSubKey("TFTPD32").CreateSubKey("DHCP"); |
72 |
|
key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config"); |
73 |
|
} |
74 |
|
|
75 |
|
// AdminVersion = 2 |
76 |
|
key.SetValue("AdminVersion", 2); |
77 |
|
// RunFirstTime = 1 |
78 |
|
key.SetValue("RunFirstTime", 1); |
79 |
|
ATSGlobals.CreateRegistryValues(); |
80 |
} |
} |
81 |
else |
catch (Exception ex) |
82 |
{ // 32 bit OS |
{ |
83 |
//strATSregRoot = @"SOFTWARE\" + ATSGlobals.ApplicationName + @"\ts-config"; |
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}",ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString()))) |
84 |
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software",true); |
{ |
85 |
key.CreateSubKey("TFTPD32").CreateSubKey("DHCP"); |
Logging.ATSAdminInstallerLog.Error("CreateRegistryConfigKeys() failed."); |
86 |
key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config"); |
} |
87 |
} |
} |
|
|
|
|
// AdminVersion = 2 |
|
|
key.SetValue("AdminVersion", 2); |
|
|
// RunFirstTime = 1 |
|
|
key.SetValue("RunFirstTime", 1); |
|
|
ATSGlobals.CreateRegistryValues(); |
|
88 |
} |
} |
89 |
} |
} |
90 |
} |
} |