protected override async Task ExecuteAsync(IPackage package, CancellationToken cancellationToken)
        {
            bool execute = true;

            if (Executing != null)
            {
                execute = await Executing();
            }

            if (execute)
            {
                IPackageContent packageContent = await package.GetContentAsync(cancellationToken);

                string pluginPath = Path.Combine(service.Path, package.Id);
                await packageContent.RemoveFromAsync(pluginPath, cancellationToken);

                // do not delete the plugin directory if it still contains files (e.g. data files)
                if (Directory.Exists(pluginPath) && !Directory.EnumerateFileSystemEntries(pluginPath).Any())
                {
                    Directory.Delete(pluginPath);
                }

                cancellationToken.ThrowIfCancellationRequested();

                service.Uninstall(package);
            }

            Completed?.Invoke();
        }
Exemple #2
0
        public void UnInstall()
        {
            Writer(writer => writer.AddPackageEntry("PluginA", new NuGetVersion("2.0.0"), NuGetFramework.AnyFramework));

            install.Uninstall(package.Object);

            Reader(reader =>
            {
                Assert.IsFalse(reader.GetPackages().Any(p => p.PackageIdentity.Id == package.Object.Id && p.PackageIdentity.Version.ToFullString() == package.Object.Version));
            });
        }
        public void UnInstall()
        {
            Writer(writer => writer.AddPackageEntry("PluginA", new NuGetVersion("2.0.0"), NuGetFramework.AnyFramework));

            install.Uninstall(package.Object);

            Reader(reader =>
            {
                Assert.IsFalse(reader.GetPackages().Any(p => string.Equals(p.PackageIdentity.Id, package.Object.Id, StringComparison.CurrentCultureIgnoreCase) && string.Equals(p.PackageIdentity.Version.ToFullString(), package.Object.Version, StringComparison.CurrentCultureIgnoreCase)));
            });
        }
Exemple #4
0
        protected override async Task ExecuteAsync(IPackage package, CancellationToken cancellationToken)
        {
            bool execute = true;

            if (Executing != null)
            {
                execute = await Executing();
            }

            if (execute)
            {
                IPackageContent packageContent = await package.GetContentAsync(cancellationToken);

                await packageContent.RemoveFromAsync(service.Path, cancellationToken);

                cancellationToken.ThrowIfCancellationRequested();

                service.Uninstall(package);
            }

            Completed?.Invoke();
        }
        protected override async Task ExecuteAsync(PackageUpdateViewModel package, CancellationToken cancellationToken)
        {
            bool execute = true;

            if (Executing != null)
            {
                execute = await Executing();
            }

            if (execute)
            {
                if (package.IsSelf && !selfUpdate.IsSelfUpdate)
                {
                    selfUpdate.Update(package.Target);
                    return;
                }

                IPackageContent packageContent = await package.Current.Model.GetContentAsync(cancellationToken);

                string pluginPath = Path.Combine(install.Path, package.Current.Id);
                await packageContent.RemoveFromAsync(pluginPath, cancellationToken);

                install.Uninstall(package.Current.Model);

                packageContent = await package.Target.GetContentAsync(cancellationToken);

                await packageContent.ExtractToAsync(pluginPath, cancellationToken);

                install.Install(package.Target);

                if (package.IsSelf)
                {
                    selfUpdate.RunNewInstance(package.Target);
                }
            }

            Completed?.Invoke();
        }
Exemple #6
0
 public async Task Execute(AppGetOption commandOptions)
 {
     await _installService.Uninstall((UninstallOptions)commandOptions);
 }