예제 #1
0
        internal bool FindViaName(PackageProvider packageProvider, string name)
        {
            var found = false;

            using (var packages = CancelWhenStopped(packageProvider.FindPackage(name, RequiredVersion, MinimumVersion, MaximumVersion, 0, this))) {
                if (AllVersions)
                {
                    foreach (var p in packages)
                    {
                        found = true;
                        ProcessPackage(packageProvider, name, p);
                    }
                }
                else
                {
                    foreach (var pkg in from p in packages
                             group p by p.Name
                             // for a given name
                             into grouping
                             // get the latest version only
                             select grouping.OrderByDescending(pp => pp, SoftwareIdentityVersionComparer.Instance).First())
                    {
                        found = true;
                        // each package name should only show up once here.
                        ProcessPackage(packageProvider, name, pkg);
                    }
                }
            }
            return(found);
        }