示例#1
0
        private static void Project_BeforeInstall(SetupEventArgs e)
        {
            if (!e.IsInstalling)
            {
                try
                {
                    var exeString = e.InstallDir + acadTrustedLoactionsExe;
                    var arg       = $"-t remove -p \"{e.InstallDir + "..."}\"";

                    var proc = new Process
                    {
                        StartInfo = new ProcessStartInfo
                        {
                            FileName               = exeString,
                            Arguments              = arg,
                            UseShellExecute        = false,
                            RedirectStandardOutput = false,
                            CreateNoWindow         = true
                        }
                    };

                    proc.Start();
                }
                catch (Exception ex)
                {
                    // We return success here because we want the uninstall
                    // process to continue If we stop here the application will
                    // become irremovable.
                    Debug.WriteLine(ex.Message);
                    System.Windows.MessageBox.Show("Removal failed!");
                    e.Result = ActionResult.Success;
                }
            }
        }
示例#2
0
 static void Msi_BeforeInstall(SetupEventArgs e)
 {
     if (!e.IsUISupressed && !e.IsUninstalling)
     {
         MessageBox.Show(e.ToString(), "BeforeInstall");
     }
 }
示例#3
0
    private void project_AfterInstall(SetupEventArgs e)
    {
        var errorMessage = GetOdtErrorMessage();

        if (e.IsInstalling)
        {
            if (errorMessage != null)
            {
                e.Result = ActionResult.Success;
                return;
            }
            else
            {
                e.Result = ActionResult.Success;
            }
        }
        else if (e.IsRepairing)
        {
            RepairOffice(e);
        }
        else if (e.IsUninstalling)
        {
            //VerifyOfficeUninstalled(e);
            e.Result = ActionResult.Success;
        }
        else
        {
            e.Result = ActionResult.Success;
        }
    }
示例#4
0
    private void project_Load(SetupEventArgs e)
    {
        if (Directory.Exists(@"C:\Windows\Temp\OfficeProPlus"))
        {
            Directory.Delete(@"C:\Windows\Temp\OfficeProPlus", true);
        }
        string launchLocation = e.MsiFile;
        string officeFolder   = "";

        foreach (var currentDirectory in Directory.GetDirectories(launchLocation.Substring(0, launchLocation.LastIndexOf(@"\"))))
        {
            if (currentDirectory.ToLower().EndsWith("office"))
            {
                officeFolder = currentDirectory;
            }
        }
        if (!string.IsNullOrEmpty(officeFolder))
        {
            //copy files to install location
            CopyFolder(new DirectoryInfo(officeFolder), new DirectoryInfo(@"C:\Windows\Temp\OfficeProPlus\Office"));
        }

        if (e.IsUISupressed)
        {
        }
    }
示例#5
0
        private static void Project_AfterInstall(SetupEventArgs e)
        {
            if (e.IsUpgrading)
            {
                return;
            }

            if (e.IsUninstalling)
            {
                return;
            }

            var connectionString = e.Data[Properties.ConnectionString.PropertyName];

            try
            {
                _sqlManager.CreateDatabase(connectionString);
                var processToStart = Path.Combine(e.InstallDir, "migrate.exe");
                _sqlManager.ApplyMigrations(processToStart);
            }
            catch (Exception ex)
            {
                e.Session.Log(ex.ToString());
                NotificationManager.ShowErrorMessage(ex.Message,
                                                     isWizardInstallation: IsWizardInstallationMode(e.Data));

                e.Result = ActionResult.Failure;
                return;
            }
        }
示例#6
0
    public void VerifyOfficeUninstalled(SetupEventArgs e)
    {
        string       officePath = null;
        const string regPath    = @"SOFTWARE\Microsoft\Office\ClickToRun\Configuration";

        try
        {
            var officeRegKey = Registry.LocalMachine.OpenSubKey(regPath);
            if (officeRegKey != null)
            {
                officePath = officeRegKey.GetValue("ClientFolder").ToString();
            }
            else
            {
                officePath = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder") ??
                             RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder");
            }
        }
        catch { }

        if (!string.IsNullOrEmpty(officePath))
        {
            e.Result = ActionResult.Failure;
            return;
        }

        e.Result = ActionResult.Success;
    }
示例#7
0
 static void Msi_BeforeInstall(SetupEventArgs e)
 {
     if (e.IsInstalling)
     {
         MessageBox.Show(e.ToString(), "BeforeInstall");
     }
 }
示例#8
0
 static void Msi_Load(SetupEventArgs e)
 {
     if (!e.IsUISupressed && !e.IsUninstalling)
     {
         MessageBox.Show(e.ToString(), "Load");
     }
 }
示例#9
0
 private static void Msi_UILoaded(SetupEventArgs e)
 {
     if (e.IsInstalling)
     {
         try
         {
             //IS THIS WHERE I CAN SET THE DIRECTORIES????
             if (e.IsInstalling)
             {
                 e.Session["FEATURE1_INSTALL_PATH"] = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"Microsoft\MSEnvShared\Addins");
                 using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\AppEnv\14.0\Apps\ssms_13.0", false))
                 {
                     var path = key.GetValue("StubExePath") as string;
                     if (!string.IsNullOrEmpty(path))
                     {
                         path = IO.Path.Combine(IO.Path.GetDirectoryName(path), @"Extensions\My Company Test Product");
                         //IO.Directory.CreateDirectory(path);
                         e.Session["FEATURE2_INSTALL_PATH"] = path;
                     }
                     key.Close();
                 }
                 //MessageBox.Show("FEATURE1_INSTALL_PATH = " + e.Session["FEATURE1_INSTALL_PATH"]);
                 //MessageBox.Show("FEATURE2_INSTALL_PATH = " + e.Session["FEATURE2_INSTALL_PATH"]);
                 //MessageBox.Show(e.ToString(), "UILoaded");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
示例#10
0
 static void Msi_Load(SetupEventArgs e)
 {
     if (e.IsInstalling)
     {
         MessageBox.Show(e.ToString(), "Load");
     }
 }
示例#11
0
 static void Msi_AfterInstall(SetupEventArgs e)
 {
     if (!e.IsUISupressed && !e.IsUninstalling)
     {
         MessageBox.Show(e.ToString(), "AfterExecute");
     }
 }
示例#12
0
 static void Project_UIInitialized(SetupEventArgs e)
 {
     e.Session["INSTALLDIR"] = Registry.CurrentUser
                               .OpenSubKey(@"SOFTWARE\7-Zip", false)
                               .GetValue("Path")
                               .ToString();
     MessageBox.Show(e.Session["INSTALLDIR"]);
 }
示例#13
0
 static void msi_BeforeInstall(SetupEventArgs e)
 {
     //Note: the property will not be from UserNameDialog if MSI UI is suppressed
     if (e.Session["DOMAIN"] == null)
     {
         e.Session["DOMAIN"] = Environment.MachineName;
     }
 }
示例#14
0
    static void project_Load(SetupEventArgs e)
    {
        try
        {
            if (e.IsInstalling || e.IsUpgrading)
            {
                // "ALLUSERS" will be set to "2" if installing through UI, so the "MSIINSTALLPERUSER" property can be used so the user can choose install scope
                if (e.Session["ALLUSERS"] != "2")
                {
                    // If "ALLUSERS" is "1" or "", this is a quiet command line installation, and we need to set the right paths here, since the UI haven't.

                    if (e.Session["APPDIR"] != "")
                    {
                        // If "APPDIR" param was specified, just use that as is
                        e.Session["INSTALLDIR"] = e.Session["APPDIR"];
                    }
                    else if (e.Session["ALLUSERS"] == "")
                    {
                        // Install for current user
                        e.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Programs\Symphony\" + e.ProductName);
                    }
                    else
                    {
                        // Install for all users
                        e.Session["INSTALLDIR"] = e.Session["PROGRAMSFOLDER"] + @"\Symphony\" + e.ProductName;
                    }
                }

                // Try to close all running symphony instances before installing. Since we have started using the EndSession message to tell the app to exit,
                // we don't really need to force terminate anymore. But the older versions of SDA does not listen for the EndSession event, so we still need
                // this code to ensure older versions gets shut down properly.
                System.Diagnostics.Process.GetProcessesByName("Symphony").ForEach(p => {
                    if (System.IO.Path.GetFileName(p.MainModule.FileName) == "Symphony.exe")
                    {
                        if (!p.HasExited)
                        {
                            p.Kill();
                            p.WaitForExit();
                        }
                    }
                });
            }
        }
        catch (System.ComponentModel.Win32Exception ex)
        {
            // We always seem to get this specific exception triggered, but the application still close down correctly.
            // The exception description is "Only part of a ReadProcessMemory or WriteProcessMemory request was completed".
            // We ignore that specific exception, so as not to put false error outputs into the log.
            if (ex.NativeErrorCode != 299)
            {
                e.Session.Log("Error trying to close all Symphony instances: " + ex.ToString());
            }
        }
        catch (System.Exception ex)
        {
            e.Session.Log("Error trying to close all Symphony instances: " + ex.ToString());
        }
    }
    static void project_Load(SetupEventArgs e)
    {
        try
        {
            // "ALLUSERS" will be set to "2" if installing through UI, so the "MSIINSTALLPERUSER" property can be used so the user can choose install scope
            if (e.Session["ALLUSERS"] != "2")
            {
                // If "ALLUSERS" is "1" or "", this is a quiet command line installation, and we need to set the right paths here, since the UI haven't
                if (e.Session["ALLUSERS"] == "")
                {
                    // Install for current user
                    e.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Programs\Symphony\" + e.ProductName);
                }
                else
                {
                    // Install for all users
                    e.Session["INSTALLDIR"] = e.Session["PROGRAMSFOLDER"] + @"\Symphony\" + e.ProductName;
                }
            }

            // Try to close all running symphony instances before installing
            KillSymphonyProcesses();

            // When force terminating Symphony, sometimes this is detected as the renderer process crashing.
            // As this message would confuse users, we wait a short time and then kill all Symphony instances
            // again, which would ensure that the dialog about renderer crash will not be shown.

            KillSymphonyProcesses(); // Try again immediately, for fast systems which shows dialog quickly
            System.Threading.Thread.Sleep(500);
            KillSymphonyProcesses(); // Try yet again after half a second for slow systems which takes time to show dialog

            // Try to close all running symphony instances again
            System.Diagnostics.Process.GetProcessesByName("Symphony").ForEach(p => {
                if (System.IO.Path.GetFileName(p.MainModule.FileName) == "Symphony.exe")
                {
                    if (!p.HasExited)
                    {
                        p.Kill();
                        p.WaitForExit();
                    }
                }
            });
        }
        catch (System.ComponentModel.Win32Exception ex)
        {
            // We always seem to get this specific exception triggered, but the application still close down correctly.
            // The exception description is "Only part of a ReadProcessMemory or WriteProcessMemory request was completed".
            // We ignore that specific exception, so as not to put false error outputs into the log.
            if (ex.NativeErrorCode != 299)
            {
                e.Session.Log("Error trying to close all Symphony instances: " + ex.ToString());
            }
        }
        catch (System.Exception ex)
        {
            e.Session.Log("Error trying to close all Symphony instances: " + ex.ToString());
        }
    }
示例#16
0
        void CreateDataStore(SetupEventArgs setupEventArgs)
        {
            var objectSpaceProvider = setupEventArgs.SetupParameters.ObjectSpaceProvider as IXpandObjectSpaceProvider;

            if (objectSpaceProvider == null)
            {
                throw new NotImplementedException("WorldCreator ObjectSpaceProvider does not implement " + typeof(IXpandObjectSpaceProvider).FullName);
            }
        }
示例#17
0
文件: setup.cs 项目: brysmi/wixsharp
    //private static void ManagedUIShell_OnCurrentDialogChanged(IManagedDialog dialog)
    //{
    //}

    static void Project_AfterInstall(SetupEventArgs e)
    {
        //Debug.Assert(false);
        MessageBox.Show(e.Data["test"], "Project_AfterInstall");
        if (e.IsInstalling)
        {
            MessageBox.Show($"User '{Defaults.UserName}' with password '{e.Session.Property("PASSWORD")}' has been created");
        }
    }
示例#18
0
 private static void Project_AfterInstall(SetupEventArgs e)
 {
     MessageBox.Show("Is Uninstalling: " + e.IsUninstalling);
     if (e.IsUninstalling)
     {
         // e.IsUninstalling is always false if the uninstall is triggered via executing the msi again
         // and click remove in the maintenance dialog
     }
 }
示例#19
0
 static void msi_BeforeInstall(SetupEventArgs e)
 {
     MessageBox.Show(e.Session.Property("PASSWORD"), "msi_BeforeInstall");
     //Note: the property will not be from UserNameDialog if MSI UI is suppressed
     if (e.Session["DOMAIN"] == null)
     {
         e.Session["DOMAIN"] = Environment.MachineName;
     }
 }
        private void OnBuildSetup(object sender, SetupEventArgs setupEventArgs)
        {
            var b = setupEventArgs.Context.BuildSystem();

            if (b.IsRunningOnTeamCity)
            {
                var tc = b.TeamCity;
                tc.WriteStartBlock("Cake Build");
            }
        }
示例#21
0
        private void OnBuildSetup(object sender, SetupEventArgs e)
        {
            var b = e.Context.BuildSystem();

            if (b.IsRunningOnTravisCI)
            {
                var tr = b.TravisCI;
                tr.WriteStartFold(_buildMessage.ToFoldMessage());
            }
        }
示例#22
0
文件: setup.cs 项目: csuffyy/wixsharp
    static void project_UIInit(SetupEventArgs e)
    {
        e.Session["TOOLSDIR"] = @"C:\Temp\Doc";
        //set custom installdir
        //This event is fired before Wix# ManagedUI loaded (disabled for demo purposes)
        //e.Session["INSTALLDIR"] = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\7-Zip")
        //                                              .GetValue("Path")
        //                                              .ToString();

        SetEnvVersion(e.Session);
    }
示例#23
0
 static void project_AfterInstall(SetupEventArgs e)
 {
     if (!e.IsInstalled)
     {
         OnInstall(e.Session);
     }
     else
     {
         //OnUninstall(e.Session);
     }
 }
示例#24
0
 private static void Project_AfterInstall(SetupEventArgs e)
 {
     if (e.IsInstalling)
     {
         Process proc = new Process();
         proc.StartInfo.FileName  = $@"{Environment.ExpandEnvironmentVariables("%programfiles(x86)%")}\TopshelfWixSharp\TopshelfWixSharp.exe";
         proc.StartInfo.Arguments = "install start";
         proc.StartInfo.Verb      = "runas";
         proc.Start();
     }
 }
示例#25
0
    static void Project_UILoaded(SetupEventArgs e)
    {
        var msiFile = e.Session.Database.FilePath;

        // Simulate analyzing the runtime conditions with the message box.
        // Make a decision to show (or not) Licence dialog by injecting it in the Dialogs collection
        // if (MessageBox.Show("Do you want to inject 'Licence Dialog'?", "Wix#", MessageBoxButtons.YesNo) == DialogResult.Yes)
        //     e.ManagedUIShell.CurrentDialog.Shell.Dialogs.Insert(1, Dialogs.Licence);

        e.ManagedUI.OnCurrentDialogChanged += ManagedUIShell_OnCurrentDialogChanged;
    }
示例#26
0
文件: setup.cs 项目: Eun/WixSharp
    static void msi_AfterInstall(SetupEventArgs e)
    {
        if (!e.IsUninstalling && e.UILevel > 2)
        {
            string readme = io.Path.Combine(e.InstallDir, @"Docs\readme.txt");

            if (io.File.Exists(readme))
                Process.Start(readme);
            else
                MessageBox.Show("Readme.txt is not present. You may want to download it from the product website.", e.ProductName);
        }
    }
示例#27
0
        private static void Project_AfterInstall(SetupEventArgs e)
        {
            if (e.IsInstalling)
            {
                try
                {
                    // ADD my software folder to the trusted locations in C3D
                    var exeString = e.InstallDir + acadTrustedLoactionsExe;
                    var arg       = $"-t add -p \"{e.InstallDir + "..."}\"";
                    var proc      = new Process
                    {
                        StartInfo = new ProcessStartInfo
                        {
                            FileName               = exeString,
                            Arguments              = arg,
                            UseShellExecute        = false,
                            RedirectStandardOutput = true,
                            CreateNoWindow         = true
                        }
                    };

                    var sb = new StringBuilder(Environment.NewLine);
                    proc.Start();
                    while (!proc.StandardOutput.EndOfStream)
                    {
                        sb.AppendLine(proc.StandardOutput.ReadLine());
                    }

                    if (proc.ExitCode == 0)
                    {
                        NotepadHelper.ShowMessage(
                            title: "Installed",
                            message: "Application has been installed, you can now use it in AutoCAD."
                            + sb.ToString());
                    }
                    else
                    {
                        NotepadHelper.ShowMessage(
                            title: "Installed",
                            message: "Application has been installed, though we had some problems adding trusted locations to the registry."
                            + sb.ToString());
                    }
                }
                catch (Exception ex)
                {
                    // We return fail here because we want the uninstall process
                    // to stop and rollback Something went wrong, it needs to be fixed!
                    Debug.WriteLine(ex.Message);
                    System.Windows.MessageBox.Show("Installation failed!");
                    e.Result = ActionResult.Failure;
                }
            }
        }
示例#28
0
    static void project_UIInit(SetupEventArgs e)
    {
        MessageBox.Show(e.Session.GetMainWindow(), "Hello World! (CLR: v" + Environment.Version + ")", "Managed Setup - UIInit");
        e.Session["TOOLSDIR"] = @"C:\Temp\Doc";
        //set custom installdir
        //This event is fired before Wix# ManagedUI loaded (disabled for demo purposes)
        //e.Session["INSTALLDIR"] = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\7-Zip")
        //                                              .GetValue("Path")
        //                                              .ToString();

        SetEnvVersion(e.Session);
    }
示例#29
0
    static void msi_UILoaded(SetupEventArgs e)
    {
        //If required you can
        // - set the size of the shell view window
        // - scale the whole shell window and its content
        // - reposition controls on the current dialog
        // - subscribe to the current dialog changed event

        //e.ManagedUIShell.SetSize(700, 500);
        //e.ManagedUIShell.OnCurrentDialogChanged += ManagedUIShell_OnCurrentDialogChanged;
        //(e.ManagedUIShell.CurrentDialog asForm).Controls....
    }
示例#30
0
        private static void Project_BeforeInstall(SetupEventArgs e)
        {
            if (e.IsUninstalling)
            {
                Tasks.StopService("TopshelfWixSharp");

                Process proc = new Process();
                proc.StartInfo.FileName  = $@"{Environment.ExpandEnvironmentVariables("%programfiles(x86)%")}\TopshelfWixSharp\TopshelfWixSharp.exe";
                proc.StartInfo.Arguments = "uninstall";
                proc.StartInfo.Verb      = "runas";
                proc.Start();
            }
        }
示例#31
0
        private void BuildSetup(object sender, SetupEventArgs e)
        {
            var b = e.Context.BuildSystem();

            if (b.IsRunningOnPipelines())
            {
                e.Context.AzurePipelines().Commands.SetProgress(0, string.Empty);
                var g = e.Context.AzurePipelines()
                        .Commands.CreateNewRecord("Cake Build", "build", 0, new AzurePipelinesRecordData {
                    StartTime = DateTime.Now
                });
                _parentRecord = g;
            }
        }
示例#32
0
文件: setup.cs 项目: Eun/WixSharp
    static void project_Load(SetupEventArgs e)
    {
        try
        {
            SetEnvVErsion(e.Session);

            if (string.IsNullOrEmpty(e.Session["INSTALLDIR"])) //installdir is not set yet
            {
                string installDirProperty = e.Session.Property("WixSharp_UI_INSTALLDIR");
                string defaultinstallDir = e.Session.GetDirectoryPath(installDirProperty);

                e.Session["INSTALLDIR"] = System.IO.Path.Combine(defaultinstallDir, Environment.UserName);
            }
        }
        catch { }
        MessageBox.Show(e.ToString(), "Load " + e.Session["EnvVersion"]);
    }
示例#33
0
文件: setup.cs 项目: Eun/WixSharp
    static void msi_Load(SetupEventArgs e)
    {
        if (e.IsInstalling)
        {
            //pseudo validation
            if (Environment.MachineName.Length > 3)
            {
                string message = "Your PC is too fancy for this app!";
                e.Session.Log(message);

                if (e.UILevel > 4)
                    MessageBox.Show(message, e.ProductName +" "+e.UILevel);

                e.Result = ActionResult.Failure;
            }
        }
    }
示例#34
0
文件: setup.cs 项目: Eun/WixSharp
    static void CheckCompatibility(SetupEventArgs e)
    {
        //MessageBox.Show("Hello World! (CLR: v" + Environment.Version + ")", "Embedded Managed UI (" + ((IntPtr.Size == 8) ? "x64" : "x86") + ")");

        if (e.IsInstalling)
        {
            var conflictingProductCode = "{1D6432B4-E24D-405E-A4AB-D7E6D088C111}";

            if (AppSearch.IsProductInstalled(conflictingProductCode))
            {
                string msg = string.Format("Installed '{0}' is incompatible with this product.\n" +
                                           "Setup will be aborted.",
                                           AppSearch.GetProductName(conflictingProductCode) ?? conflictingProductCode);
                MessageBox.Show(msg, "Setup");
                e.Result = ActionResult.UserExit;
            }
        }
    }
示例#35
0
 void CreateDataStore(SetupEventArgs setupEventArgs) {
     var objectSpaceProvider = setupEventArgs.SetupParameters.ObjectSpaceProvider as IObjectSpaceProvider;
     if (objectSpaceProvider== null)
         throw new NotImplementedException("ObjectSpaceProvider does not implement " + typeof(IObjectSpaceProvider).FullName);
 }
示例#36
0
 void ApplicationOnSettingUp(object sender, SetupEventArgs setupEventArgs) {
     CreateDataStore(setupEventArgs);
 }
示例#37
0
文件: setup.cs 项目: Eun/WixSharp
 static void project_UIInit(SetupEventArgs e)
 {
     SetEnvVErsion(e.Session);
 }
示例#38
0
 void ApplicationOnSettingUp(object sender, SetupEventArgs setupEventArgs) {
     AssignSecurityEntities();
 }
示例#39
0
 void Package_OnSetupBegin(object sender, SetupEventArgs e)
 {
     BuildOutput.Add(string.Format("Generating executable {0}...",
     Path.Combine(e.SetupInfo.OutputDirectory, e.SetupInfo.OutputFileName)));
 }
 private void project_AfterInstall(SetupEventArgs e)
 {
     var errorMessage = GetOdtErrorMessage();
     if (e.IsInstalling)
     {
         if (errorMessage != null)
         {
             e.Result = ActionResult.Success;
             return;
         }
         else
         {
             e.Result = ActionResult.Success;  
         }
     }
     else if (e.IsRepairing)
     {
         RepairOffice(e);
     }
     else if (e.IsUninstalling)
     {
         //VerifyOfficeUninstalled(e);
         e.Result = ActionResult.Success;
     }
     else
     {
         e.Result = ActionResult.Success;
     }       
 }
示例#41
0
文件: setup.cs 项目: Eun/WixSharp
 static void project_AfterInstall(SetupEventArgs e)
 {
     MessageBox.Show(e.ToString(), "AfterExecute");
 }
示例#42
0
文件: setup.cs 项目: Eun/WixSharp
 static void project_BeforeInstall(SetupEventArgs e)
 {
     MessageBox.Show(e.ToString(), "BeforeInstall");
 }
    public void RepairOffice(SetupEventArgs e)
    {
        string officePath = null;

        const string regPath = @"SOFTWARE\Microsoft\Office\ClickToRun\Configuration";

        var officeRegKey = Registry.LocalMachine.OpenSubKey(regPath);
        if (officeRegKey != null)
        {
            officePath = officeRegKey.GetValue("ClientFolder").ToString();
        }
        else
        {
            officePath = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder") ??
                         RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder");
        }

        if (officePath == null)
        {
            e.Result = ActionResult.Success;
            return;
        }

        var officeFilePath = officePath + @"\OfficeClickToRun.exe";

        if (!System.IO.File.Exists(officeFilePath))
        {
            e.Result = ActionResult.Success;
            return;
        }

        var p = new Process
        {
            StartInfo = new ProcessStartInfo()
            {
                FileName = officeFilePath,
                Arguments = "scenario=Repair DisplayLevel=True",
                CreateNoWindow = true,
                UseShellExecute = false
            },
        };
        p.Start();
        p.WaitForExit();

        e.Result = ActionResult.Success;
    }
示例#44
0
 static void project_AfterExecute(SetupEventArgs e)
 {
     //Debugger.Launch();
     MessageBox.Show(e.ToString(), "AfterExecute");
 }
示例#45
0
 static void project_BeforeExecute(SetupEventArgs e)
 {
     MessageBox.Show(e.ToString(), "BeforeInstall");
     //e.Result = ActionResult.Failure;
     //e.Result = ActionResult.UserExit;
     //e.Result = Microsoft.Deployment.WindowsInstaller.ActionResult.UserExit;
 }
示例#46
0
 static void project_Load(SetupEventArgs e)
 {
     //Debugger.Launch();
     //e.Result = ActionResult.UserExit;
     MessageBox.Show(e.ToString(), "Load");
 }
    private void project_Load(SetupEventArgs e)
    {
        if (Directory.Exists(@"C:\Windows\Temp\OfficeProPlus"))
            Directory.Delete(@"C:\Windows\Temp\OfficeProPlus", true);
        string launchLocation = e.MsiFile;
        string officeFolder = "";
        foreach (var currentDirectory in Directory.GetDirectories(launchLocation.Substring(0, launchLocation.LastIndexOf(@"\"))))
        {
            if (currentDirectory.ToLower().EndsWith("office"))
            {
                officeFolder = currentDirectory;
            }
        }
        if (!string.IsNullOrEmpty(officeFolder))
        {
            //copy files to install location
            CopyFolder(new DirectoryInfo(officeFolder), new DirectoryInfo(@"C:\Windows\Temp\OfficeProPlus\Office"));
        }

        if (e.IsUISupressed)
        {
            
        }
    }
示例#48
0
文件: setup.cs 项目: Eun/WixSharp
 static void msi_BeforeInstall(SetupEventArgs e)
 {
     //Note: the property will not be from UserNameDialog if MSI UI is suppressed
     if (e.Session["DOMAIN"] == null)
         e.Session["DOMAIN"] = Environment.MachineName;
 }
示例#49
0
 void Package_OnSetupCompleted(object sender, SetupEventArgs e)
 {
     BuildOutput.Add(string.Format("Executable {0} Generated Successfully!",
     Path.Combine(e.SetupInfo.OutputDirectory, e.SetupInfo.OutputFileName)));
 }
示例#50
0
文件: setup.cs 项目: Eun/WixSharp
 static void msi_UILoaded(SetupEventArgs e)
 {
     //You can set the size of the shell view window if requred
     //e.ManagedUIShell.SetSize(700, 500);
 }
    public void VerifyOfficeUninstalled(SetupEventArgs e)
    {
        string officePath = null;
        const string regPath = @"SOFTWARE\Microsoft\Office\ClickToRun\Configuration";
        try
        {
            var officeRegKey = Registry.LocalMachine.OpenSubKey(regPath);
            if (officeRegKey != null)
            {
                officePath = officeRegKey.GetValue("ClientFolder").ToString();
            }
            else
            {
                officePath = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder") ??
                             RegistryWOW6432.GetRegKey32(RegHive.HKEY_LOCAL_MACHINE, regPath, "ClientFolder");
            }
        }
        catch { }

        if (!string.IsNullOrEmpty(officePath))
        {
            e.Result = ActionResult.Failure;
            return;
        }

        e.Result = ActionResult.Success;
    }