Exemplo n.º 1
0
        private string GetLastVersionPackage(string name, string nugetSourceUrl)
        {
            LastVersionNugetPackages lastVersionPackage =
                _nugetPackagesProvider.GetLastVersionPackages(name, nugetSourceUrl);

            return(lastVersionPackage?.Last.Version.ToString());
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        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));
        }