mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-30 00:55:00 +03:00
Simplify code and clarify speed unit
This commit is contained in:
@@ -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
|
((WebClientEx)sender).Dispose();
|
||||||
|| Utils.IsNullOrEmpty(e.Error.ToString()))
|
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||||
{
|
string speed = string.Format("<{0} MB/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
|
||||||
|
UpdateCompleted(this, new ResultEventArgs(true, speed));
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user