Reputaion GetSubCategoryReputation(string html) { HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); var h4 = document.DocumentNode.SelectSingleNode("//h4"); var repGroupName = h4.InnerText.Trim(); var repGroup = new Reputaion { Name = repGroupName }; var divScore = document.DocumentNode.SelectSingleNode("//div[@class='faction-score']"); var repScore = divScore.InnerText.Trim(); repGroup.Score = repScore; var divLevel = document.DocumentNode.SelectSingleNode("//div[@class='faction-level']"); var repLevel = divLevel.InnerText.Trim(); repGroup.Level = repLevel; var liCollections = document.DocumentNode.ChildNodes[0].ChildNodes["ul"].SelectNodes("li"); foreach (HtmlNode li in liCollections) { if (li.Attributes["class"].Value == "faction-details") { var rep = GetSingleReputaion(li.OuterHtml); repGroup.RepList.Add(rep); } } return(repGroup); }
List <Reputaion> GetHeroReputaion(string html) { var repGroupList = new List <Reputaion>(); var strReputation = String.Empty; HtmlDocument document = new HtmlDocument(); document.LoadHtml(html); HtmlNodeCollection collection = document.DocumentNode.SelectNodes("//ul"); foreach (HtmlNode link in collection) { if (link.Attributes["class"].Value == "reputation-list") { strReputation = link.OuterHtml; break; } } document.LoadHtml(strReputation); collection = document.DocumentNode.SelectNodes("//li"); foreach (HtmlNode node in collection) { if (node.Attributes["class"].Value == "reputation-category") { var h3 = node.ChildNodes["h3"]; var repGroupName = h3.InnerText.Trim(); var repGroup = new Reputaion { Name = repGroupName, ShowProgress = false }; var liCollections = node.ChildNodes["ul"].SelectNodes("li"); foreach (HtmlNode li in liCollections) { if (li.Attributes["class"].Value == "faction-details") { var rep = GetSingleReputaion(li.OuterHtml); repGroup.RepList.Add(rep); } else if (li.Attributes["class"].Value == "reputation-subcategory") { var subGroup = GetSubCategoryReputation(li.OuterHtml); repGroup.RepList.Add(subGroup); } } repGroupList.Add(repGroup); } } return(repGroupList); }