コード例 #1
0
        public async Task <string> GetSpellPathAsync(Champion champion, ChampionAbility spell)
        {
            var path = Path.Combine(_environment.WebRootPath, "spells");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            if (!System.IO.File.Exists($"{path}/{champion.Key}_{spell}.png"))
            {
                var content = await _httpClient.GetByteArrayAsync(champion.GetAbilityIconUrl(spell));

                await System.IO.File.WriteAllBytesAsync($"{path}/{champion.Key}_{spell}.png", content);
            }

            return($"/spells/{champion.Key}_{spell}.png");
        }