示例#1
0
        public async Task <GetImage> ApplyTo(IHaloSession session)
        {
            this.Validate();

            var uri = GetConstructedUri();

            var spartanImage = _useCache
                ? Cache.Get <GetImage>(uri)
                : null;

            if (spartanImage == null)
            {
                var tuple = await session.GetImage(uri);

                spartanImage = new GetImage
                {
                    Uri   = tuple.Item1,
                    Image = tuple.Item2
                };

                Cache.AddProfile(uri, spartanImage);
            }

            return(spartanImage);
        }