public uGGParser populateData(string championName, championRole role) { championName = championName.Replace("'", "").Replace(" ", ""); //Remove spaces and quotes from champion name if (!String.IsNullOrEmpty(championName)) { string webData = NetworkRequest.getString("https://u.gg/lol/champions/" + championName + "/build?role=" + role); if (webData.Contains("<title data-react-helmet=\"true\"></title>")) { LoLWrapperObject.cout("The chosen champion does not exist or is invalid."); return(null); } LoLWrapperObject.cout("Requesting data from U.GG.."); try { //First Rune Path MatchCollection buildPath = Regex.Matches(webData, "<div class=\"perk perk-active\"><img class=\"\" src=\"(.*?)\" alt=\"(.*?)\"/></div>"); //Minor Rune Path MatchCollection minorPath = Regex.Matches(webData, "<div class=\"shard shard-active\"><img class=\"\" src=\"(.*?)\"/>"); string primaryMainRune = Regex.Matches(webData, "<div class=\"perk-style-title\"><div>(.*?)</div></div>")[0].Groups[1].Value; string secondaryMainRune = Regex.Matches(webData, "<div class=\"perk-style-title\"><div>(.*?)</div></div>")[1].Groups[1].Value; string primarySummonerSpell = Regex.Matches(webData, "<div class=\"image-wrapper\"><img class=\"\" src=\"(.*?)\" alt=\"(.*?)\"/>")[0].Groups[2].Value; string secondarySummonerSpell = Regex.Matches(webData, "<div class=\"image-wrapper\"><img class=\"\" src=\"(.*?)\" alt=\"(.*?)\"/>")[1].Groups[2].Value; model = new RuneBuildModel() { primaryRune = new PrimaryRune() { mainRune = primaryMainRune, keyStone = buildPath[0].Groups[2].Value, choice1 = buildPath[1].Groups[2].Value, choice2 = buildPath[2].Groups[2].Value, choice3 = buildPath[3].Groups[2].Value }, secondaryRune = new SecondaryRune() { mainRune = secondaryMainRune, choice1 = buildPath[4].Groups[2].Value, choice2 = buildPath[5].Groups[2].Value }, minorRune = new MinorRune() { choice1 = cleanMinorRunes(minorPath[0].Groups[1].Value), choice2 = cleanMinorRunes(minorPath[1].Groups[1].Value), choice3 = cleanMinorRunes(minorPath[2].Groups[1].Value) }, primarySummonerSpell = primarySummonerSpell, secondarySummonerSpell = secondarySummonerSpell }; } catch (Exception ex) { LoLWrapperObject.cout("An error occured creating model: " + ex.Message); return(null); } return(this); } else { throw new ArgumentNullException("Champion name cannot be null."); } }