更新依赖项版本,添加线程安全的计数更新方法,并调整UI以显示下载进度和计数
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
|
<bindingRedirect oldVersion="0.0.0.0-9.0.0.6" newVersion="9.0.0.6" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
@@ -83,8 +83,8 @@
|
|||||||
<Reference Include="LanzouCloudSolve, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="LanzouCloudSolve, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\LanzouCloudSolve.1.0.3\lib\netstandard2.0\LanzouCloudSolve.dll</HintPath>
|
<HintPath>packages\LanzouCloudSolve.1.0.3\lib\netstandard2.0\LanzouCloudSolve.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.6\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
@@ -94,6 +94,9 @@
|
|||||||
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.IO.Pipelines, Version=9.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.Pipelines.9.0.6\lib\net462\System.IO.Pipelines.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -104,11 +107,11 @@
|
|||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Text.Encodings.Web, Version=9.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
<HintPath>packages\System.Text.Encodings.Web.9.0.6\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Text.Json, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Text.Json, Version=9.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Text.Json.8.0.1\lib\net462\System.Text.Json.dll</HintPath>
|
<HintPath>packages\System.Text.Json.9.0.6\lib\net462\System.Text.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
191
Form1.Designer.cs
generated
191
Form1.Designer.cs
generated
@@ -1,90 +1,101 @@
|
|||||||
namespace CheckDownload
|
namespace CheckDownload
|
||||||
{
|
{
|
||||||
partial class Update
|
partial class Update
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 必需的设计器变量。
|
/// 必需的设计器变量。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清理所有正在使用的资源。
|
/// 清理所有正在使用的资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows 窗体设计器生成的代码
|
#region Windows 窗体设计器生成的代码
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设计器支持所需的方法 - 不要修改
|
/// 设计器支持所需的方法 - 不要修改
|
||||||
/// 使用代码编辑器修改此方法的内容。
|
/// 使用代码编辑器修改此方法的内容。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.Update_Text = new System.Windows.Forms.Label();
|
this.Update_Text = new System.Windows.Forms.Label();
|
||||||
this.Update_Pro = new System.Windows.Forms.ProgressBar();
|
this.Update_Pro = new System.Windows.Forms.ProgressBar();
|
||||||
this.Status_Box = new System.Windows.Forms.Label();
|
this.Status_Box = new System.Windows.Forms.Label();
|
||||||
this.SuspendLayout();
|
this.Count_Box = new System.Windows.Forms.Label();
|
||||||
//
|
this.SuspendLayout();
|
||||||
// Update_Text
|
//
|
||||||
//
|
// Update_Text
|
||||||
this.Update_Text.AutoSize = true;
|
//
|
||||||
this.Update_Text.Location = new System.Drawing.Point(12, 12);
|
this.Update_Text.AutoSize = true;
|
||||||
this.Update_Text.Name = "Update_Text";
|
this.Update_Text.Location = new System.Drawing.Point(12, 12);
|
||||||
this.Update_Text.Size = new System.Drawing.Size(59, 12);
|
this.Update_Text.Name = "Update_Text";
|
||||||
this.Update_Text.TabIndex = 0;
|
this.Update_Text.Size = new System.Drawing.Size(59, 12);
|
||||||
this.Update_Text.Text = "更新状态:";
|
this.Update_Text.TabIndex = 0;
|
||||||
//
|
this.Update_Text.Text = "更新状态:";
|
||||||
// Update_Pro
|
//
|
||||||
//
|
// Update_Pro
|
||||||
this.Update_Pro.Location = new System.Drawing.Point(12, 36);
|
//
|
||||||
this.Update_Pro.Name = "Update_Pro";
|
this.Update_Pro.Location = new System.Drawing.Point(12, 36);
|
||||||
this.Update_Pro.Size = new System.Drawing.Size(339, 23);
|
this.Update_Pro.Name = "Update_Pro";
|
||||||
this.Update_Pro.TabIndex = 1;
|
this.Update_Pro.Size = new System.Drawing.Size(339, 23);
|
||||||
//
|
this.Update_Pro.TabIndex = 1;
|
||||||
// Status_Box
|
//
|
||||||
//
|
// Status_Box
|
||||||
this.Status_Box.AutoSize = true;
|
//
|
||||||
this.Status_Box.Location = new System.Drawing.Point(72, 12);
|
this.Status_Box.AutoSize = false;
|
||||||
this.Status_Box.Name = "Status_Box";
|
this.Status_Box.Location = new System.Drawing.Point(72, 12);
|
||||||
this.Status_Box.Size = new System.Drawing.Size(23, 12);
|
this.Status_Box.Name = "Status_Box";
|
||||||
this.Status_Box.TabIndex = 2;
|
this.Status_Box.Size = new System.Drawing.Size(213, 12);
|
||||||
this.Status_Box.Text = "...";
|
this.Status_Box.TabIndex = 2;
|
||||||
//
|
this.Status_Box.Text = "...";
|
||||||
// Update
|
//
|
||||||
//
|
// Count_Box
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.Count_Box.Location = new System.Drawing.Point(291, 12);
|
||||||
this.ClientSize = new System.Drawing.Size(363, 73);
|
this.Count_Box.Name = "Count_Box";
|
||||||
this.ControlBox = false;
|
this.Count_Box.Size = new System.Drawing.Size(60, 13);
|
||||||
this.Controls.Add(this.Status_Box);
|
this.Count_Box.TabIndex = 3;
|
||||||
this.Controls.Add(this.Update_Pro);
|
this.Count_Box.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
this.Controls.Add(this.Update_Text);
|
//
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
// Update
|
||||||
this.MaximizeBox = false;
|
//
|
||||||
this.MinimizeBox = false;
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
this.Name = "Update";
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ShowInTaskbar = false;
|
this.ClientSize = new System.Drawing.Size(363, 73);
|
||||||
this.Text = "自动更新";
|
this.ControlBox = false;
|
||||||
this.TopMost = true;
|
this.Controls.Add(this.Count_Box);
|
||||||
this.Load += new System.EventHandler(this.Update_Load);
|
this.Controls.Add(this.Status_Box);
|
||||||
this.ResumeLayout(false);
|
this.Controls.Add(this.Update_Pro);
|
||||||
this.PerformLayout();
|
this.Controls.Add(this.Update_Text);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
}
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
#endregion
|
this.Name = "Update";
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
private System.Windows.Forms.Label Update_Text;
|
this.Text = "自动更新";
|
||||||
private System.Windows.Forms.ProgressBar Update_Pro;
|
this.TopMost = true;
|
||||||
private System.Windows.Forms.Label Status_Box;
|
this.Load += new System.EventHandler(this.Update_Load);
|
||||||
}
|
this.ResumeLayout(false);
|
||||||
}
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Label Update_Text;
|
||||||
|
private System.Windows.Forms.ProgressBar Update_Pro;
|
||||||
|
private System.Windows.Forms.Label Status_Box;
|
||||||
|
private System.Windows.Forms.Label Count_Box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
57
Form1.cs
57
Form1.cs
@@ -133,6 +133,22 @@ namespace CheckDownload
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新计数显示文本(线程安全)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="countMessage">计数值</param>
|
||||||
|
private void UpdateCount(string countMessage)
|
||||||
|
{
|
||||||
|
if (this.InvokeRequired)
|
||||||
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate { Count_Box.Text = countMessage; });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Count_Box.Text = countMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 窗体加载事件处理,启动更新流程
|
/// 窗体加载事件处理,启动更新流程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -166,6 +182,7 @@ namespace CheckDownload
|
|||||||
{
|
{
|
||||||
CleanupNewFiles();
|
CleanupNewFiles();
|
||||||
UpdateStatus("下载在线MD5文件并读取...");
|
UpdateStatus("下载在线MD5文件并读取...");
|
||||||
|
UpdateCount("");
|
||||||
string tempFilePath = Path.Combine(_tempDirectory, Md5File);
|
string tempFilePath = Path.Combine(_tempDirectory, Md5File);
|
||||||
// 使用新的带123盘的下载方法
|
// 使用新的带123盘的下载方法
|
||||||
if (!await DownloadMd5FileWithFallback(Md5File, tempFilePath))
|
if (!await DownloadMd5FileWithFallback(Md5File, tempFilePath))
|
||||||
@@ -192,6 +209,7 @@ namespace CheckDownload
|
|||||||
if (compareResult.Count == 0)
|
if (compareResult.Count == 0)
|
||||||
{
|
{
|
||||||
UpdateStatus("所有文件都是最新的,无需更新");
|
UpdateStatus("所有文件都是最新的,无需更新");
|
||||||
|
UpdateCount("");
|
||||||
UpdateProgressValue(100);
|
UpdateProgressValue(100);
|
||||||
|
|
||||||
// 无需更新时清理临时文件夹
|
// 无需更新时清理临时文件夹
|
||||||
@@ -219,10 +237,12 @@ namespace CheckDownload
|
|||||||
if (!failedFiles.IsEmpty)
|
if (!failedFiles.IsEmpty)
|
||||||
{
|
{
|
||||||
UpdateStatus($"有 {failedFiles.Count} 个文件下载失败,开始重试...");
|
UpdateStatus($"有 {failedFiles.Count} 个文件下载失败,开始重试...");
|
||||||
|
UpdateCount("");
|
||||||
var stillFailing = await RetryFailedFilesAsync(new Dictionary<string, string>(failedFiles));
|
var stillFailing = await RetryFailedFilesAsync(new Dictionary<string, string>(failedFiles));
|
||||||
if (stillFailing.Any())
|
if (stillFailing.Any())
|
||||||
{
|
{
|
||||||
UpdateStatus($"重试后仍有 {stillFailing.Count} 个文件下载失败。");
|
UpdateStatus($"重试后仍有 {stillFailing.Count} 个文件下载失败。");
|
||||||
|
UpdateCount("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +452,8 @@ namespace CheckDownload
|
|||||||
int progress = (int)((double)_completedCount / _totalCount * 95);
|
int progress = (int)((double)_completedCount / _totalCount * 95);
|
||||||
UpdateProgressValue(progress);
|
UpdateProgressValue(progress);
|
||||||
|
|
||||||
UpdateStatus($"{Path.GetFileName(file.Key)} {_completedCount}/{_totalCount}");
|
UpdateStatus($"{Path.GetFileName(file.Key)}");
|
||||||
|
UpdateCount($"{_completedCount}/{_totalCount}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -465,13 +486,15 @@ namespace CheckDownload
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatus($"{fileName} {_completedCount + 1}/{_totalCount}");
|
UpdateStatus($"{fileName}");
|
||||||
|
UpdateCount($"{_completedCount + 1}/{_totalCount}");
|
||||||
if (await DownloadFileFromOneDrive(filePath, expectedMd5, tempFilePath))
|
if (await DownloadFileFromOneDrive(filePath, expectedMd5, tempFilePath))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatus($"{fileName} {_completedCount + 1}/{_totalCount}");
|
UpdateStatus($"{fileName}");
|
||||||
|
UpdateCount($"{_completedCount + 1}/{_totalCount}");
|
||||||
string ossKey = $"File/{expectedMd5}";
|
string ossKey = $"File/{expectedMd5}";
|
||||||
|
|
||||||
var obj = _ossClient.GetObject(OssBucketName, ossKey);
|
var obj = _ossClient.GetObject(OssBucketName, ossKey);
|
||||||
@@ -490,7 +513,8 @@ namespace CheckDownload
|
|||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is OssException || ex is WebException)
|
catch (Exception ex) when (ex is OssException || ex is WebException)
|
||||||
{
|
{
|
||||||
UpdateStatus($"{fileName} {_completedCount + 1}/{_totalCount}");
|
UpdateStatus($"{fileName}");
|
||||||
|
UpdateCount($"{_completedCount + 1}/{_totalCount}");
|
||||||
string ossKey = $"File/{expectedMd5}";
|
string ossKey = $"File/{expectedMd5}";
|
||||||
return await DownloadFileWithFallback(ossKey, tempFilePath);
|
return await DownloadFileWithFallback(ossKey, tempFilePath);
|
||||||
}
|
}
|
||||||
@@ -562,10 +586,12 @@ namespace CheckDownload
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
UpdateStatus($"正在从123盘下载: {fileName}");
|
UpdateStatus($"正在从123盘下载: {fileName}");
|
||||||
|
UpdateCount("");
|
||||||
|
|
||||||
string authUrl = GenerateAuthUrl($"http://{OneDriveMainDomain}{OneDrivePath}", fileName);
|
string authUrl = GenerateAuthUrl($"http://{OneDriveMainDomain}{OneDrivePath}", fileName);
|
||||||
|
|
||||||
UpdateStatus($"使用主域名下载文件...");
|
UpdateStatus($"使用主域名下载文件...");
|
||||||
|
UpdateCount("");
|
||||||
|
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, authUrl) { Version = HttpVersion.Version11 };
|
var request = new HttpRequestMessage(HttpMethod.Get, authUrl) { Version = HttpVersion.Version11 };
|
||||||
request.Headers.Add("User-Agent", "CheckDownload/1.0");
|
request.Headers.Add("User-Agent", "CheckDownload/1.0");
|
||||||
@@ -586,21 +612,25 @@ namespace CheckDownload
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatus($"123盘主域名下载成功: {fileName}");
|
UpdateStatus($"123盘主域名下载成功: {fileName}");
|
||||||
|
UpdateCount("");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
UpdateStatus($"123盘主域名下载失败,尝试备用域名: {fileName}");
|
UpdateStatus($"123盘主域名下载失败,尝试备用域名: {fileName}");
|
||||||
|
UpdateCount("");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UpdateStatus($"正在从123盘备用域名下载: {fileName}");
|
UpdateStatus($"正在从123盘备用域名下载: {fileName}");
|
||||||
|
UpdateCount("");
|
||||||
|
|
||||||
string authUrl = GenerateAuthUrl($"http://{OneDriveBackupDomain}{OneDrivePath}", fileName);
|
string authUrl = GenerateAuthUrl($"http://{OneDriveBackupDomain}{OneDrivePath}", fileName);
|
||||||
|
|
||||||
UpdateStatus($"使用备用域名下载文件...");
|
UpdateStatus($"使用备用域名下载文件...");
|
||||||
|
UpdateCount("");
|
||||||
|
|
||||||
var request = new HttpRequestMessage(HttpMethod.Get, authUrl) { Version = HttpVersion.Version11 };
|
var request = new HttpRequestMessage(HttpMethod.Get, authUrl) { Version = HttpVersion.Version11 };
|
||||||
request.Headers.Add("User-Agent", "CheckDownload/1.0");
|
request.Headers.Add("User-Agent", "CheckDownload/1.0");
|
||||||
@@ -621,6 +651,7 @@ namespace CheckDownload
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatus($"123盘备用域名下载成功: {fileName}");
|
UpdateStatus($"123盘备用域名下载成功: {fileName}");
|
||||||
|
UpdateCount("");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -667,7 +698,7 @@ namespace CheckDownload
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +727,7 @@ namespace CheckDownload
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -714,6 +745,7 @@ namespace CheckDownload
|
|||||||
for (int i = 0; i < MaxDownloadRetries && filesToRetry.Any(); i++)
|
for (int i = 0; i < MaxDownloadRetries && filesToRetry.Any(); i++)
|
||||||
{
|
{
|
||||||
UpdateStatus($"第 {i + 1} 次重试,剩余 {filesToRetry.Count} 个文件...");
|
UpdateStatus($"第 {i + 1} 次重试,剩余 {filesToRetry.Count} 个文件...");
|
||||||
|
UpdateCount("");
|
||||||
var failedThisRound = new ConcurrentDictionary<string, string>();
|
var failedThisRound = new ConcurrentDictionary<string, string>();
|
||||||
|
|
||||||
await PerformDownloads(filesToRetry, failedThisRound);
|
await PerformDownloads(filesToRetry, failedThisRound);
|
||||||
@@ -723,6 +755,7 @@ namespace CheckDownload
|
|||||||
if (filesToRetry.Any() && i < MaxDownloadRetries - 1)
|
if (filesToRetry.Any() && i < MaxDownloadRetries - 1)
|
||||||
{
|
{
|
||||||
UpdateStatus($"等待 3 秒后进行下一次重试...");
|
UpdateStatus($"等待 3 秒后进行下一次重试...");
|
||||||
|
UpdateCount("");
|
||||||
await Task.Delay(3000);
|
await Task.Delay(3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -757,7 +790,7 @@ namespace CheckDownload
|
|||||||
return ips;
|
return ips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
UpdateStatus($"通过 {dnsServer} 解析域名失败,尝试下一个...");
|
UpdateStatus($"通过 {dnsServer} 解析域名失败,尝试下一个...");
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
@@ -774,6 +807,7 @@ namespace CheckDownload
|
|||||||
private async Task VerifyAndSaveAllFiles()
|
private async Task VerifyAndSaveAllFiles()
|
||||||
{
|
{
|
||||||
UpdateStatus("正在校验文件...");
|
UpdateStatus("正在校验文件...");
|
||||||
|
UpdateCount("");
|
||||||
var failedFiles = new ConcurrentBag<string>();
|
var failedFiles = new ConcurrentBag<string>();
|
||||||
var filesForScripting = new ConcurrentBag<(string original, string newFile)>();
|
var filesForScripting = new ConcurrentBag<(string original, string newFile)>();
|
||||||
|
|
||||||
@@ -840,6 +874,7 @@ namespace CheckDownload
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateStatus("所有文件校验和保存成功");
|
UpdateStatus("所有文件校验和保存成功");
|
||||||
|
UpdateCount("");
|
||||||
UpdateProgressValue(100);
|
UpdateProgressValue(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1219,7 +1254,7 @@ namespace CheckDownload
|
|||||||
Directory.Delete(tempPath, true);
|
Directory.Delete(tempPath, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1260,7 +1295,7 @@ namespace CheckDownload
|
|||||||
_baseDirectory = Application.StartupPath;
|
_baseDirectory = Application.StartupPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
_baseDirectory = Application.StartupPath;
|
_baseDirectory = Application.StartupPath;
|
||||||
}
|
}
|
||||||
@@ -1343,7 +1378,7 @@ namespace CheckDownload
|
|||||||
|
|
||||||
return currentDir;
|
return currentDir;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return currentDir;
|
return currentDir;
|
||||||
}
|
}
|
||||||
|
@@ -5,14 +5,15 @@
|
|||||||
<package id="DnsClient" version="1.8.0" targetFramework="net472" />
|
<package id="DnsClient" version="1.8.0" targetFramework="net472" />
|
||||||
<package id="Fody" version="6.8.2" targetFramework="net472" developmentDependency="true" />
|
<package id="Fody" version="6.8.2" targetFramework="net472" developmentDependency="true" />
|
||||||
<package id="LanzouCloudSolve" version="1.0.3" targetFramework="net472" />
|
<package id="LanzouCloudSolve" version="1.0.3" targetFramework="net472" />
|
||||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.6" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
||||||
|
<package id="System.IO.Pipelines" version="9.0.6" targetFramework="net472" />
|
||||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
||||||
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
|
<package id="System.Text.Encodings.Web" version="9.0.6" targetFramework="net472" />
|
||||||
<package id="System.Text.Json" version="8.0.1" targetFramework="net472" />
|
<package id="System.Text.Json" version="9.0.6" targetFramework="net472" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
Reference in New Issue
Block a user