From 0cc8852afa0f9420677358278fd1ed1ac46167ae Mon Sep 17 00:00:00 2001 From: Damian Maslanka Date: Tue, 20 Feb 2018 21:46:08 +0100 Subject: [PATCH] (GH-1397) Refactor. Fixed naming IsRepositoryRemote to repository_is_remote. Call .ToList() on GetPackages() to prevent warning from nugget. --- .../infrastructure.app/services/NugetService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index a3db321fae..b729394028 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -860,17 +860,17 @@ public ConcurrentDictionary get_outdated(ChocolateyConfig set_package_names_if_all_is_specified(config, () => { config.IgnoreDependencies = true; }); var packageNames = config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).or_empty_list_if_null().ToList(); - foreach (var packageName in packageNames) - { - var repository = packageManager.SourceRepository; + var repository = packageManager.SourceRepository; - bool isRemote = IsRepositoryRemote(repository); + bool isRemote = repository_is_remote(repository); + foreach (var packageName in packageNames) + { IPackage latestPackage; if (isRemote) { - latestPackage = repository.GetPackages().Where(x => x.Id.ToLower() == packageName && x.IsLatestVersion).SingleOrDefault(); + latestPackage = repository.GetPackages().Where(x => x.Id.ToLower() == packageName && x.IsLatestVersion).ToList().SingleOrDefault(); } else { @@ -920,7 +920,7 @@ public ConcurrentDictionary get_outdated(ChocolateyConfig return outdatedPackages; } - private bool IsRepositoryRemote(IPackageRepository repository) + private bool repository_is_remote(IPackageRepository repository) { bool isRemote; var aggregateRepo = repository as AggregateRepository;