Fixed NetworkFileStream not resuming from cancellation.

This commit is contained in:
Michael Bucari-Tovo 2021-08-20 21:05:29 -06:00
parent 85a6e21dcf
commit 0b129fcf7c
2 changed files with 6 additions and 8 deletions

View file

@ -241,9 +241,12 @@ namespace AaxDecrypter
} while (downloadPosition < ContentLength && !isCancelled);
_writeFile.Close();
_networkStream.Close();
WritePosition = downloadPosition;
Update();
_networkStream.Close();
downloadedPiece.Set();
downloadEnded.Set();
if (!isCancelled && WritePosition < ContentLength)
throw new WebException($"Downloaded size (0x{WritePosition:X10}) is less than {nameof(ContentLength)} (0x{ContentLength:X10}).");
@ -251,7 +254,6 @@ namespace AaxDecrypter
if (WritePosition > ContentLength)
throw new WebException($"Downloaded size (0x{WritePosition:X10}) is greater than {nameof(ContentLength)} (0x{ContentLength:X10}).");
downloadEnded.Set();
}
#endregion