Ejemplo n.º 1
0
        public static List <CurseDetailPage> TryPraseList(string html)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);
            var nav = doc.DocumentNode.SelectSingleNode("//nav[contains(@class,'detail-navigation')]");
            List <CurseDetailPage> pages = new List <CurseDetailPage>();

            if (null != nav && nav.ChildNodes.Count > 0)
            {
                foreach (var node in nav.ChildNodes)
                {
                    CurseDetailPage p = CurseDetailPage.TryPrase(node.InnerHtml);
                    if (null != p)
                    {
                        pages.Add(p);
                    }
                }
            }
            else
            {
                return(null);
            }
            if (pages.Count > 0)
            {
                return(pages);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public static CurseDetail TryPrase(string html)
        {
            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);
            var         v  = doc.DocumentNode.SelectSingleNode("//span[@class='stats--game-version']");
            CurseDetail cd = new CurseDetail();

            if (null != v)
            {
                cd.version = v.InnerText;
            }
            cd.pages = CurseDetailPage.TryPraseList(html);
            var c = doc.DocumentNode.SelectSingleNode("//section[contains(@class,'project-content')]");

            if (null != c)
            {
                cd.content = c.InnerText;
            }
            return(cd);
        }