Ejemplo n.º 1
0
 public static IPackageInfo Find(this ILookup<string, IPackageInfo> packages, PackageDependency dependency)
 {
     if (!packages.Contains(dependency.Name))
         return null;
     return (from package in packages[dependency.Name]
             where package.Version != null && dependency.IsFulfilledBy(package.Version)
             orderby package.Version descending
             select package).FirstOrDefault();
 }
Ejemplo n.º 2
0
        public static IEnumerable<IPackageInfo> FindAll(this ILookup<string, IPackageInfo> packages, PackageDependency dependency)
        {
            if (!packages.Contains(dependency.Name))
                return Enumerable.Empty<IPackageInfo>();

            return (from package in packages[dependency.Name]
                    where package.Version != null && dependency.IsFulfilledBy(package.Version)
                    orderby package.Version descending
                    select package).ToList();
        }
Ejemplo n.º 3
0
        public static IPackageInfo Find(this ILookup<string, IPackageInfo> packages, PackageDependency dependency)
        {
            if (!packages.Contains(dependency.Name))
                return null;

            var allMatchingPackages = from package in packages[dependency.Name]
                                      where package.Version != null && dependency.IsFulfilledBy(package.Version)
                                      orderby package.Version descending
                                      select package;

            // only remove nuked versions if it's not an exact match
            var bestMatching = allMatchingPackages.FirstOrDefault();

            if (bestMatching != null)
            {
                if (dependency.IsExactlyFulfilledBy(bestMatching.Version))
                    return bestMatching;
            }

            // remove any nuked versions before returning the best match
            return (from package in allMatchingPackages
                    where !package.Nuked
                    select package).FirstOrDefault();
        }