Skip to content
Snippets Groups Projects
Commit cdc0e012 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Simplify calculation of transfer progress percentage.

Refers to #2, #26
parent 4daab809
No related branches found
No related tags found
No related merge requests found
......@@ -181,10 +181,9 @@ namespace ATxService
_txCurFileProgress = progress;
_status.TransferredBytesCurrentFile = (long) (_txCurFileSize * e.CurrentFileProgress / 100);
// NOTE: the (double) is required to make the division work on float which can then
// eventually be cast into an (int) after multiplying it by 100:
_status.CurrentTransferPercent = (int)((_status.TransferredBytesCompleted + _status.TransferredBytesCurrentFile) * 100 /
_status.CurrentTransferSize);
_status.CurrentTransferPercent = (int) (
(_status.TransferredBytesCompleted + _status.TransferredBytesCurrentFile) * 100 /
_status.CurrentTransferSize);
Log.Info("Current transfer at {0}%", _status.CurrentTransferPercent);
Log.Trace("Tx progress: complete [{0}] - current [{1}] - combined {2:0}%",
_status.TransferredBytesCompleted, _status.TransferredBytesCurrentFile,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment