From ea67619bf5a754491ee97f842706971d2f2ed3a7 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 28 Feb 2026 11:02:20 -0500 Subject: [PATCH] Allow multiple attempts for older .NET --- SabreTools.RedumpLib/Web/RedumpClient.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/SabreTools.RedumpLib/Web/RedumpClient.cs b/SabreTools.RedumpLib/Web/RedumpClient.cs index 959b3ae..5e020bd 100644 --- a/SabreTools.RedumpLib/Web/RedumpClient.cs +++ b/SabreTools.RedumpLib/Web/RedumpClient.cs @@ -258,18 +258,23 @@ namespace SabreTools.RedumpLib.Web if (Debug) Console.WriteLine($"DEBUG: DownloadFile(\"{uri}\", \"{fileName}\"), Attempt {i + 1} of {AttemptCount}"); #if NET40 await Task.Factory.StartNew(() => { _internalClient.DownloadFile(uri, fileName); return true; }); - return _internalClient.GetLastFilename(); + string? lastFilename = _internalClient.GetLastFilename(); + if (lastFilename == null) + continue; + + return lastFilename; #elif NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER await Task.Run(() => _internalClient.DownloadFile(uri, fileName)); - return _internalClient.GetLastFilename(); + string? lastFilename = _internalClient.GetLastFilename(); + if (lastFilename == null) + continue; + + return lastFilename; #else // Make the call to get the file var response = await _internalClient.GetAsync(uri); if (response?.Content?.Headers is null || !response.IsSuccessStatusCode) - { - Console.Error.WriteLine($"Could not download {uri}"); - return null; - } + continue; // Copy the data to a local temp file using (var responseStream = await response.Content.ReadAsStreamAsync())