Browse Source

Simplify code and clarify speed unit

pull/685/head
YFdyh000 5 years ago
parent
commit
033f83465f
  1. 25
      v2rayN/v2rayN/Handler/DownloadHandle.cs

25
v2rayN/v2rayN/Handler/DownloadHandle.cs

@ -235,27 +235,12 @@ namespace v2rayN.Handler
{
if (UpdateCompleted != null)
{
if (e.Cancelled)
{
((WebClientEx)sender).Dispose();
TimeSpan ts = (DateTime.Now - totalDatetime);
string speed = string.Format("<{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
UpdateCompleted(this, new ResultEventArgs(true, speed));
return;
}
if (e.Error == null
|| Utils.IsNullOrEmpty(e.Error.ToString()))
{
if (e.Error != null) throw e.Error;
TimeSpan ts = (DateTime.Now - totalDatetime);
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
UpdateCompleted(this, new ResultEventArgs(true, speed));
}
else
{
throw e.Error;
}
((WebClientEx)sender).Dispose();
TimeSpan ts = (DateTime.Now - totalDatetime);
string speed = string.Format("<{0} MB/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
UpdateCompleted(this, new ResultEventArgs(true, speed));
}
}
catch (Exception ex)

Loading…
Cancel
Save