Exemple #1
0
        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);
        }
Exemple #2
0
        private string GetLastVersionPackage(string name, string nugetSourceUrl)
        {
            LastVersionNugetPackages lastVersionPackage =
                _nugetPackagesProvider.GetLastVersionPackages(name, nugetSourceUrl);

            return(lastVersionPackage?.Last.Version.ToString());
        }