public static int UninstallMain(UninstallOptions opts) { try { if (opts.Architecture != null) { Autodetector.Architecture = (Architecture)Enum.Parse(typeof(Architecture), opts.Architecture); } var installer = new InstallerFrontend(InstallerFrontend.InstallerOptions.None); var path = opts.Executable; if (path == null) { path = Autodetector.ExePath; } if (path == null) { Logger.Error($"Failed to autodetect an EtG installation - please use the '--executable' option to specify the location of {Autodetector.ExeName}"); return(1); } installer.Uninstall(path); return(0); } catch (Exception e) { _WriteError(e); return(1); } }
private UninstallResult UninstallPackage( CatalogPackage package, UninstallOptions options) { string activity = string.Format( Utilities.ResourceManager.GetString("ProgressRecordActivityUninstalling"), package.Name); var operation = PackageManager.Value.UninstallPackageAsync(package, options); WriteProgressAdapter adapter = new (this); operation.Progress = (context, progress) => { adapter.WriteProgress(new ProgressRecord(1, activity, progress.State.ToString()) { RecordType = ProgressRecordType.Processing, }); }; operation.Completed = (context, status) => { adapter.WriteProgress(new ProgressRecord(1, activity, status.ToString()) { RecordType = ProgressRecordType.Completed, }); adapter.Completed = true; }; Console.CancelKeyPress += (sender, e) => { operation.Cancel(); }; adapter.Wait(); return(operation.GetResults()); }
/// <summary> /// Uninstalls a package from the local system. /// </summary> protected override void ProcessRecord() { this.GetPackageAndExecute(CompositeSearchBehavior.LocalCatalogs, (package, version) => { UninstallOptions options = this.GetUninstallOptions(version); UninstallResult result = this.UninstallPackage(package, options); this.WriteObject(result); }); }
public static string GenerateString(this UninstallOptions options) { string optionsString = string.Empty; if ((options & UninstallOptions.KeepData) != 0) { optionsString += " -k"; } return(optionsString); }
public async Task Uninstall(UninstallOptions uninstallOptions) { using (var context = _installerContextFactory.Build(uninstallOptions.PackageId, uninstallOptions.InteractivityLevel, PackageOperation.Uninstall)) { _logger.Info("Beginning uninstallation of " + uninstallOptions.PackageId); var uninstallRecords = await _novoClient.GetUninstall(context.InstallerRecords, uninstallOptions.PackageId); if (!uninstallRecords.Any()) { _logger.Warn("Couldn't find an installed package matching '{0}'", uninstallOptions.PackageId); return; } if (uninstallRecords.Count != 1) { _logger.Warn("Found more than one installed package for {0}", uninstallOptions.PackageId); foreach (var record in uninstallRecords) { _logger.Warn("{0} {1}", record.DisplayName, record.DisplayVersion); } return; } var uninstallRecord = uninstallRecords.Single(); var whisperer = _uninstallers().First(c => c.InstallMethod == uninstallRecord.InstallMethod); context.Whisperer = whisperer; whisperer.InitUninstaller(uninstallRecord); _unlocker.UnlockFolder(uninstallRecord.InstallationPath, uninstallRecord.InstallMethod); try { context.Process = RunInstaller(uninstallOptions.InteractivityLevel, new PackageManifest { Id = uninstallOptions.PackageId }, whisperer); } catch (InstallerException ex) { context.Exception = ex; throw; } } }
public async Task Uninstall(UninstallOptions opts) { await Browser.UpdatePackageCache(); foreach (var packageName in opts.Packages) { var package = Browser.FindPackage(new Dependency(new Dependency.IndividualDependency { Package = packageName, Comparer = Comparer.NoOp, Version = "" })); if (package == null) { Logger.Warn($"Could not find package '{packageName}'"); continue; } await package.Uninstall(opts.Sysroot); } }
public async Task Uninstall(string package, UninstallOptions options = UninstallOptions.None, CancellationToken cancellationToken = default(CancellationToken)) { await new Adb(this, "uninstall {0} {1}", options.GenerateString(), package).RunAsync(cancellationToken: cancellationToken).ConfigureAwait(false); }
internal static int RunUnregistAndeReturnExitCode(UninstallOptions opts) { throw new NotImplementedException(); }