public static async Task <ProfileData.Profile> GetProfileDataAsync(string url) { if (url == "http://steamcommunity.com/profiles/76561199122211574/?xml=1") { System.Diagnostics.Debug.Write(""); } var xmlText = await WebReader.ReadToEndAsync(url); // Parse xml into object XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlText); // parse xml object as json text string json = JsonConvert.SerializeXmlNode(doc); var temp = JsonConvert.DeserializeObject <ProfileData.Root>(json); return(temp.profile); }
public static ProfileData.Profile GetProfileData(string url) { var xmlText = WebReader.ReadToEnd(url); // TODO: Add proper null checking instead if (xmlText.StartsWith("<!DOCTYPE html>")) { return(null); } // Parse xml into object XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlText); // parse xml object as json text string json = JsonConvert.SerializeXmlNode(doc); var temp = JsonConvert.DeserializeObject <ProfileData.Root>(json); return(temp.profile); }