private LoLStaticChampion ToChampion(JToken token, StringVersion gameVersion, string staticResourceRootDirectory)
        {
            var name          = token.Value <string>("name");
            var id            = token.Value <int>("key");
            var imageFileName = token.Value <JToken>("image").Value <string>("full");

            var smallTileImage = Path.Combine(staticResourceRootDirectory, gameVersion.ToString(), "img", "champion", imageFileName);
            var largeTileImage = Path.Combine(staticResourceRootDirectory, "img", "champion", "tiles", $"{Path.GetFileNameWithoutExtension(imageFileName)}_0.jpg");

            return(new LoLStaticChampion(id, name, smallTileImage, largeTileImage));
        }
        private LoLStaticItem ToItem(JProperty property, StringVersion gameVersion, string staticResourceRootDirectory)
        {
            var id    = int.Parse(property.Name);
            var token = property.First !;

            var name           = token.Value <string>("name");
            var imageFileName  = token.Value <JToken>("image") !.Value <string>("full");
            var smallTileImage = Path.Combine(staticResourceRootDirectory, gameVersion.ToString(), "img", "item", imageFileName);

            var gold        = token.Value <JToken>("gold");
            var totalCosts  = gold.Value <int>("total");
            var recipeCosts = gold.Value <int>("base");
            var sellWorth   = gold.Value <int>("sell");

            return(new LoLStaticItem(id, name, smallTileImage, totalCosts, recipeCosts, sellWorth));
        }
        private void CreateItemIndex(Progression progression, StringVersion gameVersion, string staticResourceRootDirectory)
        {
            progression.StartNextStep(LoLStaticResourceCacheResources.CreateItemIndexProgressStepDescription);
            Items.Clear();

            var itemCollectionFile     = Path.Combine(staticResourceRootDirectory, gameVersion.ToString(), "data", "en_US", "item.json");
            var itemCollectionFileText = File.ReadAllText(itemCollectionFile);

            var itemCollection   = JObject.Parse(itemCollectionFileText);
            var numberOfItems    = itemCollection["data"] !.Children().Count();
            var currentItemIndex = 0;

            foreach (var itemJson in itemCollection["data"] !.Children().Cast <JProperty>())
            {
                progression.CurrentStepProgress = currentItemIndex++ / (double)numberOfItems;

                var item = ToItem(itemJson, gameVersion, staticResourceRootDirectory);
                if (!Items.TryAdd(item.Id, item))
                {
                    throw new Exception($"The item id {item.Id} has been defined multiple times!");
                }
            }
        }
        private void CreateChampionIndex(Progression progression, StringVersion gameVersion, string staticResourceRootDirectory)
        {
            progression.StartNextStep(LoLStaticResourceCacheResources.CreateChampionIndexProgressStepDescription);
            Champions.Clear();
            ChampionNameToIdIndex.Clear();

            var championCollectionFile     = Path.Combine(staticResourceRootDirectory, gameVersion.ToString(), "data", "en_US", "champion.json");
            var championCollectionFileText = File.ReadAllText(championCollectionFile);

            var championCollection   = JObject.Parse(championCollectionFileText);
            var numberOfChampions    = championCollection["data"] !.Children().Count();
            var currentChampionIndex = 0;

            foreach (var championJson in championCollection["data"] !.Children())
            {
                progression.CurrentStepProgress = currentChampionIndex++ / (double)numberOfChampions;

                var champion = ToChampion(championJson.First !, gameVersion, staticResourceRootDirectory);
                if (!Champions.TryAdd(champion.Id, champion))
                {
                    throw new Exception($"The champion id {champion.Id} has been defined multiple times!");
                }

                if (!ChampionNameToIdIndex.TryAdd(champion.Name, champion.Id))
                {
                    throw new Exception($"The champion name {champion.Name} has been defined multiple times!");
                }
            }
        }