コード例 #1
0
ファイル: Program.cs プロジェクト: DevrexLabs/GeekStream
        private static FeedItem CreateFeedItem(SyndicationItem syndicationItem, out string[] searchWords)
        {
            FeedItem newFeedItem = new FeedItem();

            try
            {
                var link = syndicationItem.Links.FirstOrDefault(l => l.RelationshipType == "alternate")
                           ?? syndicationItem.Links.FirstOrDefault(l => l.RelationshipType == "self")
                           ?? syndicationItem.Links.First();
                newFeedItem.Url = link.Uri.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("Syndication item has no links", ex);
            }

            newFeedItem.Published = syndicationItem.PublishDate;

            var builder = new SyndicationItemParser(syndicationItem);
            newFeedItem.Summary = builder.Summary;
            searchWords = builder.Keywords;

            newFeedItem.Title = syndicationItem.Title.Text;
            return newFeedItem;
        }
コード例 #2
0
        private static FeedItem CreateFeedItem(SyndicationItem syndicationItem, out string[] searchWords)
        {
            FeedItem newFeedItem = new FeedItem();

            try
            {
                var link = syndicationItem.Links.FirstOrDefault(l => l.RelationshipType == "alternate")
                           ?? syndicationItem.Links.FirstOrDefault(l => l.RelationshipType == "self")
                           ?? syndicationItem.Links.First();
                newFeedItem.Url = link.Uri.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("Syndication item has no links", ex);
            }

            newFeedItem.Published = syndicationItem.PublishDate;

            var builder = new SyndicationItemParser(syndicationItem);

            newFeedItem.Summary = builder.Summary;
            searchWords         = builder.Keywords;

            newFeedItem.Title = syndicationItem.Title.Text;
            return(newFeedItem);
        }