Compare commits

..

2 Commits
2.51 ... 2.52

Author SHA1 Message Date
2dust
ec312055be Update AssemblyInfo.cs 2019-11-27 13:57:51 +08:00
2dust
b08a0212ff Update DownloadHandle.cs 2019-11-27 13:15:02 +08:00
2 changed files with 10 additions and 11 deletions

View File

@@ -96,6 +96,7 @@ namespace v2rayN.Handler
}
progressPercentage = -1;
totalBytesToReceive = 0;
WebClientEx ws = new WebClientEx();
DownloadTimeout = downloadTimeout;
@@ -106,8 +107,7 @@ namespace v2rayN.Handler
ws.DownloadFileCompleted += ws_DownloadFileCompleted;
ws.DownloadProgressChanged += ws_DownloadProgressChanged;
ws.DownloadFileAsync(new Uri(url), Utils.GetPath(DownloadFileName));
totalBytesToReceive = 0;
ws.DownloadFileAsync(new Uri(url), Utils.GetPath(DownloadFileName));
}
catch (Exception ex)
{
@@ -122,14 +122,6 @@ namespace v2rayN.Handler
{
if (UpdateCompleted != null)
{
if (DownloadTimeout != -1)
{
if ((DateTime.Now - totalDatetime).TotalSeconds > DownloadTimeout)
{
((WebClientEx)sender).CancelAsync();
}
}
if (totalBytesToReceive == 0)
{
totalDatetime = DateTime.Now;
@@ -138,6 +130,13 @@ namespace v2rayN.Handler
}
totalBytesToReceive = e.BytesReceived;
if (DownloadTimeout != -1)
{
if ((DateTime.Now - totalDatetime).TotalSeconds > DownloadTimeout)
{
((WebClientEx)sender).CancelAsync();
}
}
if (progressPercentage != e.ProgressPercentage && e.ProgressPercentage % 10 == 0)
{
progressPercentage = e.ProgressPercentage;

View File

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("2.51")]
[assembly: AssemblyFileVersion("2.52")]