コード例 #1
0
ファイル: MachineNode.cs プロジェクト: yuexiaoyun/cloudb
        private static void Install(CommandLine commandLine)
        {
            string options = GetServiceCommandLine(commandLine);

            string         logFile      = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "install.log");
            string         assemblyPath = typeof(MachineNode).Assembly.Location;
            InstallContext context      = new InstallContext(logFile,
                                                             new string[] {
                String.Format("/assemblypath={0}", assemblyPath),
                String.Format("/logfile={0}", logFile)
            });

            if (!String.IsNullOrEmpty(options))
            {
                context.Parameters["AdditionalOptions"] = options;
            }

            ListDictionary savedState = new ListDictionary();

            AssemblyInstaller installer = new AssemblyInstaller(typeof(MachineNodeService).Assembly, new string[0]);

            installer.Context       = context;
            installer.UseNewContext = false;
            installer.AfterInstall += AfterInstall;
            installer.Install(savedState);
            installer.Commit(savedState);
        }
コード例 #2
0
        public override void Install(IDictionary savedState)
        {
            // Check to make sure we're in an Administrator role
            WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());

            if (wp.IsInRole(WindowsBuiltInRole.Administrator) == false)
            {
                MessageBox.Show("You must be an Administrator to install this application or to run it for the first time.", "Administrator Privileges Required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                Application.Exit();
            }

            if (!EventLog.SourceExists("WMGCore"))
            {
                EventLog.CreateEventSource("WMGCore", "WMG");
            }
            RegistryKey el = Registry.LocalMachine.CreateSubKey("SYSTEM\\CurrentControlSet\\Services\\EventLog\\WMG");

            el.SetValue("MaxSize", 524288);
            el.SetValue("Retention", 0);

            base.Install(savedState);

            // Prepare the objects used to call Install on dependency assemblies
            AssemblyInstaller ai = new AssemblyInstaller();

            ai.UseNewContext = true;
            IDictionary state = new Hashtable();

            // Call Installer on MSR.LST.Net.RTP
            try
            {
                ai.Path = "MSR.LST.Net.RTP.dll";
                state.Clear();
                ai.Install(state);
                ai.Commit(state);
            }
            catch (Exception e) {
                MessageBox.Show("Failed to install RTP: " + e.ToString());
            }

            string   oldDirectory = Directory.GetCurrentDirectory();
            FileInfo fi           = new FileInfo(Assembly.GetExecutingAssembly().Location);

            Directory.SetCurrentDirectory(fi.Directory.FullName);
            try
            {
                RegisterCxpRtpFilters();
            }
            catch (DllNotFoundException)
            {
                MessageBox.Show("DllNotFound Exception while attempting to register CxpRtpFilters.ax.  This can happen if the set of C runtime merge modules in the msi does not match the libraries against which CxpRtpFilters.ax was built.", "Failed to Register CxpRtpFilters.ax");
            }
            Directory.SetCurrentDirectory(oldDirectory);


            // Save the fact that we're installed
            RegistryKey disc = Registry.LocalMachine.CreateSubKey("SOFTWARE\\UWCSE\\WMGATEWAY");

            disc.SetValue("WMGatewayInstalled", true);
        }
コード例 #3
0
    static void Main()
    {
        IDictionary mySavedState = new Hashtable();

        Console.WriteLine("");

        try
        {
            // Set the commandline argument array for 'logfile'.
            string[] myString = new string[1];
            myString[0] = "/logFile=example.log";

            // Create an object of the 'AssemblyInstaller' class.
            AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();

            // Set the properties to install the required assembly.
            myAssemblyInstaller.Path          = "MyAssembly_Install.exe";
            myAssemblyInstaller.CommandLine   = myString;
            myAssemblyInstaller.UseNewContext = true;

            // Clear the 'IDictionary' object.
            mySavedState.Clear();

            // Install the 'MyAssembly_Install' assembly.
            myAssemblyInstaller.Install(mySavedState);

            // Commit the 'MyAssembly_Install' assembly.
            myAssemblyInstaller.Commit(mySavedState);
        }
        catch (Exception)
        {
        }
    }
コード例 #4
0
ファイル: CommandInstall.cs プロジェクト: theopenem/Toec
 private static void Uninstall()
 {
     if (!HasAdministrativeRight())
     {
         Console.WriteLine("Administrative Privileges Required To Remove Service");
     }
     else
     {
         Console.WriteLine("UnInstalling Toec");
         try
         {
             var installer = new AssemblyInstaller(Assembly.GetExecutingAssembly(), new string[] {});
             installer.UseNewContext = true;
             installer.Uninstall(null);
             installer.Commit(null);
             Console.WriteLine();
             Console.WriteLine("Successfully UnInstalled Toec");
             Console.WriteLine("The Service Must Manually Be Started");
         }
         catch (Exception ex)
         {
             Console.WriteLine();
             Console.WriteLine("Could Not UnInstall Toec");
             Console.WriteLine(ex.Message);
         }
     }
 }
コード例 #5
0
        private static void DoUninstall(IDictionary <string, string> options)
        {
            String serviceName = options[OPT_SERVICE_NAME];

            if (serviceName != null)
            {
                ProjectInstaller.ServiceName = serviceName;
            }
            TransactedInstaller ti = new TransactedInstaller();

            string[] cmdline =
            {
                Assembly.GetExecutingAssembly().Location
            };
            AssemblyInstaller ai = new AssemblyInstaller(
                cmdline[0],
                new string[0]);

            ti.Installers.Add(ai);
            InstallContext ctx = new InstallContext("uninstall.log",
                                                    cmdline);

            ti.Context = ctx;
            ti.Uninstall(null);
        }
コード例 #6
0
        private AssemblyInstaller GetInstaller()
        {
            AssemblyInstaller installer = new AssemblyInstaller(this.ServiceAssembly, null);

            installer.UseNewContext = true;
            return(installer);
        }
コード例 #7
0
        /// <summary>
        /// 卸载服务。
        /// </summary>
        /// <returns></returns>
        public static bool UninstallService()
        {
            // 检测服务是否存在。
            if (!IsWindowsServiceInstalled(SERVICE_NAME))
            {
                return(true);
            }

            // 在卸载服务前需要停止服务。
            StopService();

            // 检测相应的服务文件是否存在。
            if (!IsServiceFileExists())
            {
                OOPS(SERVICE_FILE_NOT_EXIST);
                return(false);
            }

            try
            {
                string[]            cmdline             = {};
                TransactedInstaller transactedInstaller = new TransactedInstaller();
                AssemblyInstaller   assemblyInstaller   = new AssemblyInstaller(GetServiceFilePath(), cmdline);
                transactedInstaller.Installers.Add(assemblyInstaller);
                transactedInstaller.Uninstall(null);
            }
            catch (Exception ex)
            {
                OOPS(UNINSTALL_SERVICE_ERROR + ex.Message);
                return(false);
            }

            return(true);
        }
コード例 #8
0
        public void OnAction(Hashtable parameters)
        {
            AssemblyInstaller assemblyInstaller = new AssemblyInstaller(Assembly.GetExecutingAssembly(), new string[]
            {
                "/LogToConsole=false"
            });
            Hashtable savedState = new Hashtable();

            if (GameServerService.GetDOLService() == null)
            {
                Console.WriteLine("No service named \"DOL\" found!");
                return;
            }
            Console.WriteLine("Uninstalling DOL system service...");
            try
            {
                assemblyInstaller.Uninstall(savedState);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error uninstalling system service");
                Console.WriteLine(ex.Message);
                return;
            }
            Console.WriteLine("Finished!");
        }
コード例 #9
0
 static void Install(bool undo, string[] args)
 {
     try {
         Console.WriteLine(undo ? "uninstalling" : "installing");
         using (AssemblyInstaller inst = new AssemblyInstaller(typeof(Program).Assembly, args)) {
             IDictionary state = new Hashtable();
             inst.UseNewContext = true;
             try {
                 if (undo)
                 {
                     inst.Uninstall(state);
                 }
                 else
                 {
                     inst.Install(state);
                     inst.Commit(state);
                 }
             }
             catch {
                 try {
                     inst.Rollback(state);
                 }
                 catch { }
                 throw;
             }
         }
     }
     catch (Exception ex) {
         Console.Error.WriteLine(ex.Message);
     }
 }
コード例 #10
0
        public static string Install(string servicePath)
        {
            try
            {
                string serviceName = GetServiceNameByPath(servicePath);
                if (ExistsService(serviceName) == false)
                {
                    TransactedInstaller transactedInstaller = new TransactedInstaller();
                    AssemblyInstaller   assemblyInstaller   = new AssemblyInstaller(servicePath, cmdline);
                    transactedInstaller.Installers.Add(assemblyInstaller);
                    transactedInstaller.Install(new System.Collections.Hashtable());

                    while (ExistsService(serviceName) == false)
                    {
                        break;
                    }
                    return(serviceName);
                }
                else
                {
                    throw new Exception(serviceName + " 服务已经存在");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #11
0
 /// <summary>Uninstalls the service based on the entry assembly.</summary>
 public static void Uninstall()
 {
     using (AssemblyInstaller installer = new AssemblyInstaller(Assembly.GetEntryAssembly(), null))
     {
         installer.Uninstall(null);
     }
 }
コード例 #12
0
ファイル: Program.cs プロジェクト: saarrra2908/Service
        private static void InstallService()
        {
            if (IsInstalled())
            {
                return;
            }

            try
            {
                using (AssemblyInstaller installer = GetInstaller())
                {
                    IDictionary state = new Hashtable();
                    try
                    {
                        installer.Install(state);
                        installer.Commit(state);
                    }
                    catch (Exception ex)
                    {
                        WriteLog(ex.ToString());
                        WriteLog("Rolling back install.");
                        try
                        {
                            installer.Rollback(state);
                        }
                        catch { }
                        throw;
                    }
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #13
0
 private static void InstallService()
 {
     if (IsInstalled())
     {
         return;
     }
     try
     {
         using (AssemblyInstaller installer = GetInstaller())
         {
             Hashtable state = new Hashtable();
             try
             {
                 installer.Install(state);
                 installer.Commit(state);
             }
             catch
             {
                 try
                 {
                     installer.Rollback(state);
                 }
                 catch { }
                 throw;
             }
         }
     }
     catch
     {
         throw;
     }
 }
コード例 #14
0
 static void Install(bool undo, string[] args)
 {
     using (AssemblyInstaller asminstall = new AssemblyInstaller(typeof(XenService).Assembly, args))
     {
         System.Collections.IDictionary state = new System.Collections.Hashtable();
         asminstall.UseNewContext = true;
         try
         {
             if (undo)
             {
                 asminstall.Uninstall(state);
             }
             else
             {
                 asminstall.Install(state);
                 asminstall.Commit(state);
             }
         }
         catch
         {
             try
             {
                 asminstall.Rollback(state);
             }
             catch { }
         }
     }
 }
コード例 #15
0
        public static void InstallService(string serviceName, Assembly assembly)
        {
            if (IsServiceInstalled(serviceName))
            {
                AssemblyInstaller uninstall = new AssemblyInstaller(assembly, null);
                uninstall.UseNewContext = true;
                uninstall.Uninstall(null);
            }

            using (AssemblyInstaller installer = GetInstaller(assembly))
            {
                IDictionary state = new Hashtable();
                try
                {
                    installer.Install(state);
                    installer.Commit(state);
                }
                catch
                {
                    try
                    {
                        installer.Rollback(state);
                    }
                    catch { }
                    throw;
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Uninstalls the windows service contained in the provided assembly.
        /// </summary>
        /// <param name="assembly"></param>
        static public void Uninstall(Assembly assembly)
        {
            AssemblyInstaller Installer = new AssemblyInstaller(assembly, null);

            Installer.UseNewContext = true;
            Installer.Uninstall(null);
        }
コード例 #17
0
        public void Install(string logFilesPath)
        {
            if (IsInstalled())
            {
                return;
            }

            ConfigureLogFilesPath(logFilesPath);


            using (AssemblyInstaller installer = GetInstaller())
            {
                IDictionary state = new Hashtable();
                try
                {
                    installer.Install(state);
                    installer.Commit(state);
                }
                catch
                {
                    try
                    {
                        installer.Rollback(state);
                    }
                    catch
                    {
                        // ignored
                    }
                    throw;
                }
            }
        }
コード例 #18
0
        public static void UnInstallByServicePath(string servicePath)
        {
            try
            {
                string serviceName = GetServiceNameByPath(servicePath);
                if (ExistsService(serviceName))
                {
                    TransactedInstaller transactedInstaller = new TransactedInstaller();
                    AssemblyInstaller   assemblyInstaller   = new AssemblyInstaller(servicePath, cmdline);
                    transactedInstaller.Installers.Add(assemblyInstaller);
                    transactedInstaller.Uninstall(null);


                    while (ExistsService(serviceName) == true)
                    {
                        break;
                    }
                }
                else
                {
                    throw new Exception("卸载的服务不存在");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #19
0
        public static void Perform(bool install, string[] args)
        {
            Assembly myAssembly = System.Reflection.Assembly.GetEntryAssembly();

            using (AssemblyInstaller installer = new AssemblyInstaller(myAssembly, args))
            {
                IDictionary state = new Hashtable();
                installer.UseNewContext = true;
                if (install)
                {
                    try
                    { // install service
                        installer.Install(state);
                        installer.Commit(state);
                    }
                    catch
                    {
                        try
                        {
                            installer.Rollback(state);
                        }
                        catch
                        {
                        }
                        throw;
                    }
                }
                else
                {
                    // uninstall service
                    installer.Uninstall(state);
                }
            }
        }
コード例 #20
0
 static void Install()
 {
     try
     {
         using (AssemblyInstaller installer = new AssemblyInstaller(typeof(ServiceEngine).Assembly, null))
         {
             IDictionary state = new Hashtable();
             try
             {
                 installer.UseNewContext = true;
                 installer.Install(state);
                 installer.Commit(state);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(Errors.Extract(ex));
                 //
                 try { installer.Rollback(state); }
                 catch { }
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(Errors.Extract(ex));
     }
     //
     Console.WriteLine("Press any key to continue...");
     Console.ReadKey(false);
 }
コード例 #21
0
        public void InstallService(Assembly assembly)
        {
            if (IsServiceInstalled())
            {
                return;
            }

            using (AssemblyInstaller installer = GetInstaller(assembly))
            {
                IDictionary state = new Hashtable();
                try
                {
                    installer.Install(state);
                    installer.Commit(state);
                    installer.Dispose();
                }
                catch
                {
                    try
                    {
                        installer.Rollback(state);
                        installer.Dispose();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    throw;
                }
            }
        }
コード例 #22
0
        public Installation() : base()
        {
            #region Install on MSR.LST.Net.Rtp (a necessary dependency)
            AssemblyInstaller ai = new AssemblyInstaller();
            ai.UseNewContext = true;
            ai.Assembly      = Assembly.Load("MSR.LST.Net.Rtp");
            Installers.Add(ai);
            #endregion

            #region Install MDShowManager (if it is in the same directory)
            FileInfo   fi         = new FileInfo(Assembly.GetExecutingAssembly().Location);
            FileInfo[] foundFiles = fi.Directory.GetFiles("MDShowManager.dll");
            if (foundFiles.Length == 1)
            {
                ai = new AssemblyInstaller();
                ai.UseNewContext = true;
                ai.Path          = foundFiles[0].FullName;
                Installers.Add(ai);
            }
            #endregion

            #region Install Pipecleaner Agent Service (if it is in the same directory)
            fi         = new FileInfo(Assembly.GetExecutingAssembly().Location);
            foundFiles = fi.Directory.GetFiles("Pipecleaner Agent Service.exe");
            if (foundFiles.Length == 1)
            {
                ai = new AssemblyInstaller();
                ai.UseNewContext = true;
                ai.Path          = foundFiles[0].FullName;
                Installers.Add(ai);
            }
            #endregion
        }
コード例 #23
0
ファイル: BaseInstaller.cs プロジェクト: miller-a/atlas
        private AssemblyInstaller CreateInstaller(Assembly assembly)
        {
            var installer = new AssemblyInstaller(assembly, null)
            {
                UseNewContext = true
            };

            var serviceInstaller = new ServiceInstaller
            {
                DisplayName = DisplayName,
                Description = Description,
                ServiceName = ServiceName,
                StartType   = StartType
            };

            var serviceProcessInstaller = new ServiceProcessInstaller
            {
                Account  = Account,
                Password = Password,
                Username = Username
            };

            installer.Installers.Add(serviceProcessInstaller);
            installer.Installers.Add(serviceInstaller);
            return(installer);
        }
コード例 #24
0
 /// <summary>
 /// 安装服务
 /// </summary>
 private void btnInstall_Click(object sender, EventArgs e)
 {
     if (!Vaild())
     {
         return;
     }
     try
     {
         string[] cmdline         = { };
         string   serviceFileName = txtPath.Text.Trim();
         string   serviceName     = GetServiceName(serviceFileName);
         if (string.IsNullOrEmpty(serviceName))
         {
             txtTip.Text = "指定文件不是Windows服务!";
             return;
         }
         if (ServiceIsExisted(serviceName))
         {
             txtTip.Text = "要安装的服务已经存在!";
             return;
         }
         TransactedInstaller transactedInstaller = new TransactedInstaller();
         AssemblyInstaller   assemblyInstaller   = new AssemblyInstaller(serviceFileName, cmdline);
         assemblyInstaller.UseNewContext = true;
         transactedInstaller.Installers.Add(assemblyInstaller);
         transactedInstaller.Install(new System.Collections.Hashtable());
         txtTip.Text = "服务安装成功!";
     }
     catch (Exception ex)
     {
         txtTip.Text = ex.Message;
     }
 }
コード例 #25
0
        public static void Install(string[] args)
        {
            try
            {
                using (var installer = new AssemblyInstaller(typeof(InstallationManager).Assembly, args))
                {
                    IDictionary state = new Hashtable();

                    // Install the service
                    installer.UseNewContext = true;
                    try
                    {
                        installer.Install(state);
                        installer.Commit(state);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);

                        try
                        {
                            installer.Rollback(state);
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception.Message);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Failed to install service. Error: " + exception.Message);
            }
        }
コード例 #26
0
 public void UninstallService()
 {
     if (!IsInstalled())
     {
         return;
     }
     try
     {
         using (AssemblyInstaller installer = GetInstaller())
         {
             IDictionary state = new Hashtable();
             try
             {
                 installer.Uninstall(state);
             }
             catch
             {
                 throw;
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #27
0
 public void UninstallTheService()
 {
     try
     {
         IDictionary state = new Hashtable();
         using (AssemblyInstaller installer = new AssemblyInstaller(InstallersAssembly, Args))
         {
             installer.UseNewContext = true;
             try
             {
                 installer.Uninstall(state);
                 InternalTrace("Uninstalled the service");
             }
             catch (Exception uninstallException)
             {
                 try
                 {
                     installer.Rollback(state);
                     InternalTrace("Rolledback the service uninstallation because:" + uninstallException.ToString());
                 }
                 catch { }
                 throw;
             }
         }
     }
     catch (Exception exception)
     {
         InternalTrace("Failed to uninstall the service " + exception.ToString());
     }
 }
コード例 #28
0
        public void InstallService()
        {
            if (IsInstalled())
            {
                return;
            }

            try
            {
                using (AssemblyInstaller installer = GetInstaller())
                {
                    IDictionary state = new Hashtable();
                    try
                    {
                        installer.Install(state);
                        installer.Commit(state);
                    }
                    catch
                    {
                        try
                        {
                            installer.Rollback(state);
                        }
                        catch { }
                        throw;
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #29
0
 private static void UninstallService()
 {
     if (!IsInstalled())
     {
         return;
     }
     try
     {
         using (AssemblyInstaller installer = GetInstaller())
         {
             IDictionary state = new Hashtable();
             try
             {
                 installer.Uninstall(state);
             }
             catch
             {
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         logger.ErrorFormat(" Error occurred in uninstalling service " + ex.Message);
         throw;
     }
 }
コード例 #30
0
ファイル: MachineNode.cs プロジェクト: yuexiaoyun/cloudb
        private static void AfterInstall(object sender, InstallEventArgs e)
        {
            AssemblyInstaller installer = (AssemblyInstaller)sender;

#if WINDOWS
            RegistryKey system            = Registry.LocalMachine.OpenSubKey("System");
            RegistryKey currentControlSet = system.OpenSubKey("CurrentControlSet");
            RegistryKey servicesKey       = currentControlSet.OpenSubKey("Services");
            RegistryKey serviceKey        = servicesKey.OpenSubKey(MachineNodeService.Name, true);

            string options = null;
            if (installer.Context.Parameters.ContainsKey("AdditionalOptions"))
            {
                options = installer.Context.Parameters["AdditionalOptions"];
            }

            StringBuilder sb = new StringBuilder((string)serviceKey.GetValue("ImagePath"));
            sb.Append(" ");
            sb.Append("-service");
            if (!String.IsNullOrEmpty(options))
            {
                sb.Append(" ");
                sb.Append(options);
            }

            serviceKey.SetValue("ImagePath", sb.ToString());
#endif
        }
コード例 #31
0
ファイル: versaplexd-svc.cs プロジェクト: apenwarr/versaplex
    static void Install()
    {
	// We might already be installed, so uninstall first.  But we might
	// *not* be installed, which is an error, so ignore it.
	try { Uninstall(); } catch { }
	
	using (var inst 
	       = new AssemblyInstaller(typeof(VersaService).Assembly,
				       new string[] { "/logfile" }))
	{
	    inst.UseNewContext = true;

	    IDictionary state = new Hashtable();
	    try
	    {
		inst.Install(state);
		inst.Commit(state);
	    }
	    catch
	    {
		try { inst.Rollback(state); } catch { }
		throw;
	    }
	}
	
	new ServiceController(VersaServiceInstaller.servname).Start();
    }
コード例 #32
0
ファイル: versaplexd-svc.cs プロジェクト: apenwarr/versaplex
    static void Uninstall()
    {
	using (var inst 
	       = new AssemblyInstaller(typeof(VersaService).Assembly,
				       new string[] { "/logfile" }))
	{
	    inst.UseNewContext = true;
	    inst.Uninstall(new Hashtable());
	}
    }
コード例 #33
0
ファイル: InstallHelper.cs プロジェクト: abel/sinan
 public static void Install(string[] args)
 {
     bool flag = false;
     bool flag2 = false;
     TransactedInstaller installerWithHelp = new TransactedInstaller();
     bool flag3 = false;
     try
     {
         ArrayList list = new ArrayList();
         for (int i = 0; i < args.Length; i++)
         {
             if (args[i].StartsWith("/", StringComparison.Ordinal) || args[i].StartsWith("-", StringComparison.Ordinal))
             {
                 string strA = args[i].Substring(1);
                 if ((string.Compare(strA, "u", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(strA, "uninstall", StringComparison.OrdinalIgnoreCase) == 0))
                 {
                     flag = true;
                 }
                 else if ((string.Compare(strA, "?", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(strA, "help", StringComparison.OrdinalIgnoreCase) == 0))
                 {
                     flag3 = true;
                 }
                 else if (string.Compare(strA, "AssemblyName", StringComparison.OrdinalIgnoreCase) == 0)
                 {
                     flag2 = true;
                 }
                 else
                 {
                     list.Add(args[i]);
                 }
             }
             else
             {
                 string name = args[i];
                 ServiceName = name;
                 Assembly assembly = Assembly.GetExecutingAssembly();
                 AssemblyInstaller installer2 = new AssemblyInstaller(assembly, (string[])list.ToArray(typeof(string)));
                 installerWithHelp.Installers.Add(installer2);
             }
         }
         if (flag3 || (installerWithHelp.Installers.Count == 0))
         {
             flag3 = true;
             installerWithHelp.Installers.Add(new AssemblyInstaller());
             throw new InvalidOperationException("GetHelp(installerWithHelp)");
         }
         installerWithHelp.Context = new InstallContext("InstallUtil.InstallLog", (string[])list.ToArray(typeof(string)));
     }
     catch (Exception exception2)
     {
         if (flag3)
         {
             throw exception2;
         }
         throw new InvalidOperationException("InstallInitializeException");
     }
     try
     {
         string str2 = installerWithHelp.Context.Parameters["installtype"];
         if ((str2 != null) && (string.Compare(str2, "notransaction", StringComparison.OrdinalIgnoreCase) == 0))
         {
             string str3 = installerWithHelp.Context.Parameters["action"];
             if ((str3 != null) && (string.Compare(str3, "rollback", StringComparison.OrdinalIgnoreCase) == 0))
             {
                 installerWithHelp.Context.LogMessage("InstallRollbackNtRun");
                 for (int j = 0; j < installerWithHelp.Installers.Count; j++)
                 {
                     installerWithHelp.Installers[j].Rollback(null);
                 }
             }
             else if ((str3 != null) && (string.Compare(str3, "commit", StringComparison.OrdinalIgnoreCase) == 0))
             {
                 installerWithHelp.Context.LogMessage("InstallCommitNtRun");
                 for (int k = 0; k < installerWithHelp.Installers.Count; k++)
                 {
                     installerWithHelp.Installers[k].Commit(null);
                 }
             }
             else if ((str3 != null) && (string.Compare(str3, "uninstall", StringComparison.OrdinalIgnoreCase) == 0))
             {
                 installerWithHelp.Context.LogMessage("InstallUninstallNtRun");
                 for (int m = 0; m < installerWithHelp.Installers.Count; m++)
                 {
                     installerWithHelp.Installers[m].Uninstall(null);
                 }
             }
             else
             {
                 installerWithHelp.Context.LogMessage("InstallInstallNtRun");
                 for (int n = 0; n < installerWithHelp.Installers.Count; n++)
                 {
                     installerWithHelp.Installers[n].Install(null);
                 }
             }
         }
         else if (!flag)
         {
             IDictionary stateSaver = new Hashtable();
             installerWithHelp.Install(stateSaver);
         }
         else
         {
             installerWithHelp.Uninstall(null);
         }
     }
     catch (Exception exception3)
     {
         throw exception3;
     }
 }