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(); } }
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)); }
public ToImageT Deserialize(Stream stream) { if (stream is null) { throw new ArgumentNullException(nameof(stream)); } var img = codec.Deserialize(stream); return(transcoder.Translate(img)); }
private Texture2D Decode(Stream imageStream) { return(codec.Deserialize(imageStream)); }