public static IPackage GetLatest(this ISource[] sources, PackageDependency dependency) { var packages = new List <ISource>(sources).Select(source => source.GetLatest(dependency)).Where(package => package != null).ToList(); if (packages.Count <= 1) { return(packages.FirstOrDefault()); } var highest = PackageVersion.HighestVersion(packages.Select(pkg => pkg.Version).ToArray()); return(packages.FirstOrDefault(pkg => pkg.Version == highest)); }
public static PackageVersion HighestVersionAvailableOf(string packageId) { return(PackageVersion.HighestVersion(VersionsAvailableOf(packageId).ToArray())); }
public static PackageVersion HighestVersionMatching(this ISource source, PackageDependency dependency) { var packages = source.GetPackagesMatchingDependencies(dependency); return(PackageVersion.HighestVersion(packages.Select(pkg => pkg.Version).ToArray())); }
public static PackageVersion HighestVersionAvailableOf(string packageId, List <LocalPackage> packages) { return(PackageVersion.HighestVersion(VersionsAvailableOf(packageId, packages).ToArray())); }
public static PackageVersion HighestVersionAvailableOf(this ISource source, string id) { return(PackageVersion.HighestVersion(source.VersionsAvailableOf(id).ToArray())); }