static void ParseIt(string raw) { Ranks = new List <Info>(); Regex re = new Regex(@"(?<=<td class=""Champion"">)(?s).*?(?=RuneMastery)"); MatchCollection mc = re.Matches(raw); for (int i = 0; i < mc.Count; i++) { Match match = mc[i]; Info info = new Info(); string data = Misc.RemoveSpaces(match.Value); try { info.Name = Misc.ExtractString(data, @"target=""_blank"">", "</a>"); info.champname = Misc.ExtractString(data, @"<div class=""championIcon tip"" title=""", @""">"); info.seriescheck = Misc.ExtractString(data, @"<div class=""Series""> Series: ", "</i> </div> </td>"); info.Ranking = Misc.ExtractString(data, @"<td class=""TierRank""> <div class=""TierRank""> ", "</div>"); info.rankedwinrate = Misc.ExtractString(data, @"<div class=""ratio normal"">", "</div>"); info.rankedwins = Misc.ExtractString(data, @"<span class=""title"">(", ")</span>"); // info.champtotal = Misc.ExtractString(data, @"<span class=""title"">", "</span>"); -- ranked wins info.champwinrate = RmColor(Misc.ExtractString(data, @"<div class=""WinRatio""> <span class=""ratio", "</span>")); info.champtotal = Misc.ExtractString(data, @"(<span class=""title"">", "</span>)"); string kdastring = Misc.ExtractString(data, @"<div class=""KDA"">", "/span>"); if (Regex.Match(kdastring, @"[^0-9\.]+").Success) { string kda = Regex.Split(kdastring, @"[^0-9\.]+")[1]; Double kdar; if (Double.TryParse(kda, out kdar)) { info.kda = kdar.ToString(); } } else { info.kda = "0"; } info.lastseason = Misc.ExtractString(data, @"<div class=""TierRankImage tip"" title=""", @"""> <img"); Ranks.Add(info); Console.WriteLine(info.Name + " " + info.Ranking + " " + info.rankedwins + " " + info.rankedwins + " " + info.champwinrate + " " + info.kda); } catch (Exception e) { Console.Write(e); } } Console.WriteLine("[EloSharp] Data Collection Completed"); }
public static void ExtractInformation(String html) { var list = ObjectManager.Get <Obj_AI_Hero>(); foreach (var hero in list) { Info info = new Info(); string startinfo = "<a href=\"/summoner/userName="******"\" class=\"summonerName\" target=\"_blank\">" + hero.Name + "</a>"; string endofinfo = "<td class=\"SummonerName\">"; string inbetween = Misc.ExtractString(html, startinfo, endofinfo); string tierandlp = Misc.ExtractString(inbetween, "<div class=\"TierRank\">", "</div>"); string winratio = Misc.ExtractString(inbetween, "<td class=\"WinRatio\">\">", "</div>"); Console.WriteLine(winratio); string gamesplayed = Misc.ExtractString(inbetween, "<span class=\"title\">", "</span>"); Console.WriteLine(gamesplayed); //Champ info string champsection = Misc.ExtractString(inbetween, "<td class=\"ChampionInfo\">", "<td class=\"ChampionSpell\">"); Console.Write(champsection); string champkda = Misc.ExtractString(champsection, "<div class=\"KDA\">", "</span>"); Console.WriteLine(champkda); string champwinratio = Misc.ExtractString(champsection, "<div class=\"WinRatio\">", ""); Console.WriteLine(champwinratio); string champplayed = Misc.ExtractString(champsection, "<span class=\"title\">", "</span>"); Console.WriteLine(champplayed); string lastseason = Misc.ExtractString(champsection, "<div class=\"TierRankImage tip\" title=\"", "\">"); Console.WriteLine(lastseason); //Add it to list info.Name = hero.Name; info.Ranking = tierandlp; info.winratio = winratio; info.gamesplayed = gamesplayed; info.champgamesplayed = champplayed; info.kdaratio = champkda; info.champwinratio = champwinratio; info.lastseason = lastseason; info.herohandle = hero; Bitmap spritechamp = Misc.champbitmap(hero.Name); info.champsprite = spritechamp; Ranks.Add(info); System.IO.File.WriteAllText(@"C:\Users\Laptop\Desktop\inbetween.txt", inbetween); // Testing purposes } }
public static void lolnexuslookup(string name, string region) { Ranksloading = new List <Infoloading>(); Playerz = new List <heros>(); string lxregion = Misc.sortedregion(); try { //Get raw information string htmlcode = new WebClient().DownloadString("http://www.lolnexus.com/ajax/get-game-info/" + region + ".json?name=" + name); // File.WriteAllText(LeagueSharp.Common.Config.AppDataDirectory + "\\lolnexusdata.txt", htmlcode); //Extract information foreach ( Match playerregex in new Regex("href=\\\\\"http://" + lxregion + ".op.gg/summoner/userName=(.*?)\\\\\" target=\\\\\"outbound\\\\\"") .Matches(htmlcode)) { heros p = new heros(); Match playername = new Regex(playerregex.Groups[1].ToString()).Matches(htmlcode)[0]; p.Name = playername.ToString(); Playerz.Add(p); } foreach (heros p in Playerz) { Match htmlmatchinfo = new Regex("href=\\\\\"http://" + Misc.sortedregion() + ".op.gg/summoner/userName="******"\\\\\" target=\\\\\"outbound\\\\\"").Matches(htmlcode)[0]; string foundheroinfo = htmlmatchinfo.ToString(); string endofheroinfo = "\\n </a>\\r\\n </td>\\r\\n \\r\\n</tr>"; string inbetween = Misc.ExtractString(htmlcode, foundheroinfo, endofheroinfo); string rankedwins = Misc.ExtractString(inbetween, "<span class=\\\"ranked-wins\\\">", "</span>\\r\\n"); string soloqrank = Misc.StripHTML(Misc.ExtractString(inbetween, "<div class=\\\"ranking\\\">\\r\\n", "</span>\\r\\n")); string checkseries = Misc.StripHTML(Misc.ExtractString(inbetween, " <span class=\\\"series\\\">Series", "<td class=\\\"normal-wins\\\">")); string fixedcheckseries = checkseries.Replace("\\r\\n", string.Empty).Replace(" ", string.Empty); string fixedseries = fixseries(fixedcheckseries.ToLower()); string runesfixed = Misc.ExtractString(inbetween, "class=\\\"tooltip-html\\\"><div><h2>", "</span>\\r\\n"); char[] delimiters = { '+', '(', '-' }; string[] runes = runesfixed.Split(delimiters); string champname = Misc.StripHTML(Misc.ExtractString(inbetween, "</div>\\r\\n\\r\\n <span>", "\\r\\n \\r\\n")); string champnamefix = champname.Replace("'", string.Empty); string currentmasteries = Misc.StripHTML(Misc.ExtractString(inbetween, "<span class=\\\"offense\\\">", "</span>\\r")); string kda = Misc.StripHTML(Misc.ExtractString(inbetween, "<td class=\\\"champion-kda\\\">\\r\\n \\r\\n", "</span></td>\\r\\n")); string champtotal = Misc.StripHTML(Misc.ExtractString(inbetween, "<h2>Champion Games</h2>The number of games played with this champion.\\\">", "</b>)</span>")); string champnameforbitmap = champnamefix.ToLower().Replace(" ", ""); Game.PrintChat(champnameforbitmap); //Console.WriteLine(champnameforbitmap); Bitmap spritechamp = Misc.champbitmap(champnameforbitmap); Infoloading infoloading = new Infoloading(); infoloading.Name = p.Name; infoloading.rankedwins = rankedwins; infoloading.soloqrank = soloqrank; infoloading.currentrunes = runes; infoloading.currentmasteries = currentmasteries; infoloading.champtotal = champtotal; infoloading.kda = kda; infoloading.champsprite = spritechamp; infoloading.champname = champnamefix; infoloading.seriescheck = fixedseries; Ranksloading.Add(infoloading); Console.WriteLine("End of lookup function"); } } catch (Exception e) { Console.Write("Exception" + e); } }
public static void lolskilllookup(string name) { Console.WriteLine("[EloSharp] LOLSkill FOR: " + name); Ranksloading = new List <Infoloading>(); Playerz = new List <heros>(); //Get raw information string regiontag = Misc.RegionTag; try { string htmlcode = new WebClient().DownloadString("http://www.lolskill.net/game/" + regiontag + "/" + name); //System.IO.File.WriteAllText(@"C:\Users\Laptop\Desktop\lolnexus.txt", htmlcode); // Testing purposes //Extract information foreach ( Match playerregex in new Regex("<div class=\"summonername\"><a href=\"summoner/" + regiontag + "/(.*?)\">(.*?)</a></div>") .Matches(htmlcode)) { heros p = new heros(); Match playername = new Regex(playerregex.Groups[2].ToString()).Matches(htmlcode)[0]; Match playernamehtml = new Regex(playerregex.Groups[1].ToString()).Matches(htmlcode)[0]; p.Name = playername.ToString(); p.Htmlname = playernamehtml.ToString(); Playerz.Add(p); } foreach (heros p in Playerz) { Match htmlmatchinfo = new Regex("<div class=\"summonername\"><a href=\"summoner/" + regiontag + "/" + p.Htmlname + "\">" + p.Name + "</a></div>").Matches(htmlcode)[0]; string foundheroinfo = htmlmatchinfo.ToString(); string endofheroinfo = "</table>"; string inbetween = Misc.ExtractString(htmlcode, foundheroinfo, endofheroinfo); string rankedwins = Misc.ExtractString(inbetween, "<b>Ranked Wins:", "</b><br>"); string soloqrank = Misc.StripHTML(Misc.ExtractString(inbetween, "is currently ranked <b>", "</b> in SoloQueue")); string soloqlp = Misc.StripHTML(Misc.ExtractString(inbetween, "and has <b>", "</b> League Points")); // string checkseries = EloSharp.StripHTML(Misc.ExtractString(inbetween, " <span class=\\\"series\\\">Series", "<td class=\\\"normal-wins\\\">")); // string fixedcheckseries = checkseries.Replace("\\r\\n", string.Empty).Replace(" ", string.Empty); // string fixedseries = fixseries(fixedcheckseries.ToLower()); string runesfixed = Misc.ExtractString(inbetween, "<b>Runes:</b><br>", "<br><br><br><b>"); char[] delimiters = { '+', '(', '-' }; string[] runes = runesfixed.Split(delimiters); Match namechamp = new Regex("title=\"»" + p.Name + "« has a LolSkillScore of <b>(.*?)</b> with (.*?)<br>").Matches(htmlcode)[0]; string champname = namechamp.ToString(); string champnamefix = champname.Replace("'", string.Empty); string currentmasteries = Misc.StripHTML(Misc.ExtractString(inbetween, "<b>Masteries:</b><br>", "<br><br><i>")); string kda = Misc.StripHTML(Misc.ExtractString(inbetween, "<td class=\\\"champion-kda\\\">\\r\\n \\r\\n", "</span></td>\\r\\n")); string champtotal = Misc.StripHTML(Misc.ExtractString(inbetween, "</b> out of <b>", "</b> games with")); string performance = Misc.StripHTML(Misc.ExtractString(inbetween, "has performed <b>", "</b>than the average")); string champwins = Misc.ExtractString(inbetween, "title=\"»" + p.Name + "« has won <b>", "</b> out of"); string champwinrate = Misc.ExtractString(inbetween, "That's a winrate of <b>", "</b>"); string winloss = Misc.ExtractString(inbetween, "<td class=\"stat green\">", "<span class=\"small\">"); string kills = Misc.ExtractString(inbetween, "has killed <b>", "</b> enemy champions per game"); string deaths = Misc.ExtractString(inbetween, "has died <b>", "</b> times per game"); string assists = Misc.ExtractString(inbetween, "has had <b>", "</b> assists per game"); string champnameforbitmap = champnamefix.ToLower().Replace(" ", ""); //Console.WriteLine(champnameforbitmap); Bitmap spritechamp = Misc.champbitmap(champnameforbitmap); Infoloading infoloading = new Infoloading(); infoloading.Name = p.Name; infoloading.rankedwins = rankedwins; infoloading.soloqrank = soloqrank; infoloading.soloqlp = soloqlp; // LolSkill exclusive infoloading.currentrunes = runes; infoloading.currentmasteries = currentmasteries; infoloading.champtotal = champtotal; infoloading.kda = kda; infoloading.champsprite = spritechamp; infoloading.champname = champnamefix; // infoloading.seriescheck = fixedseries; infoloading.performance = performance; // LolSkill exclusive infoloading.champwins = champwins; // LolSkill exclusive infoloading.champwinrate = champwinrate; // LolSkill exclusive infoloading.winloss = winloss; // LolSkill exclusive infoloading.kills = kills; // LolSkill exclusive infoloading.deaths = deaths; // LolSkill exclusive infoloading.assists = assists; // LolSkill exclusive Ranksloading.Add(infoloading); } } catch (Exception e) { Console.Write("Exception" + e); } }