diff --git a/installer/.gitignore b/installer/.gitignore index ce8390c..9fd3f5c 100644 --- a/installer/.gitignore +++ b/installer/.gitignore @@ -1,7 +1,6 @@ ## Yours - - +installer/Downloader/Properties/ ## VsCode .vscode/ diff --git a/installer/Downloader/Form1.cs b/installer/Downloader/Form1.cs index a95c112..1add573 100644 --- a/installer/Downloader/Form1.cs +++ b/installer/Downloader/Form1.cs @@ -191,7 +191,8 @@ await Task.Run(async () => { if (token.IsCancellationRequested) { cancelled = true; tokenSource = new CancellationTokenSource(); token = tokenSource.Token; return; } - this.textBox2.AppendText(updateFile + 1 + totalupdate + ": 开始更新" + Filename + Environment.NewLine); + this.textBox2.AppendText(updateFile + 1 + "/" + totalupdate + ": 开始更新" + Filename + Environment.NewLine); + File.Delete(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", Filename)); await Task.Run(() => { Downloader.download(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", Filename), Filename); }); this.textBox2.AppendText(Filename + "更新完毕!" + Environment.NewLine); updateFile++; } @@ -220,12 +221,11 @@ await Task.Run(async () => cancelled = false; } else this.textBox2.AppendText("当前平台已是最新版本!" + Environment.NewLine); + SelectedNewFile.Clear(); SelectedUpdateFile.Clear(); + newFileName.Clear(); updateFileName.Clear(); } - else - { - SelectedNewFile.Clear(); - SelectedUpdateFile.Clear(); - } + + } } @@ -239,8 +239,11 @@ private void button1_Click(object sender, EventArgs e) { FolderBrowserDialog folder = new FolderBrowserDialog(); folder.ShowDialog(); - this.textBox1.Text = folder.SelectedPath; - Data.ChangeData(this.textBox1.Text); + if (folder.SelectedPath != "") + { + this.textBox1.Text = folder.SelectedPath; + Data.ChangeData(this.textBox1.Text); + } } private void button2_Click(object sender, EventArgs e) @@ -269,6 +272,8 @@ private async void button3_Click(object sender, EventArgs e) { string json, MD5; int newFile = 0, updateFile = 0; + newFileName.Clear(); + updateFileName.Clear(); Tencent_cos_download Downloader = new Tencent_cos_download(); await Task.Run(() => { Downloader.download(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", "md5list.json")); }); using (StreamReader r = new StreamReader(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", "md5list.json"))) @@ -278,20 +283,17 @@ private async void button3_Click(object sender, EventArgs e) foreach (KeyValuePair pair in jsonDict) { - MD5 = GetFileMd5Hash(System.IO.Path.Combine(this.textBox1.Text, pair.Key)); + MD5 = GetFileMd5Hash(System.IO.Path.Combine(this.textBox1.Text, "THUAI3.0", pair.Key)); if (MD5.Length == 0) - { - if (!newFileName.Exists(t => t == pair.Key)) - newFileName.Add(pair.Key); - } + newFileName.Add(pair.Key); else if (MD5 != pair.Value) - { - if (!updateFileName.Exists(t => t == pair.Key)) - updateFileName.Add(pair.Key); - } + updateFileName.Add(pair.Key); } newFile = newFileName.Count(); updateFile = updateFileName.Count(); + if(this.textBox2.Text.Length!=0) + this.textBox2.AppendText("----------------------" + Environment.NewLine); + if (newFile + updateFile == 0) { this.textBox2.AppendText("当前平台已是最新版本!" + Environment.NewLine); @@ -305,7 +307,7 @@ private async void button3_Click(object sender, EventArgs e) this.textBox2.AppendText(Environment.NewLine + $"发现{updateFile}个文件更新:" + Environment.NewLine); foreach (string filename in updateFileName) this.textBox2.AppendText(filename + Environment.NewLine); - this.textBox2.AppendText(Environment.NewLine + "请点击下载按钮选择文件" + Environment.NewLine); + this.textBox2.AppendText(Environment.NewLine + "请点击下载按钮选择文件" + Environment.NewLine + Environment.NewLine); } Checked = true; } diff --git a/installer/Downloader/Properties/AssemblyInfo.cs b/installer/Downloader/Properties/AssemblyInfo.cs deleted file mode 100644 index ad7e325..0000000 --- a/installer/Downloader/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("Downloader")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Downloader")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("beda8c53-df17-46c5-8d5e-1fd122d78f78")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/installer/Downloader/Properties/Resources.Designer.cs b/installer/Downloader/Properties/Resources.Designer.cs deleted file mode 100644 index 070557c..0000000 --- a/installer/Downloader/Properties/Resources.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace Downloader.Properties { - using System; - - - /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 返回此类使用的缓存的 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Downloader.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 重写当前线程的 CurrentUICulture 属性 - /// 重写当前线程的 CurrentUICulture 属性。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// 查找 System.Byte[] 类型的本地化资源。 - /// - internal static byte[] data { - get { - object obj = ResourceManager.GetObject("data", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// - internal static System.Drawing.Bitmap file { - get { - object obj = ResourceManager.GetObject("file", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// - internal static System.Drawing.Bitmap folder { - get { - object obj = ResourceManager.GetObject("folder", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找类似 AKID12oKZZ1n0FF0VkLQr7PQAdpnUu3eJ6uS 的本地化字符串。 - /// - internal static string TencentID { - get { - return ResourceManager.GetString("TencentID", resourceCulture); - } - } - - /// - /// 查找类似 SdXBD1YnmX0DAZjcFbEdkbJlzwdNs63j 的本地化字符串。 - /// - internal static string TencentKey { - get { - return ResourceManager.GetString("TencentKey", resourceCulture); - } - } - } -} diff --git a/installer/Downloader/Properties/Resources.resx b/installer/Downloader/Properties/Resources.resx deleted file mode 100644 index b4f0158..0000000 --- a/installer/Downloader/Properties/Resources.resx +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\bin\Debug\data.dat;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\bin\Debug\file.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\bin\Debug\folder.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - AKID12oKZZ1n0FF0VkLQr7PQAdpnUu3eJ6uS - - - SdXBD1YnmX0DAZjcFbEdkbJlzwdNs63j - - \ No newline at end of file diff --git a/installer/Downloader/Properties/Settings.Designer.cs b/installer/Downloader/Properties/Settings.Designer.cs deleted file mode 100644 index fe32cbe..0000000 --- a/installer/Downloader/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Downloader.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/installer/Downloader/Properties/Settings.settings b/installer/Downloader/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/installer/Downloader/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -