Exemple #1
0
        static IEnumerable<PublishedPackage> GetAllPublishedPackages()
        {
            var packagingSource = new PackagingSource { FeedUrl = BlogSettings.Instance.GalleryFeedUrl };
            var allPacks = new List<PublishedPackage>();

            // gallery has a limit 100 records per call
            // keep calling till any records returned
            int cnt;
            var skip = 0;
            do
            {
                var s = skip;
                var pkgs = (new[] { packagingSource })
                .SelectMany(
                    source =>
                    {
                        var galleryFeedContext = new GalleryFeedContext(new Uri(BlogSettings.Instance.GalleryFeedUrl)) { IgnoreMissingProperties = true };
                        return galleryFeedContext.Packages.Expand("Screenshots").OrderBy(p => p.Id).Where(p => p.IsLatestVersion).Skip(s).Take(100);
                    }
                );
                cnt = pkgs.Count();
                skip = skip + 100;
                allPacks.AddRange(pkgs);
            } while (cnt > 0);

            return allPacks;
        }
 static IEnumerable<PublishedPackage> GetPublishedPackages(PackagingSource packagingSource = null)
 {
     return (new[] { packagingSource })
     .SelectMany(
         source =>
         {
             var galleryFeedContext = new GalleryFeedContext(new Uri(_feedUrl)) { IgnoreMissingProperties = true };
             return galleryFeedContext.Packages.Expand("Screenshots");
         }
     );
 }