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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 149 - (show annotations) (download)
Sun Jul 15 11:21:36 2012 UTC (7 years, 11 months ago) by william
File size: 3314 byte(s)

1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.ComponentModel;
5 using System.Configuration.Install;
6 using System.Linq;
7 using System.Reflection;
8
9
10 namespace AnywhereTS
11 {
12 [RunInstaller(true)]
13 public partial class ATSAmdin : System.Configuration.Install.Installer
14 {
15 public ATSAmdin()
16 {
17 InitializeComponent();
18 }
19
20 public override void Install(IDictionary stateSaver)
21 {
22 base.Install(stateSaver);
23 string path = this.Context.Parameters["targetdir"];
24 Logging.SetLogPath(path);
25 //// load files into app domain
26 //AssemblyName asm_log4net = Assembly.LoadFile(string.Format(@"{0}\log4net.dll", path)).GetName();
27 //AssemblyName asm_logging = Assembly.LoadFile(string.Format(@"{0}\AnywhereTS.Logging.dll", path)).GetName();
28 //AppDomain.CurrentDomain.Load(asm_log4net);
29 //AppDomain.CurrentDomain.Load(asm_logging);
30
31 using (log4net.NDC.Push("Logged from ATSAdmin.Installer"))
32 {
33 // setup database
34 string DBServer = this.Context.Parameters["DBSERVER"];
35 string DBInstance = this.Context.Parameters["DBINSTANCE"];
36 // Log the entered data
37 Logging.ATSAdminLog.DebugFormat("Server={0} Instance={1}", DBServer, DBInstance);
38 CreateRegistryConfigKeys();
39 ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseServer, DBServer);
40 ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseInstance, DBInstance);
41 // install the database
42 try
43 {
44 AnywhereTS.DatabaseSupport dbsup = new DatabaseSupport();
45 dbsup.SetupDatabase();
46 }
47 catch (Exception ex)
48 {
49 // database install failed
50 throw ex;
51 }
52 }
53 }
54
55 private void CreateRegistryConfigKeys()
56 {
57 Microsoft.Win32.RegistryKey key =null;
58 if (IntPtr.Size == 8)
59 { // 64 bit OS
60 //string t = @"SOFTWARE\Wow6432Node\" + ATSGlobals.ApplicationName + @"\ts-config";
61 key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\", true);
62 key.CreateSubKey("TFTPD32").CreateSubKey("DHCP");
63 key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config");
64 }
65 else
66 { // 32 bit OS
67 //strATSregRoot = @"SOFTWARE\" + ATSGlobals.ApplicationName + @"\ts-config";
68 key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software",true);
69 key.CreateSubKey("TFTPD32").CreateSubKey("DHCP");
70 key = key.CreateSubKey(ATSGlobals.ApplicationName).CreateSubKey("ts-config");
71 }
72
73 // AdminVersion = 2
74 key.SetValue("AdminVersion", 2);
75 // RunFirstTime = 1
76 key.SetValue("RunFirstTime", 1);
77 ATSGlobals.CreateRegistryValues();
78 }
79 }
80 }

  ViewVC Help
Powered by ViewVC 1.1.22