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();
        }
Пример #2
0
        protected override async Task ExecuteAsync(IPackage package, CancellationToken cancellationToken)
        {
            IPackageContent packageContent = await package.GetContentAsync(cancellationToken);

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

            await packageContent.ExtractToAsync(service.Path, cancellationToken);
        }
Пример #3
0
        protected override async Task ExecuteAsync(IPackage package, CancellationToken cancellationToken)
        {
            IPackageContent packageContent = await package.GetContentAsync(cancellationToken);

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

            await packageContent.ExtractToAsync(pluginPath, cancellationToken);
        }
Пример #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();
        }