예제 #1
0
파일: Perks.cs 프로젝트: pipe01/LCU.NET
        /// <summary>
        /// Gets a rune's icon.
        /// </summary>
        /// <param name="perk">The rune. See <see cref="GetPerks"/>.</param>
        public Task <Image> GetPerkImageAsync(LolPerksPerkUIPerk perk) => Cache(async() =>
        {
            string[] split = perk.iconPath.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            string plugin  = split[0];
            string path    = string.Join("/", split.Skip(2));

            byte[] b = await PluginManager.GetAssetAsync(plugin, path).ConfigureAwait(false);

            using (var mem = new MemoryStream(b))
            {
                return(Image.FromStream(mem));
            }
        });