public static void RunProperMode(Command command)
        {
            if (command.ContainsCommandArg("/Uninstall"))   // Are we in uninstall-mode?
            {
                UninstallHelper uninstallHelper = new UninstallHelper();
                uninstallHelper.RunUninstall();
            }
            else if (command.ContainsCommandArg("-silentinstall"))
            {
                Globals.InPortableMode  = command["-portable"].ToBool();
                Globals.IsSilentInstall = true;
                NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "www.pmuniverse.net-installer", PipeDirection.InOut, PipeOptions.None, System.Security.Principal.TokenImpersonationLevel.Impersonation);
                pipeClient.Connect();
                Pipes.StreamString clientStream = new Pipes.StreamString(pipeClient);
                Globals.SilentInstallCommunicationPipeStream = clientStream;
                Globals.SilentInstallCommunicationPipe       = pipeClient;
                installWaitEvent = new ManualResetEvent(false);
                Installer installer = new Installer(command);
                installer.InstallComplete += new EventHandler(installer_InstallComplete);
                installer.Install(clientStream);

                installWaitEvent.WaitOne();

                clientStream.WriteString("[InstallComplete]");

                pipeClient.WaitForPipeDrain();
                pipeClient.Close();

                System.Environment.Exit(0);
            }
            else
            {
                // There are no special command line arguments, run the installer in install mode
                // Let's check if we elevated ourselves
                if (!Globals.CommandLine.ContainsCommandArg("/skipwelcome") || !VistaSecurity.IsAdmin())
                {
                    // Show the welcome page
                    PageManager.ActivePage = new Pages.pgeWelcome();
                }
                else
                {
                    // Show the license page
                    PageManager.ActivePage = new Pages.pgeLicense();
                }
            }
        }
Exemple #2
0
        private void LaunchProcess()
        {
            ProcessStartInfo processStartInfo = new ProcessStartInfo(PMU.Core.Environment.StartupPath, "-silentinstall -portable " + Globals.InPortableMode.ToIntString() + " " + Globals.Installer.CreateInstallationArgumentString());

            processStartInfo.UseShellExecute = true;
            if (VistaSecurity.IsAdmin() == false && Globals.InPortableMode == false)
            {
                // Start the process as an administrator
                processStartInfo.Verb = "runas";
            }

            try {
                Process process = Process.Start(processStartInfo);
            } catch (System.ComponentModel.Win32Exception) {
                System.Windows.Forms.MessageBox.Show("You have chosen to cancel the installation.");
                System.Environment.Exit(0);
            }
        }