Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec312055be | ||
|
|
b08a0212ff |
@@ -96,6 +96,7 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
progressPercentage = -1;
|
progressPercentage = -1;
|
||||||
|
totalBytesToReceive = 0;
|
||||||
|
|
||||||
WebClientEx ws = new WebClientEx();
|
WebClientEx ws = new WebClientEx();
|
||||||
DownloadTimeout = downloadTimeout;
|
DownloadTimeout = downloadTimeout;
|
||||||
@@ -106,8 +107,7 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
ws.DownloadFileCompleted += ws_DownloadFileCompleted;
|
ws.DownloadFileCompleted += ws_DownloadFileCompleted;
|
||||||
ws.DownloadProgressChanged += ws_DownloadProgressChanged;
|
ws.DownloadProgressChanged += ws_DownloadProgressChanged;
|
||||||
ws.DownloadFileAsync(new Uri(url), Utils.GetPath(DownloadFileName));
|
ws.DownloadFileAsync(new Uri(url), Utils.GetPath(DownloadFileName));
|
||||||
totalBytesToReceive = 0;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -122,14 +122,6 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
if (UpdateCompleted != null)
|
if (UpdateCompleted != null)
|
||||||
{
|
{
|
||||||
if (DownloadTimeout != -1)
|
|
||||||
{
|
|
||||||
if ((DateTime.Now - totalDatetime).TotalSeconds > DownloadTimeout)
|
|
||||||
{
|
|
||||||
((WebClientEx)sender).CancelAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (totalBytesToReceive == 0)
|
if (totalBytesToReceive == 0)
|
||||||
{
|
{
|
||||||
totalDatetime = DateTime.Now;
|
totalDatetime = DateTime.Now;
|
||||||
@@ -138,6 +130,13 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
totalBytesToReceive = e.BytesReceived;
|
totalBytesToReceive = e.BytesReceived;
|
||||||
|
|
||||||
|
if (DownloadTimeout != -1)
|
||||||
|
{
|
||||||
|
if ((DateTime.Now - totalDatetime).TotalSeconds > DownloadTimeout)
|
||||||
|
{
|
||||||
|
((WebClientEx)sender).CancelAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (progressPercentage != e.ProgressPercentage && e.ProgressPercentage % 10 == 0)
|
if (progressPercentage != e.ProgressPercentage && e.ProgressPercentage % 10 == 0)
|
||||||
{
|
{
|
||||||
progressPercentage = e.ProgressPercentage;
|
progressPercentage = e.ProgressPercentage;
|
||||||
|
|||||||
@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
|||||||
// 方法是按如下所示使用“*”:
|
// 方法是按如下所示使用“*”:
|
||||||
//[assembly: AssemblyVersion("1.0.*")]
|
//[assembly: AssemblyVersion("1.0.*")]
|
||||||
//[assembly: AssemblyVersion("1.0.0")]
|
//[assembly: AssemblyVersion("1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("2.51")]
|
[assembly: AssemblyFileVersion("2.52")]
|
||||||
|
|||||||
Reference in New Issue
Block a user