当前位置: 首页>>代码示例>>C#>>正文


C# IPackageRepository.FindPackagesById方法代码示例

本文整理汇总了C#中IPackageRepository.FindPackagesById方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageRepository.FindPackagesById方法的具体用法?C# IPackageRepository.FindPackagesById怎么用?C# IPackageRepository.FindPackagesById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPackageRepository的用法示例。


在下文中一共展示了IPackageRepository.FindPackagesById方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPackagesToOpen

        protected IEnumerable<FileSystemPath> GetPackagesToOpen(IPackageRepository repository, string id, string version, bool recurse)
        {
            List<FileSystemPath> returnValue = new List<FileSystemPath>();

            var package = repository.FindPackage(id, new NuGet.SemanticVersion(version));
            if (package != null)
            {
                returnValue.Add(new FileSystemPath(RetrieveTemporaryPackageFile(package)));

                if (recurse)
                {
                    foreach (var dependency in Enumerable.SelectMany(package.DependencySets, d => d.Dependencies))
                    {
                        var childPackages = repository.FindPackagesById(dependency.Id);
                        var childPackage = childPackages.FindByVersion(dependency.VersionSpec).FirstOrDefault();
                        if (childPackage != null)
                        {
                            returnValue.AddRange(GetPackagesToOpen(repository, childPackage.Id, childPackage.Version.ToString(), recurse));
                        }
                    }
                }
            }

            return returnValue;
        }
开发者ID:modulexcite,项目名称:dotpeek-nupeek,代码行数:25,代码来源:OpenFromNuGetHandlerBase.cs

示例2: GetPackages

        protected override IQueryable<IPackage> GetPackages(IPackageRepository sourceRepository)
        {
            IQueryable<IPackage> packages;
            if (!String.IsNullOrEmpty(Filter))
            {
                if (ExactMatch)
                {
                    packages = sourceRepository.FindPackagesById(Filter).AsQueryable();
                }
                else
                {
                    packages = sourceRepository.GetPackages()
                                               .Where(p => p.Id.ToLower().StartsWith(Filter.ToLower()));
                }
            }
            else
            {
                packages = sourceRepository.GetPackages();
            }

            return packages.OrderByDescending(p => p.DownloadCount)
                           .ThenBy(p => p.Id)
                           .AsQueryable();
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:24,代码来源:FindPackageCommand.cs

示例3: matchPackage

 IPackage matchPackage(IPackageRepository packageRepository, string id, IVersionSpec version)
 {
     return packageRepository.FindPackagesById(id).FirstOrDefault(x => VersionComparer.Matches(version, x.Version));
 }
开发者ID:christianrondeau,项目名称:Squirrel.Windows.Next,代码行数:4,代码来源:ReleasePackage.cs

示例4: ResolveDependencyCore

        public static IPackage ResolveDependencyCore(
            IPackageRepository repository,
            PackageDependency dependency,
            IPackageConstraintProvider constraintProvider,
            bool allowPrereleaseVersions,
            bool preferListedPackages,
            DependencyVersion dependencyVersion)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }

            if (dependency == null)
            {
                throw new ArgumentNullException("dependency");
            }

            IEnumerable<IPackage> packages = repository.FindPackagesById(dependency.Id).ToList();

            // Always filter by constraints when looking for dependencies
            packages = FilterPackagesByConstraints(constraintProvider, packages, dependency.Id, allowPrereleaseVersions);

            IList<IPackage> candidates = packages.ToList();

            if (preferListedPackages)
            {
                // pick among Listed packages first
                IPackage listedSelectedPackage = ResolveDependencyCore(
                    candidates.Where(PackageExtensions.IsListed),
                    dependency,
                    dependencyVersion);
                if (listedSelectedPackage != null)
                {
                    return listedSelectedPackage;
                }
            }

            return ResolveDependencyCore(candidates, dependency, dependencyVersion);
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:40,代码来源:PackageWalker.cs

示例5: GetLastestPackageVersion

        /// <summary>
        /// Find the latest version of a package in the given repo.
        /// </summary>
        /// <param name="repo">The repository where to find the latest version of the package.</param>
        /// <param name="id">The id of the package.</param>
        /// <param name="allowPrereleaseVersions">Indicates if prerelease version is allowed.</param>
        /// <returns>the latest version of the package; or null if the package doesn't exist
        /// in the repo.</returns>
        private static IPackage GetLastestPackageVersion(IPackageRepository repo, string id, bool allowPrereleaseVersions)
        {
            IPackage latestVersion = null;
            var latestPackageLookup = repo as ILatestPackageLookup;
            if (latestPackageLookup != null &&
                latestPackageLookup.TryFindLatestPackageById(id, allowPrereleaseVersions, out latestVersion))
            {
                return latestVersion;
            }

            var aggregateRepository = repo as AggregateRepository;
            if (aggregateRepository != null)
            {
                return GetLatestVersionPackageByIdFromAggregateRepository(
                    aggregateRepository, id, allowPrereleaseVersions);
            }

            IEnumerable<IPackage> packages = repo.FindPackagesById(id).OrderByDescending(p => p.Version);
            if (!allowPrereleaseVersions)
            {
                packages = packages.Where(p => p.IsReleaseVersion());
            }

            latestVersion = packages.FirstOrDefault();
            return latestVersion;
        }
开发者ID:Mailaender,项目名称:xamarin-nuget,代码行数:34,代码来源:InstallCommand.cs

示例6: RunAuditAndReturnResults

 private List<PackageAuditResult> RunAuditAndReturnResults(IPackageRepository repository, FeedAuditor feedAuditor)
 {
     List<PackageAuditResult> results = null;
     if (String.IsNullOrEmpty(Package))
         results = feedAuditor.Audit();
     else
     {
         var actualPackage = File.Exists(Package) ? new ZipPackage(Package) : repository.FindPackagesById(Package).FirstOrDefault();
         if (actualPackage != null)
             results = feedAuditor.Audit(actualPackage);
         else
             throw new ApplicationException(string.Format("Could not find package locally or on feed: {0}", Package));
     }
     return results;
 }
开发者ID:dipeshc,项目名称:NuGet.Extensions,代码行数:15,代码来源:Audit.cs

示例7: FindLatestInstalledPackage

 private IPackage FindLatestInstalledPackage(IPackageRepository packageRepository)
 {
     return packageRepository.FindPackagesById(mainPackage).OrderByDescending(p => p.Version).FirstOrDefault();
 }
开发者ID:Powerino73,项目名称:paradox,代码行数:4,代码来源:LauncherApp.cs

示例8: FindPackage

        private IPackage FindPackage(IPackageRepository repository, string packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider,
                                                 bool allowPrereleaseVersions, bool allowUnlisted)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }

            if (packageId == null)
            {
                throw new ArgumentNullException("packageId");
            }

            // if an explicit version is specified, disregard the 'allowUnlisted' argument
            // and always allow unlisted packages.
            if (version != null)
            {
                allowUnlisted = true;
            }

            IEnumerable<IPackage> packages = repository.FindPackagesById(packageId);

            _cache.AddCacheEntryByList(packageId, packages);


            if (!allowUnlisted)
            {
                packages = packages.Where(PackageExtensions.IsListed);
            }

            if (version != null)
            {
                packages = packages.Where(p => p.Version == version);
            }
            else if (constraintProvider != null)
            {
                packages = FilterPackagesByConstraints(constraintProvider, packages, packageId, allowPrereleaseVersions);
            }

            return packages.FirstOrDefault();
        }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:41,代码来源:PackageResolutionManager.cs


注:本文中的IPackageRepository.FindPackagesById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。