Esempio n. 1
0
 public static ForumTopicLightEntry FromTopicEntry(ForumTopicEntry topic)
 {
     return(new ForumTopicLightEntry
     {
         Title = topic.Title,
         Op = topic.Op,
         Id = topic.Id,
         Created = topic.Created
     });
 }
Esempio n. 2
0
 public static ForumTopicLightEntry FromTopicEntry(ForumTopicEntry topic)
 {
     return new ForumTopicLightEntry
     {
         Title = topic.Title,
         Op = topic.Op,
         Id = topic.Id,
         Created = topic.Created
     };
 }
 public ForumTopicEntryViewModel(ForumTopicEntry data)
 {
     Data = data;
 }
        public static ForumTopicEntry ParseHtmlToTopic(HtmlNode topicRow,int tdOffset = 0)
        {
            var current = new ForumTopicEntry();
            var tds = topicRow.Descendants("td").ToList();

            current.Type = tds[1].ChildNodes[0].InnerText;

            var titleLinks = tds[1].Descendants("a").ToList();
            var titleLink = titleLinks[0].InnerText.Length == 0 ? titleLinks[1] : titleLinks[0];

            current.Title = WebUtility.HtmlDecode(titleLink.InnerText);
            var link = titleLink.Attributes["href"].Value;
            if (link.Contains("&goto="))
            {
                var pos = link.IndexOf("&goto=");
                link = link.Substring(0, pos);
            }

            current.Id = link.Split('=').Last();
            

            var spans = tds[1].Descendants("span").Where(node => !string.IsNullOrEmpty(node.InnerText)).ToList();
            current.Op = spans[0].InnerText;
            current.Created = spans[1].InnerText;

            current.Replies = tds[2+tdOffset].InnerText;

            current.LastPoster = tds[3+tdOffset].Descendants("a").First().InnerText;
            current.LastPostDate = tds[3+tdOffset].ChildNodes.Last().InnerText;

            return current;
        }