Fixed NetworkFileStream not resuming from cancellation.
This commit is contained in:
parent
85a6e21dcf
commit
0b129fcf7c
@ -118,12 +118,6 @@ namespace AaxDecrypter
|
|||||||
RetrievedTags?.Invoke(this, aaxFile.AppleTags);
|
RetrievedTags?.Invoke(this, aaxFile.AppleTags);
|
||||||
RetrievedCoverArt?.Invoke(this, aaxFile.AppleTags.Cover);
|
RetrievedCoverArt?.Invoke(this, aaxFile.AppleTags.Cover);
|
||||||
|
|
||||||
if (isCanceled)
|
|
||||||
{
|
|
||||||
aaxFile.Dispose();
|
|
||||||
nfsPersister.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
return !isCanceled;
|
return !isCanceled;
|
||||||
}
|
}
|
||||||
private NetworkFileStreamPersister NewNetworkFilePersister()
|
private NetworkFileStreamPersister NewNetworkFilePersister()
|
||||||
@ -230,6 +224,8 @@ namespace AaxDecrypter
|
|||||||
isCanceled = true;
|
isCanceled = true;
|
||||||
aaxFile?.Cancel();
|
aaxFile?.Cancel();
|
||||||
aaxFile?.Dispose();
|
aaxFile?.Dispose();
|
||||||
|
nfsPersister?.NetworkFileStream?.Close();
|
||||||
|
nfsPersister?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -241,9 +241,12 @@ namespace AaxDecrypter
|
|||||||
} while (downloadPosition < ContentLength && !isCancelled);
|
} while (downloadPosition < ContentLength && !isCancelled);
|
||||||
|
|
||||||
_writeFile.Close();
|
_writeFile.Close();
|
||||||
|
_networkStream.Close();
|
||||||
WritePosition = downloadPosition;
|
WritePosition = downloadPosition;
|
||||||
Update();
|
Update();
|
||||||
_networkStream.Close();
|
|
||||||
|
downloadedPiece.Set();
|
||||||
|
downloadEnded.Set();
|
||||||
|
|
||||||
if (!isCancelled && WritePosition < ContentLength)
|
if (!isCancelled && WritePosition < ContentLength)
|
||||||
throw new WebException($"Downloaded size (0x{WritePosition:X10}) is less than {nameof(ContentLength)} (0x{ContentLength:X10}).");
|
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)
|
if (WritePosition > ContentLength)
|
||||||
throw new WebException($"Downloaded size (0x{WritePosition:X10}) is greater than {nameof(ContentLength)} (0x{ContentLength:X10}).");
|
throw new WebException($"Downloaded size (0x{WritePosition:X10}) is greater than {nameof(ContentLength)} (0x{ContentLength:X10}).");
|
||||||
|
|
||||||
downloadEnded.Set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user