Improve status line display for unknown-size downloads.

This commit is contained in:
Paul Chote
2018-09-14 17:37:58 +01:00
committed by abcdefg30
parent 3f4d5fa68c
commit 7438af8266

View File

@@ -82,11 +82,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (i.TotalBytesToReceive < 0)
{
dataTotal = float.NaN;
dataReceived = i.BytesReceived;
dataSuffix = SizeSuffixes[0];
mag = (int)Math.Log(i.BytesReceived, 1024);
dataReceived = i.BytesReceived / (float)(1L << (mag * 10));
dataSuffix = SizeSuffixes[mag];
getStatusText = () => "Downloading from {2} {0:0.00} {1} (unknown size)".F(dataReceived,
getStatusText = () => "Downloading from {2} {0:0.00} {1}".F(dataReceived,
dataSuffix,
downloadHost ?? "unknown host");
progressBar.Indeterminate = true;