private void SetNumplayers(PlayerPollResult pResult, XElement results) { string value = results.Attribute("numplayers").Value; if (value.Contains("+")) { pResult.NumPlayersIsAndHigher = true; } value = value.Replace("+", string.Empty); int res = 0; int.TryParse(value, out res); pResult.NumPlayers = res; }
private List<PlayerPollResult> LoadPlayerPollResults(XElement xElement) { List<PlayerPollResult> playerPollResult = new List<PlayerPollResult>(); if (xElement != null) { foreach (XElement results in xElement.Elements("results")) { PlayerPollResult pResult = new PlayerPollResult() { Best = GetIntResultScore(results, "Best"), Recommended = GetIntResultScore(results, "Recommended"), NotRecommended = GetIntResultScore(results, "Not Recommended") }; SetNumplayers(pResult, results); playerPollResult.Add(pResult); } } return playerPollResult; }