Esempio n. 1
0
        private static KeyValuePair<string, Article> GetUriArticlePair(string uri, SyndicationItem item)
        {
            string subject = item.Title.Text;
            string summary = item.Summary.Text;
            var authors = new List<Author>(item.Authors.Count);
            authors.AddRange(item.Authors.Select(author => new Author(author.Name, author.Email)));

            string articleContent = "";
            foreach (SyndicationElementExtension ext in item.ElementExtensions)
            {
                if (ext.GetObject<XElement>().Name.LocalName == "encoded")
                {
                    articleContent = ext.GetObject<XElement>().Value;
                }
            }

            var content = new Content(articleContent, "Html");
            DateTime lastUpdateTime = item.LastUpdatedTime.DateTime;
            DateTime publishDate = item.PublishDate.DateTime;

            var article = new Article(item.Id, uri, subject, item.Title.Text, summary, authors, lastUpdateTime, publishDate,
                                      content);
            var key = string.Format("{0}.{1}", uri, item.Id);

            return new KeyValuePair<string, Article>(key, article);
        }
Esempio n. 2
0
 public Article(string id, string source, string subject, string title, string summary, List<Author> authors, DateTime lastUpdateTime, DateTime publishDate, Content content)
 {
     Id = id;
     Source = source;
     Title = title;
     Authors = authors;
     Content = content;
     Summary = summary;
     Subject = subject;
     PublishDate = publishDate.ToUniversalTime();
     LastUpdateTime = lastUpdateTime.ToUniversalTime();
 }