Closed matteomonizza closed 8 years ago
I am not sure I can fix this for all cases. The problem is that I would need to know the total size of the file being transferred but that is not always the case with streams. A stream may just contain a chunk of a file and not the entire transfer. I just know the current position and if the stream gives accurate data the length of the stream. Below is the patch that will fix the common cases.
// set the transfer size so we can do some calc on percentage completed
// in the TransferBytes() method of the base class
if (IsTranferProgressEventSet() && inputStream.CanSeek) {
// if the transfer is a resume then subtract the current position from the length
if (action == FileAction.Resume || action == FileAction.ResumeOrCreate) {
SetTransferSize (inputStream.Length - inputStream.Position);
} else {
SetTransferSize (inputStream.Length);
}
}
Added change to latest version which will get pushed today.
The function ignores the resume start position and so the TransferProgressEventArgs values aren't right (percent complete, time remaining...)