Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DownloadPackageAction"/> class.
 /// </summary>
 /// <param name="deploymentContext">The deployment context.</param>
 /// <param name="isUpdate"><see cref="DeploymentAction.IsUpdate"/></param>
 /// <param name="deploymentPackage">The associated package</param>
 /// <param name="nuGetEngine">NuGet engine to use</param>
 /// <param name="path">Download path</param>
 /// <seealso cref="DeploymentPackageInfo"/>
 /// <seealso cref="INuGetEngine"/>
 public DownloadPackageAction(DeploymentContext deploymentContext, bool isUpdate, DeploymentPackageInfo deploymentPackage,
                              INuGetEngine nuGetEngine, string path) : base(deploymentContext, isUpdate)
 {
     _nuGetEngine       = nuGetEngine;
     _path              = path;
     _deploymentPackage = deploymentPackage;
 }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="deploymentContext">Deployment context to use</param>
        /// <param name="deploymentStrategyProvider">Deployment strategy to use</param>
        /// <param name="transactionSource">Transactions factory</param>
        /// <param name="packagesFolderPath">Path to cache packages</param>
        /// <param name="remotePackagesSources">Remote package sources</param>
        /// <param name="packageDiscoverer">Package version resolver</param>
        /// <param name="packageDeployer">Package installer</param>
        /// <param name="localPackagesSources">Local package sources</param>
        internal DeploymentEngine(DeploymentContext deploymentContext,
                                  IDeploymentStrategyProvider deploymentStrategyProvider,
                                  IPackageDiscoverer packageDiscoverer,
                                  IPackageDeployer packageDeployer,
                                  IDeploymentTransactionSource transactionSource,
                                  string packagesFolderPath,
                                  ICollection <string> remotePackagesSources,
                                  ICollection <string> localPackagesSources)
        {
            DeploymentContext          = deploymentContext;
            DeploymentStrategyProvider = deploymentStrategyProvider;

            var extendedLocalPackageSources = localPackagesSources;

            if (string.IsNullOrWhiteSpace(packagesFolderPath))
            {
                PackagesFolderPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                DontCachePackages  = true;
            }
            else
            {
                PackagesFolderPath          = packagesFolderPath;
                extendedLocalPackageSources = localPackagesSources.Union(new[] { PackagesFolderPath }).ToList();
            }

            NuGetEngine = new NuGetEngine(deploymentContext, PackagesFolderPath, remotePackagesSources, extendedLocalPackageSources);

            PackageDiscoverer             = packageDiscoverer;
            PackageDiscoverer.NuGetEngine = NuGetEngine;

            PackageDeployer                            = packageDeployer;
            PackageDeployer.NuGetEngine                = NuGetEngine;
            PackageDeployer.DeploymentContext          = DeploymentContext;
            PackageDeployer.DeploymentStrategyProvider = DeploymentStrategyProvider;
            PackageDeployer.PackagesFolderPath         = PackagesFolderPath;

            TransactionSource = transactionSource;
        }