Exemplo n.º 1
0
        public static FeedsRiver FromSyndication(List<FeedAndSource> feeds, DateTime cuttOffDate)
        {
            var river = new FeedsRiver();
            river.UpdatedFeeds = new FeedsCollection();

            var f = from x in feeds
                    select new FeedSite
                    {
                        FeedTitle = x.Feed.Title.Text,
                        FeedDescription = x.Feed.Description.Text,
                        WhenLastUpdate = x.Feed.LastUpdatedTime.ToString("R"),
                        FeedUrl = x.Source.XmlUri != null ? x.Source.XmlUri.ToString() : string.Empty,
                        WebsiteUrl = x.Source.HtmlUri != null ? x.Source.HtmlUri.ToString() : string.Empty,
                        Item = (from y in x.Feed.Items
                                where y.PublishDate > cuttOffDate
                                select new FeedItem
                                {
                                    Id = y.Id,
                                    Title = (y.Title != null) ? y.Title.Text : string.Empty,
                                    Body = Texts.LimitTextForRiverJs((y.Summary != null) ? y.Summary.Text : string.Empty),
                                    PubDate = y.PublishDate.ToString("R"),
                                    PermaLink = y.Id,
                                    Link = (y.Links.Any() ? y.Links.First().Uri.ToString() : y.Id)
                                }).ToArray()
                    };

            river.UpdatedFeeds.UpdatedFeed = f.ToArray();

            return river;
        }
Exemplo n.º 2
0
        public FeedTemplateRenderer(FeedsRiver river, string template)
        {
            Debug.Assert(river != null);
            Debug.Assert(!String.IsNullOrWhiteSpace(template));

            _river = river;
            _template = template;
        }