Example #1
0
        public Model(String region)
        {
            reader      = new Reader();
            this.region = region;

            // populate championNames
            String          champions   = reader.Request(Coder.GetChampionNamesUrl(region));
            Regex           regexId     = new Regex("\"id\":(\\d+)");
            MatchCollection idMatches   = regexId.Matches(champions);
            Regex           regexName   = new Regex("\"name\":\"([^\"]+)\"");
            MatchCollection nameMatches = regexName.Matches(champions);

            for (int i = 0; i < idMatches.Count; i++)
            {
                int    id   = Convert.ToInt32(idMatches[i].Groups[1].Value);
                String name = nameMatches[i].Groups[1].Value;
                championNames[id] = name;
            }
        }