From 5fe5f0eb446f50aacf9dc95ab300213ad87dc248 Mon Sep 17 00:00:00 2001 From: Dong <1278815766@qq.com> Date: Tue, 13 May 2025 20:33:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E7=BA=BFMD5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=AA=8C=E8=AF=81=E5=A4=B1=E8=B4=A5=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E7=AA=97=E5=8F=A3=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在Form1.cs中,当在线MD5文件验证失败时,增加状态更新和延迟关闭窗口的逻辑,以避免程序卡死。同时在Form1.Designer.cs中,将窗口设置为不在任务栏显示,以提升用户体验。 --- Form1.Designer.cs | 1 + Form1.cs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 765bee1..b4b0f2a 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -71,6 +71,7 @@ this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Update"; + this.ShowInTaskbar = false; this.Text = "自动更新"; this.TopMost = true; this.Load += new System.EventHandler(this.Update_Load); diff --git a/Form1.cs b/Form1.cs index 92700d0..c74c221 100644 --- a/Form1.cs +++ b/Form1.cs @@ -112,7 +112,13 @@ namespace CheckDownload UpdateStatus("下载在线MD5文件并读取..."); OssClient client = new OssClient(OssEndpoint, OssAccessKeyId, OssAccessKeySecret); var onlineData = ReadOnlineMd5File(client, OssBucketName, Md5File); - if (!ValidateOnlineData(onlineData.Version, onlineData.Md5, onlineData.Data)) return; + if (!ValidateOnlineData(onlineData.Version, onlineData.Md5, onlineData.Data)) + { + UpdateStatus("在线MD5文件无效"); + await Task.Delay(3000); + this.Close(); + return; + } UpdateStatus("比较本地和在线MD5文件..."); var compareResult = CompareMd5Data(onlineData.Data);