Пример #1
0
        private static async Task GetImageDataAsync(MetadataResponse metadata)
        {
            if (metadata.Status == System.Net.HttpStatusCode.OK)
            {
                var geo = await gmaps.ReverseGeocodeAsync(metadata.Location)
                          .ConfigureAwait(false);

                try
                {
                    using var stream = await gmaps.GetImageAsync(metadata.Pano_ID, 20, 0, 0)
                                       .ConfigureAwait(false);

                    var image = imageDecoder.Deserialize(stream);
                    form.SetImage(metadata, geo, image);
                }
                catch (Exception exp)
                {
                    form.SetError(exp);
                }
            }
            else
            {
                form.SetError();
            }
        }
Пример #2
0
        public async Task <T> GetIconAsync <T>(IImageCodec <T> decoder)
        {
            var request = HttpWebRequestExt.Create(IconURL);

            using var response = await request
                                 .GetAsync()
                                 .ConfigureAwait(false);

            return(decoder.Deserialize(response));
        }
Пример #3
0
        public ToImageT Deserialize(Stream stream)
        {
            if (stream is null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            var img = codec.Deserialize(stream);

            return(transcoder.Translate(img));
        }
Пример #4
0
 private Texture2D Decode(Stream imageStream)
 {
     return(codec.Deserialize(imageStream));
 }