protected void PerformRemove()
 {
     using (var manager = new MaintenanceManager(TargetDir, Handler, MachineWide, Portable))
     {
         Log.Info($"Using Zero Install instance at '{Locations.InstallBase}' to remove '{TargetDir}'");
         manager.Remove();
     }
 }
 private void PerformDeploy([NotNull] string targetDir)
 {
     using (var manager = new MaintenanceManager(targetDir, Handler, _machineWide, _portable))
     {
         Log.Info($"Deploying Zero Install from '{Locations.InstallBase}' to '{targetDir}'");
         manager.Deploy();
     }
 }
예제 #3
0
        /// <summary>
        /// Deploys a Zero Install instance to this machine.
        /// </summary>
        /// <param name="machineWide"><c>true</c> to deploy to a location for all users; <c>false</c> to deploy to a location for the current user only.</param>
        /// <returns>The director Zero Install was deployed to.</returns>
        private string DeployInstance(bool machineWide)
        {
            string programFiles = machineWide
                ? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Programs");
            string installLocation = Path.Combine(programFiles, "Zero Install");

            Log.Info("Deploying Zero Install to " + installLocation);
            using (var manager = new MaintenanceManager(installLocation, Handler, machineWide, portable: false))
                manager.Deploy();
            Log.Warn(Resources.Added0installToPath + Environment.NewLine + Resources.ReopenTerminal);

            return installLocation;
        }
            /// <summary>
            /// Deploys a portable copy of Zero Install to a temp directory and delegates the actual removal of the current instance to this copy.
            /// </summary>
            private void DelegateToTempCopy()
            {
                string tempDir = FileUtils.GetTempDirectory("0install-remove");
                using (var manager = new MaintenanceManager(tempDir, Handler, machineWide: false, portable: true))
                    manager.Deploy();

                string assembly = Path.Combine(tempDir, ProgramUtils.GuiAssemblyName ?? "0install");

                var args = new[] {MaintenanceMan.Name, RemoveHelper.Name, Locations.InstallBase};
                if (Handler.Verbosity == Verbosity.Batch) args = args.Append("--batch");
                if (Handler.Background) args = args.Append("--background");

                ProcessUtils.Assembly(assembly, args).Start();
            }