/// <summary> /// Gets all package sources. /// </summary> /// <param name="moduleCatalog">The module catalog.</param> /// <param name="allowParentPackageSources">if set to <c>true</c>, allow other packages sources fetched via the parent.</param> /// <returns>IEnumerable<IPackageSource>.</returns> public static IEnumerable <IPackageRepository> GetAllPackageRepositories(this INuGetBasedModuleCatalog moduleCatalog, bool allowParentPackageSources) { Argument.IsNotNull("moduleCatalog", moduleCatalog); var packageRepositories = new List <IPackageRepository>(); packageRepositories.AddRange(moduleCatalog.GetPackageRepositories()); if (allowParentPackageSources) { var compositeNuGetBasedModuleCatalog = moduleCatalog.Parent as CompositeNuGetBasedModuleCatalog; if (compositeNuGetBasedModuleCatalog != null) { var parentPackageRepositories = compositeNuGetBasedModuleCatalog.GetAllPackageRepositories(allowParentPackageSources).ToList(); // Reverse so we have the first parent first and the final parent last parentPackageRepositories.Reverse(); foreach (var parentPackageRepository in parentPackageRepositories) { if (!packageRepositories.Contains(parentPackageRepository)) { packageRepositories.Add(parentPackageRepository); } } } } return(packageRepositories); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteInstallPackageRequest" /> class. /// </summary> /// <param name="moduleCatalog">The module catalog.</param> /// <param name="package">The package.</param> /// <param name="assemblyFileRef"></param> /// <exception cref="System.ArgumentNullException">The <paramref name="moduleCatalog" /> is <c>null</c>.</exception> /// <exception cref="System.ArgumentNullException">The <paramref name="package" /> is <c>null</c>.</exception> public RemoteInstallPackageRequest(INuGetBasedModuleCatalog moduleCatalog, IPackage package, string assemblyFileRef) : base(assemblyFileRef) { Argument.IsNotNull(() => moduleCatalog); Argument.IsNotNull(() => package); _moduleCatalog = moduleCatalog; Package = package; }
/// <summary> /// The NuGetBasedModuleCatalogParentChildBehavior constructor. /// </summary> /// <exception cref="System.ArgumentNullException">The <paramref name="moduleCatalog"/> is <c>null</c>.</exception> public NuGetBasedModuleCatalogParentChildBehavior(INuGetBasedModuleCatalog moduleCatalog) { Argument.IsNotNull(() => moduleCatalog); _moduleCatalog = moduleCatalog; OutputDirectory = "packages"; PackagedModuleIdFilterExpression = string.Empty; AllowPrereleaseVersions = false; IgnoreDependencies = true; }