/// <summary> /// Get the trophy count. /// </summary> /// <param name="htmlNode">Html node to look for the information.</param> /// <returns>The trophy count</returns> private TrophyCount GetTrophyCount(HtmlNode htmlNode) { var nodeQuery = htmlNode.Descendants("div").Where(n => n.Attributes["class"].Value == "trophycontent" && n.ParentNode.ParentNode.Attributes["class"].Value == "trophycount normal"); if (!nodeQuery.Any()) { return(null); } var trophyCount = new TrophyCount(); var trophyIndex = 0; foreach (var foundNode in nodeQuery) { var rawValue = foundNode.InnerText; var parsedValue = ParseValue <int?>(rawValue); switch (trophyIndex) { case 0: trophyCount.Bronze = parsedValue; break; case 1: trophyCount.Silver = parsedValue; break; case 2: trophyCount.Gold = parsedValue; break; case 3: trophyCount.Platinum = parsedValue; break; default: break; } trophyIndex++; } trophyCount.Total = GetTotalTrophies(htmlNode); return(trophyCount); }
/// <summary> /// Get the Playstation Network Profile from the source page. /// </summary> /// <returns>Playstation Network Profile</returns> internal Profile GetProfile() { TrophyCount collectedTrophyCount = new TrophyCount() { Bronze = GetBronzeTrohies(), Silver = GetSilverTrohies(), Gold = GetGoldTrophies(), Platinum = GetPlatinumTrophies(), Total = GetTotalTrophies() }; Profile collectedProfile = new Profile() { Location = "US", PsnId = GetPsnId(), AvatarSmall = GetAvatarSmall(), Level = GetLevel(), Progress = GetProgress(), TrophyCount = collectedTrophyCount, }; return(collectedProfile); }
/// <summary> /// Get the Playstation Network Profile from the source page. /// </summary> /// <returns>Playstation Network Profile</returns> internal Profile GetProfile() { TrophyCount collectedTrophyCount = new TrophyCount() { Bronze = GetBronzeTrohies(), Silver = GetSilverTrohies(), Gold = GetGoldTrophies(), Platinum = GetPlatinumTrophies(), Total = GetTotalTrophies() }; Profile collectedProfile = new Profile() { Location = "US", PsnId = GetPsnId(), AvatarSmall = GetAvatarSmall(), Level = GetLevel(), Progress = GetProgress(), TrophyCount = collectedTrophyCount, }; return collectedProfile; }
/// <summary> /// Get the trophy count. /// </summary> /// <param name="htmlNode">Html node to look for the information.</param> /// <returns>The trophy count</returns> private TrophyCount GetTrophyCount(HtmlNode htmlNode) { var nodeQuery = htmlNode.Descendants("div").Where(n => n.Attributes["class"].Value == "trophycontent" && n.ParentNode.ParentNode.Attributes["class"].Value == "trophycount normal"); if (!nodeQuery.Any()) return null; var trophyCount = new TrophyCount(); var trophyIndex = 0; foreach (var foundNode in nodeQuery) { var rawValue = foundNode.InnerText; var parsedValue = ParseValue<int?>(rawValue); switch (trophyIndex) { case 0: trophyCount.Bronze = parsedValue; break; case 1: trophyCount.Silver = parsedValue; break; case 2: trophyCount.Gold = parsedValue; break; case 3: trophyCount.Platinum = parsedValue; break; default: break; } trophyIndex++; } trophyCount.Total = GetTotalTrophies(htmlNode); return trophyCount; }