Add logging

This commit is contained in:
Michael Bucari-Tovo 2025-05-02 14:50:33 -06:00
parent ce952417fb
commit 422c86345e

View File

@ -185,14 +185,19 @@ namespace AaxDecrypter
} }
catch (HttpIOException e) catch (HttpIOException e)
when (e.HttpRequestError is HttpRequestError.ResponseEnded when (e.HttpRequestError is HttpRequestError.ResponseEnded
&& WritePosition != startPosition
&& WritePosition < ContentLength && !IsCancelled) && WritePosition < ContentLength && !IsCancelled)
{ {
Serilog.Log.Logger.Debug($"The download connection ended before the file completed downloading all 0x{ContentLength:X10} bytes");
//the download made *some* progress since the last attempt. //the download made *some* progress since the last attempt.
//Try again to complete the download from where it left off. //Try again to complete the download from where it left off.
//Make sure to rewind file to last flush position. //Make sure to rewind file to last flush position.
_writeFile.Position = startPosition = WritePosition; _writeFile.Position = startPosition = WritePosition;
blockResponse.Dispose(); blockResponse.Dispose();
blockResponse = await RequestNextByteRangeAsync(client); blockResponse = await RequestNextByteRangeAsync(client);
Serilog.Log.Logger.Debug($"Resuming the file download starting at position 0x{WritePosition:X10}.");
} }
} }
} }