public static async Task <List <ItemLista> > GetItems(string query) { string SEARCH_RPG_URL = $"search?type=rpgitem&query={query}"; var xml = await GetURLContent(SEARCH_RPG_URL); RootLista lista = new RootLista(); using (TextReader reader = new StringReader(xml)) { try { lista = (RootLista) new XmlSerializer(typeof(RootLista)).Deserialize(reader); } catch (InvalidOperationException) { //XML inválido } } return(lista.Lista); }
public static async Task <List <ItemLista> > GetItems() { string HOT_RPG_URL = "hot?type=rpg"; var xml = await GetURLContent(HOT_RPG_URL); RootLista lista = new RootLista(); using (TextReader reader = new StringReader(xml)) { try { lista = (RootLista) new XmlSerializer(typeof(RootLista)).Deserialize(reader); } catch (InvalidOperationException) { //XML inválido } } return(lista.Lista); }