/// <summary>
        /// Executes the action under the specified transaction.
        /// </summary>
        /// <param name="transaction">The transaction.</param>
        /// <seealso cref="IDeploymentTransaction" />
        public override void Execute(IDeploymentTransaction transaction)
        {
            _nuGetEngine.InstallPackage(_deploymentPackage.Match, _path).GetAwaiter().GetResult();
            _deploymentPackage.PackagePath = _nuGetEngine.GetPackageTargetPath(_deploymentPackage.Match.Library.Name,
                                                                               _deploymentPackage.Match.Library.Version, _path);

            RaiseDeploymentEvent(new AfterPackageDownloadedEvent {
                PackagePath = _deploymentPackage.PackagePath
            }, _deploymentPackage.Id);
            Info($"{_deploymentPackage.Id} downloaded");
        }
        /// <summary>
        /// Executes the action under the specified transaction.
        /// </summary>
        /// <param name="transaction">The transaction.</param>
        /// <seealso cref="IDeploymentTransaction" />
        public override void Execute(IDeploymentTransaction transaction)
        {
            var files = DeploymentContext.ProductConfigurationProvider.GetInstalledFiles(_packageId, true);

            var deleteEvent = new BeforePackageUninstalledEvent();

            deleteEvent.FilesToDelete.AddRange(files);
            RaiseDeploymentEvent(deleteEvent, _packageId);

            foreach (var file in deleteEvent.FilesToDelete)
            {
                transaction.DeleteFile(file);
            }

            DeploymentContext.ProductConfigurationProvider.RemovePackage(_packageId);
            transaction.TrackDeletedPackage(_packageId);

            RaiseDeploymentEvent(new AfterPackageUninstalledEvent(), _packageId);
            Info($"{_packageId} uninstalled");
        }
        /// <summary>
        /// Executes the action under the specified transaction.
        /// </summary>
        /// <param name="transaction">The transaction.</param>
        /// <seealso cref="IDeploymentTransaction" />
        public override void Execute(IDeploymentTransaction transaction)
        {
            var files          = _deploymentStrategy.GetPackageFiles(_deploymentPackage.Id, _deploymentPackage.PackagePath).ToList();
            var installedFiles = new List <PackageFileInfo>();

            var e = new BeforePackageInstalledEvent();

            e.FilesToInstall.AddRange(files);
            RaiseDeploymentEvent(e, _deploymentPackage.Id);

            var productPathLength = DeploymentContext.ProductPath.Length;

            foreach (var file in e.FilesToInstall)
            {
                if (file.Action == FileAction.Copy)
                {
                    transaction.InstallFile(file);

                    var filePath = file.TargetFileName;
                    if (filePath.StartsWith(DeploymentContext.ProductPath))
                    {
                        filePath = filePath.Remove(0, productPathLength).TrimStart('/', '\\');
                    }

                    installedFiles.Add(new PackageFileInfo(filePath));
                }
                else if (file.Action == FileAction.Delete)
                {
                    transaction.DeleteFile(new PackageFileInfo(file.TargetFileName));
                }
            }

            var cfg = _packageConfigProvider.GetPackageConfiguration(_deploymentPackage.Id, _deploymentPackage.PackagePath);

            transaction.TrackInstalledPackage(cfg, installedFiles);

            RaiseDeploymentEvent(new AfterPackageInstalledEvent(), _deploymentPackage.Id);
            Info($"{_deploymentPackage.Id} installed");
        }
 /// <summary>
 /// Executes the action under the specified transaction.
 /// </summary>
 /// <param name="transaction">The transaction.</param>
 /// <seealso cref="IDeploymentTransaction"/>
 public abstract void Execute(IDeploymentTransaction transaction);