From 8e75d3f1adc2d49e81bd72c5e0f7f58ec9a90abe Mon Sep 17 00:00:00 2001 From: Andrea Chiera Date: Sat, 6 Jan 2024 14:28:06 +0100 Subject: [PATCH] Impossible retrieve video preview --- NasaPod/Core/Utility.cs | 18 ++++++++++++------ NasaPod/Nasa.csproj | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NasaPod/Core/Utility.cs b/NasaPod/Core/Utility.cs index 004edbd..83efdad 100644 --- a/NasaPod/Core/Utility.cs +++ b/NasaPod/Core/Utility.cs @@ -287,15 +287,21 @@ public static class Images { public static async Task GetImageAsync(string imageUrl) { - WebClient client = new WebClient(); - byte[] imageData = await client.DownloadDataTaskAsync(imageUrl); - Image image = Image.FromStream(new System.IO.MemoryStream(imageData)); + try + { + WebClient client = new WebClient(); + byte[] imageData = await client.DownloadDataTaskAsync(imageUrl); + Image image = Image.FromStream(new System.IO.MemoryStream(imageData)); - // Visualizziamo le dimensioni dell'immagine - return image; + // Visualizziamo le dimensioni dell'immagine + return image; + } + catch(Exception ex) + { + throw new Exception($"Impossible retrieve video preview"); + } } - public static Image FillImage(Image image, AppSettings settings) { // Create a new bitmap with the desired size and resolution diff --git a/NasaPod/Nasa.csproj b/NasaPod/Nasa.csproj index d745f0f..141650b 100644 --- a/NasaPod/Nasa.csproj +++ b/NasaPod/Nasa.csproj @@ -20,8 +20,8 @@ False https://github.com/Nerdomante/NasaAPOD https://github.com/Nerdomante/NasaAPOD - 1.2.5 - 1.2.5 + 1.2.6 + 1.2.6