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


C# IPackageRepository.GetPackages方法代码示例

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


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

示例1: VirtualRepository

 public VirtualRepository(IPackageRepository repo)
 {
     _packages = new HashSet<IPackage>(PackageEqualityComparer.IdAndVersion);
     if (repo != null)
     {
         _packages.AddRange(repo.GetPackages());
     }
 }
开发者ID:rikoe,项目名称:nuget,代码行数:8,代码来源:VirtualProjectManager.cs

示例2: PackageServiceTests

        public PackageServiceTests()
        {
            _packageRepository = A.Fake<IPackageRepository>(opts =>
            {
                opts.Strict();
            });
            A.CallTo(() => _packageRepository.GetPackages()).Returns(new[] 
            {
                new DataModel.Package { Id = _packageId, Title = "Some Package" },
                new DataModel.Package { Id = "second.package", Title = "Second Package" }
            });


            _SUT = new PackageService(_packageRepository, A.Dummy<IConnectionStringRepository>(), A.Dummy<IPackageSettingRepository>(), A.Dummy<ServiceModel.IHoardeManager>());
        }
开发者ID:dealproc,项目名称:Drey,代码行数:15,代码来源:PackageServiceTests.cs

示例3: 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

示例4: GetPackagesByDependencyOrder

        /// <summary>
        /// Get all packages from the specified repository in the dependency order, 
        /// e.g. if A -> B, then B will come before A.
        /// </summary>
        public IEnumerable<IPackage> GetPackagesByDependencyOrder(IPackageRepository repository)
        {
            if (repository == null) {
                throw new ArgumentNullException("repository");
            }
            Marker.Clear();

            _repository = repository;
            _sortedPackages = new List<IPackage>();

            foreach (var package in _repository.GetPackages()) {
                Walk(package);
            }

            return _sortedPackages;
        }
开发者ID:jacksonh,项目名称:nuget,代码行数:20,代码来源:PackageSorter.cs

示例5: GetPackageIdsFromLocalPackageRepository

        private static IEnumerable<string> GetPackageIdsFromLocalPackageRepository(IPackageRepository packageRepository,string searchFilter,bool includePrerelease)
        {
            IEnumerable<IPackage> packages = packageRepository.GetPackages();

            if (!String.IsNullOrEmpty(searchFilter))
            {
                packages = packages.Where(p => p.Id.StartsWith(searchFilter, StringComparison.OrdinalIgnoreCase));
            }

            if (!includePrerelease)
            {
                packages = packages.Where(p => p.IsReleaseVersion());
            }

            return packages.Select(p => p.Id)
                .Distinct()
                .Take(30);
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:18,代码来源:V2PowerShellAutocompleteResource.cs

示例6: GetPackages

 internal static IQueryable<IPackage> GetPackages(IPackageRepository repository, bool filterTags)
 {
     var packages = repository.GetPackages();
     return GetPackages(packages, filterTags);
 }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:5,代码来源:WebProjectManager.cs

示例7: GetPackages

        private IEnumerable<IPackage> GetPackages(IPackageRepository repository)
        {
            var packages = repository.GetPackages();
            if (Id.Any())
            {
                var packageIdSet = new HashSet<string>(packages.Select(r => r.Id), StringComparer.OrdinalIgnoreCase);
                var idSet = new HashSet<string>(Id, StringComparer.OrdinalIgnoreCase);
                var invalid = Id.Where(id => !packageIdSet.Contains(id));

                if (invalid.Any())
                {
                    throw new CommandLineException(LocalizedResourceManager.GetString("UnableToFindPackages"), String.Join(", ", invalid));
                }

                packages = packages.Where(r => idSet.Contains(r.Id));
            }
            var packageSorter = new PackageSorter(targetFramework: null);
            return packageSorter.GetPackagesByDependencyOrder(new ReadOnlyPackageRepository(packages)).Reverse();
        }
开发者ID:rikoe,项目名称:nuget,代码行数:19,代码来源:UpdateCommand.cs

示例8: CheckSource

 public static bool CheckSource(IPackageRepository repository)
 {
     try
     {
         repository.GetPackages().FirstOrDefault();
         return true;
     }
     catch (Exception ex)
     {
         if (!IsSourceUnavailableException(ex))
         {
             throw;
         }
     }
     return false;
 }
开发者ID:ItayGal2,项目名称:paradox,代码行数:16,代码来源:NugetStore.cs

示例9: GetPackageVersionsFromLocalPackageRepository

        protected IEnumerable<NuGetVersion> GetPackageVersionsFromLocalPackageRepository(IPackageRepository packageRepository, string packageId, string versionPrefix, bool includePrerelease)
        {
            var packages = packageRepository.GetPackages().Where(p => p.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase));

            if (!includePrerelease)
            {
                packages = packages.Where(p => p.IsReleaseVersion());
            }

            var versions = packages.Select(p => p.Version.ToString()).ToList();
            versions = versions.Where(item => item.StartsWith(versionPrefix, StringComparison.OrdinalIgnoreCase)).ToList();
            return versions.Select(item => NuGetVersion.Parse(item));
        }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:13,代码来源:PowerShellAutoCompleteResourceV2.cs

示例10: GetPackageList

   private IQueryable<IPackage> GetPackageList(IPackageRepository repository)
 {
     IQueryable<IPackage> packages;
     if (AllVersions)
     {
         packages = repository.GetPackages();
     }
     else
     {
         packages = repository.GetPackages().Where(p => p.IsLatestVersion);
     }
     return packages;
 }
开发者ID:dipeshc,项目名称:NuGet.Extensions,代码行数:13,代码来源:Details.cs

示例11: GetPackages

        protected virtual IQueryable<IPackage> GetPackages(IPackageRepository sourceRepository)
        {
            bool effectiveIncludePrerelease = IncludePrerelease || !UseRemoteSource;

            IQueryable<IPackage> packages = String.IsNullOrEmpty(Filter)
                                                ? sourceRepository.GetPackages()
                                                : sourceRepository.Search(Filter, effectiveIncludePrerelease);
            // by default, sort packages by Id
            packages = packages.OrderBy(p => p.Id);
            return packages;
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:11,代码来源:GetPackageCommand.cs

示例12: GetPackages

 internal static IQueryable<IPackage> GetPackages(IPackageRepository repository, string searchTerm)
 {
     return GetPackages(repository.GetPackages(), searchTerm);
 }
开发者ID:Wagnerp,项目名称:AutoUpdate,代码行数:4,代码来源:WebProjectManager.cs

示例13: Build

        public void Build(IPackageRepository localRepository) {
            if (this.IsCacheBuildable() == true) {
                foreach (RepositoryModel repository in this.Repositories.Where(repository => String.IsNullOrEmpty(repository.Uri) == false)) {
                    var cache = new List<PackageWrapperModel>();

                    repository.CacheStamp = DateTime.Now;

                    try {
                        var query = this.GetCachedSourceRepository(repository.Uri).GetPackages().Where(package => package.IsLatestVersion == true);

                        Defines.PackageRequiredTags.ForEach(tag => query = query.Where(package => package.Tags != null && package.Tags.Contains(tag)));

                        // Append all available packages for this repository.
                        new AvailableCacheBuilder() {
                            Cache = cache,
                            Source = query.ToList()
                                          .OrderByDescending(pack => pack.Version)
                                          .ToList()
                        }.Build();

                        // Update all available packages with those that are installed.
                        new InstalledCacheBuilder() {
                            Cache = cache,
                            Source = localRepository
                                .GetPackages()
                                .ToList()
                        }.Build();

                        // No errors occured during fetch, null it out.
                        repository.CacheError = null;

                        repository.Packages = cache;
                    }
                    catch (Exception e) {
                        // Record the error that occured while fetching the packages.
                        repository.CacheError = e.Message;
                    }
                }

                // A list of package id's that we know the source of
                IEnumerable<String> availablePackageIds = this.Repositories.SelectMany(repository => repository.Packages).Select(packageWrapper => packageWrapper.Id);

                // Now orphan all remaining packages that are installed but do not belong to any repository.
                new OrphanedCacheBuilder() {
                    Cache = this.Repositories.First(repository => repository.IsOrphanage == true).Packages,
                    Source = localRepository
                        .GetPackages()
                        .Where(package => availablePackageIds.Contains(package.Id) == false)
                        .ToList()
                }.Build();

                this.RebuiltTime = DateTime.Now;
            }
        }
开发者ID:EBassie,项目名称:Potato,代码行数:54,代码来源:RepositoryCache.cs

示例14: GetPackages

        protected virtual IQueryable<IPackage> GetPackages(IPackageRepository sourceRepository)
        {
            IQueryable<IPackage> packages = null;

            if (String.IsNullOrEmpty(Filter))
            {
                packages = sourceRepository.GetPackages();
            }
            else
            {
                packages = sourceRepository.Search(Filter, IncludePrerelease);
            }

            // for recent packages, we want to order by last installed first instead of Id
            if (!Recent.IsPresent)
            {
                packages = packages.OrderBy(p => p.Id);
            }

            return packages;
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:21,代码来源:GetPackageCommand.cs

示例15: GetPackages

        private IEnumerable<IPackage> GetPackages(IPackageRepository repository)
        {
            var packages = repository.GetPackages();
            if (Id.Any())
            {
                var packageIdSet = new HashSet<string>(packages.Select(r => r.Id), StringComparer.OrdinalIgnoreCase);
                var idSet = new HashSet<string>(Id, StringComparer.OrdinalIgnoreCase);
                var invalid = Id.Where(id => !packageIdSet.Contains(id));

                if (invalid.Any())
                {
                    throw new BuildException(String.Format("Unable to find packages {0}", String.Join(", ", invalid)), Location);
                }

                packages = packages.Where(r => idSet.Contains(r.Id));
            }
            var packageSorter = new PackageSorter(targetFramework: null);
            return packageSorter.GetPackagesByDependencyOrder(new ReadOnlyPackageRepository(packages)).Reverse();
        }
开发者ID:Alxandr,项目名称:NAnt.Nuget.Tasks,代码行数:19,代码来源:NugetGetDependenciesTask.cs


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