-
Notifications
You must be signed in to change notification settings - Fork 67
Description
To help us fix your issue, please provide the information in the below template.
Note: If you want to save time, please create a fork, reproduce the bug in the sample projects and add a link to the repository here.
Steps to reproduce
I am sorry for not forking, but I could not get it to work...
Use Crossdownloader in Android simulator on a big file.
For instance a file with this size: 9,83 GB (10 558 486 413 bytes) is calculated as a 1,89GB file since the convert is a integer and not float.
I suggest using double instead float to ensure you have enough precision for the future 👍
Ref digits available:
double has 52 mantissa bits + 1 hidden bit: log(253)÷log(10) = 15.95 digits
float has 23 mantissa bits + 1 hidden bit: log(224)÷log(10) = 7.22 digits
Expected behavior
Main problem is "cursor.GetInt" in convert to float.
My suggested fix (not tested):
IDownloadFile.cs line 89 and 95:
double TotalBytesExpected { get; }
double TotalBytesWritten { get; }DownloadFileImplementation.cs line 47, 49, 60 and 62:
private double _totalBytesExpected;
public double TotalBytesExpected {
private double _totalBytesWritten;
public double TotalBytesWritten {DownloadManagerImplementation.cs line 158 and 159:
downloadFile.TotalBytesWritten = cursor.GetDouble (cursor.GetColumnIndex (Android.App.DownloadManager.ColumnBytesDownloadedSoFar));
downloadFile.TotalBytesExpected = cursor.GetDouble(cursor.GetColumnIndex (Android.App.DownloadManager.ColumnTotalSizeBytes));Actual behavior
Return actual filesize provided by the server in the Content-Length: HTTP-header
Configuration
Platform:
- iOS
- Android
- UWP
- Other
Device:
- Simulator
- Real device (please specify)