public XBLInfo(string Gamertag) { this.Gamertag = Gamertag; XDocument doc = XDocument.Load(string.Format(REST_API, this.Gamertag.Replace(" ", "+"))); AccountStatus = doc.Root.Element("AccountStatus").Value; PresenceInfo = new XBLPresenceInfo(doc.Root.Element("PresenceInfo")); State = doc.Root.Element("State").Value; Gamertag = doc.Root.Element("Gamertag").Value; Reputation = float.Parse(doc.Root.Element("Reputation").Value); GamerScore = int.Parse(doc.Root.Element("GamerScore").Value); if (PresenceInfo.Valid) { ProfileURL = doc.Root.Element("ProfileUrl").Value; TileURL = doc.Root.Element("TileUrl").Value; Country = doc.Root.Element("Country").Value; Bio = doc.Root.Element("Bio").Value; Location = doc.Root.Element("Location").Value; ReputationImageURL = doc.Root.Element("ReputationImageUrl").Value; Zone = doc.Root.Element("Zone").Value; AvatarURL = string.Format(AVATAR_URL, this.Gamertag); RecentGames = (from e in doc.Root.Element("RecentGames").Elements("XboxUserGameInfo") select new XBLGameInfo(e)).ToArray(); } }
public XBLInfo(string Gamertag) { this.Gamertag = Gamertag; XDocument doc = XDocument.Load(string.Format(REST_API, this.Gamertag.Replace(" ", "+"))); AccountStatus = doc.Root.Element("AccountStatus").Value; PresenceInfo = new XBLPresenceInfo(doc.Root.Element("PresenceInfo")); State = doc.Root.Element("State").Value; Gamertag = doc.Root.Element("Gamertag").Value; Reputation = float.Parse(doc.Root.Element("Reputation").Value); GamerScore = int.Parse(doc.Root.Element("GamerScore").Value); if(PresenceInfo.Valid) { ProfileURL = doc.Root.Element("ProfileUrl").Value; TileURL = doc.Root.Element("TileUrl").Value; Country = doc.Root.Element("Country").Value; Bio = doc.Root.Element("Bio").Value; Location = doc.Root.Element("Location").Value; ReputationImageURL = doc.Root.Element("ReputationImageUrl").Value; Zone = doc.Root.Element("Zone").Value; AvatarURL = string.Format(AVATAR_URL, this.Gamertag); RecentGames = (from e in doc.Root.Element("RecentGames").Elements("XboxUserGameInfo") select new XBLGameInfo(e)).ToArray(); } }