コード例 #1
0
 public void Process()
 {
     if (!processManager.IsCurrentProcessElevated())
     {
         Logger.Information("Current process is not elevated which is needed for installation. Starting as elevated process.");
         processManager.LaunchFileWithAdministrativeRights(
             processManager.GetCurrentProcessFilePath());
     }
     else
     {
         Logger.Information("Current process is elevated.");
         Logger.Information("Running installation procedure.");
         Install();
     }
 }
コード例 #2
0
        public async Task ProcessAsync(string[] arguments)
        {
            var targetDirectory = fileManager.PrepareIsolatedFolder();
            await fileManager.DeleteDirectoryIfExistsAsync(targetDirectory);

            processManager.LaunchFile(processManager.GetCurrentProcessFilePath());
        }
コード例 #3
0
        void Install()
        {
            maintenanceWindow.Show("Installing Shapeshifter ...");

            PrepareInstallDirectory();
            InstallToInstallDirectory();

            ConfigureDefaultSettings();

            logger.Information("Default settings have been configured.");

            LaunchInstalledExecutable(
                processManager.GetCurrentProcessFilePath());

            logger.Information("Launched installed executable.");
        }
コード例 #4
0
        public async Task ProcessAsync(string[] arguments)
        {
            var updateIndex     = Array.IndexOf(arguments, "postinstall");
            var targetDirectory = arguments[updateIndex + 1];

            logger.Information("Attempting to delete file {file}.", targetDirectory);
            await fileManager.DeleteFileIfExistsAsync(targetDirectory);

            logger.Verbose("Old file has been cleaned up.");

            processManager.LaunchFileWithAdministrativeRights(processManager.GetCurrentProcessFilePath());
        }
コード例 #5
0
 void Install()
 {
     processManager.LaunchFileWithAdministrativeRights(
         processManager.GetCurrentProcessFilePath(),
         "install");
 }