public ProgressReport(NugetStore store, NugetPackage package) { if (store == null) { throw new ArgumentNullException(nameof(store)); } this.store = store; version = package.Version.ToSemanticVersion().ToNormalizedString(); foreach (var progressProvider in store.SourceRepository.Repositories.OfType <IProgressProvider>()) { progressProvider.ProgressAvailable += OnProgressAvailable; } }
/// <summary> /// Uninstall <paramref name="package"/>, while still keeping the downloaded file in the cache. /// </summary> /// <remarks>It is safe to call it concurrently be cause we operations are done using the FileLock.</remarks> /// <param name="package">Package to uninstall.</param> public void UninstallPackage(NugetPackage package, ProgressReport progress) { using (GetLocalRepositoryLock()) { currentProgressReport = progress; try { manager.UninstallPackage(package.IPackage); // Every time a new package is installed, we are updating the common targets UpdateTargetsHelper(); } finally { currentProgressReport = null; } } }
/// <summary> /// Determines whether the <paramref name="other"/> object is equal to the current object. /// </summary> /// <param name="other">The object to compare against the current object.</param> /// <returns><c>true</c> if <paramref name="other"/> is equal to the current object, <c>false</c> otherwise.</returns> protected bool Equals(NugetPackage other) { return(Equals(packageMetadata, other.packageMetadata)); }
/// <summary> /// Add <paramref name="packageToTrack"/> to <paramref name="packagesOut"/> if not already inserted and remove it /// from <paramref name="packages"/>. Process is done recursiverly by adding first the dependencies of /// <paramref name="packages"/> before the remaining packages in <paramref name="packages"/>. /// </summary> /// <param name="packagesOut">List of packages processed so far.</param> /// <param name="packages">Set of packages remaining to be processed.</param> /// <param name="packageToTrack">Current package to check.</param> private void AddPackageRecursive(List <NugetPackage> packagesOut, HashSet <NugetPackage> packages, NugetPackage packageToTrack) { // Go first recursively with all dependencies resolved var dependencies = packageToTrack.DependencySets.SelectMany(deps => deps.Dependencies); foreach (var dependency in dependencies) { var nextPackage = packages.FirstOrDefault(p => p.Id == dependency.Id); if (nextPackage != null) { AddPackageRecursive(packagesOut, packages, nextPackage); } } // This package is now resolved, add it to the ordered list packagesOut.Add(packageToTrack); // Remove it from the list of packages to process packages.Remove(packageToTrack); }
/// <summary> /// Name of the directory containing the <paramref name="package"/>. /// </summary> /// <param name="package">Package to query.</param> /// <returns>The name of the package directory.</returns> public string GetPackageDirectory(NugetPackage package) { return(PathResolver.GetPackageDirectory(package.IPackage)); }
/// <summary> /// Installation path of <paramref name="package"/> /// </summary> /// <param name="package">Package to query.</param> /// <returns>The installation path if installed, null otherwise.</returns> public string GetInstallPath(NugetPackage package) { return(PathResolver.GetInstallPath(package.IPackage)); }