Simplify code and clarify speed unit

pull/685/head
YFdyh000 5 years ago
parent e5547307b3
commit 033f83465f

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

Loading…
Cancel
Save