private string GetLastVersionPackage(string name, string nugetSourceUrl) { LastVersionNugetPackages lastVersionPackage = _nugetPackagesProvider.GetLastVersionPackages(name, nugetSourceUrl); return(lastVersionPackage?.Last.Version.ToString()); }
private IEnumerable <PackageForUpdate> GetPackagesForUpdate(IEnumerable <string> applicationPackagesNamesInNuget, IEnumerable <PackageInfo> applicationPackages, IEnumerable <NugetPackage> nugetPackages) { var packagesForUpdate = new List <PackageForUpdate>(); foreach (string applicationPackageNameInNuget in applicationPackagesNamesInNuget) { PackageInfo package = applicationPackages .First(pkg => pkg.Descriptor.Name == applicationPackageNameInNuget); if (!PackageVersion.TryParseVersion(package.Descriptor.PackageVersion, out PackageVersion packageVersion)) { continue; } LastVersionNugetPackages lastVersionNugetPackages = _nugetPackagesProvider.GetLastVersionPackages(applicationPackageNameInNuget, nugetPackages); if (lastVersionNugetPackages == null) { continue; } if (lastVersionNugetPackages.Last.Version > packageVersion) { packagesForUpdate.Add(new PackageForUpdate(lastVersionNugetPackages, package)); } } return(packagesForUpdate); }
public IEnumerable <PackageForUpdate> GetPackagesForUpdate(string nugetSourceUrl) { nugetSourceUrl.CheckArgumentNullOrWhiteSpace(nameof(nugetSourceUrl)); IEnumerable <PackageInfo> applicationPackages = _applicationPackageListProvider.GetPackages(); IEnumerable <string> appPackagesNames = applicationPackages .Select(pkg => pkg.Descriptor.Name) .Distinct(); IEnumerable <LastVersionNugetPackages> appPackagesNamesInNuget = _nugetPackagesProvider.GetLastVersionPackages(appPackagesNames, nugetSourceUrl); return(GetPackagesForUpdate(applicationPackages, appPackagesNamesInNuget)); }