From 89cce334d0420146e47bde9ea66584c074b06714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E5=B0=8F=E7=9A=AE-ZengXiaoPi?= <1768506869@qq.com> Date: Thu, 5 Oct 2023 23:49:20 +0800 Subject: [PATCH] v0.5.2 --- src/MainPage.Designer.cs | 77 +++++++++++++-------------- src/MainPage.cs | 111 +++++++++++++++++++++++++-------------- src/MainPage.resx | 30 +++++------ 3 files changed, 127 insertions(+), 91 deletions(-) diff --git a/src/MainPage.Designer.cs b/src/MainPage.Designer.cs index f0e1e27..e66ae19 100644 --- a/src/MainPage.Designer.cs +++ b/src/MainPage.Designer.cs @@ -133,7 +133,7 @@ private void InitializeComponent() this.uiTabControl.SelectedIndex = 0; this.uiTabControl.Size = new System.Drawing.Size(1077, 483); this.uiTabControl.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; - this.uiTabControl.Style = Sunny.UI.UIStyle.Custom; + this.uiTabControl.Style = Sunny.UI.UIStyle.Colorful; this.uiTabControl.TabBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); this.uiTabControl.TabIndex = 0; this.uiTabControl.TabSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250))))); @@ -161,38 +161,38 @@ private void InitializeComponent() this.statu.Location = new System.Drawing.Point(291, 22); this.statu.Name = "statu"; this.statu.Size = new System.Drawing.Size(498, 63); - this.statu.Style = Sunny.UI.UIStyle.Custom; + this.statu.Style = Sunny.UI.UIStyle.Colorful; this.statu.TabIndex = 3; this.statu.Text = "正在加载中……"; this.statu.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // DownloadBar // - this.DownloadBar.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(248)))), ((int)(((byte)(248))))); + this.DownloadBar.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.DownloadBar.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.DownloadBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136))))); + this.DownloadBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.DownloadBar.Location = new System.Drawing.Point(380, 296); this.DownloadBar.MinimumSize = new System.Drawing.Size(70, 3); this.DownloadBar.Name = "DownloadBar"; this.DownloadBar.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.RightBottom | Sunny.UI.UICornerRadiusSides.LeftBottom))); - this.DownloadBar.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136))))); + this.DownloadBar.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.DownloadBar.Size = new System.Drawing.Size(312, 19); - this.DownloadBar.Style = Sunny.UI.UIStyle.Custom; + this.DownloadBar.Style = Sunny.UI.UIStyle.Colorful; this.DownloadBar.TabIndex = 2; this.DownloadBar.Text = "DownloadBar"; // // TotalBar // - this.TotalBar.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(248)))), ((int)(((byte)(248))))); + this.TotalBar.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.TotalBar.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.TotalBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136))))); + this.TotalBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.TotalBar.Location = new System.Drawing.Point(380, 268); this.TotalBar.MinimumSize = new System.Drawing.Size(70, 3); this.TotalBar.Name = "TotalBar"; this.TotalBar.RadiusSides = ((Sunny.UI.UICornerRadiusSides)((Sunny.UI.UICornerRadiusSides.LeftTop | Sunny.UI.UICornerRadiusSides.RightTop))); - this.TotalBar.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136))))); + this.TotalBar.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.TotalBar.Size = new System.Drawing.Size(312, 29); - this.TotalBar.Style = Sunny.UI.UIStyle.Custom; + this.TotalBar.Style = Sunny.UI.UIStyle.Colorful; this.TotalBar.TabIndex = 1; this.TotalBar.Text = "TotalBar"; // @@ -214,7 +214,7 @@ private void InitializeComponent() this.installButton.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.installButton.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.installButton.Size = new System.Drawing.Size(312, 121); - this.installButton.Style = Sunny.UI.UIStyle.Custom; + this.installButton.Style = Sunny.UI.UIStyle.Colorful; this.installButton.TabIndex = 0; this.installButton.Text = "立刻安装/更新"; this.installButton.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -257,7 +257,7 @@ private void InitializeComponent() this.EnterAfdian.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterAfdian.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterAfdian.Size = new System.Drawing.Size(194, 46); - this.EnterAfdian.Style = Sunny.UI.UIStyle.Custom; + this.EnterAfdian.Style = Sunny.UI.UIStyle.Colorful; this.EnterAfdian.Symbol = 61654; this.EnterAfdian.TabIndex = 11; this.EnterAfdian.Text = "爱发电(赞助渠道)"; @@ -282,7 +282,7 @@ private void InitializeComponent() this.EnterQuestion.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterQuestion.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterQuestion.Size = new System.Drawing.Size(176, 46); - this.EnterQuestion.Style = Sunny.UI.UIStyle.Custom; + this.EnterQuestion.Style = Sunny.UI.UIStyle.Colorful; this.EnterQuestion.Symbol = 61736; this.EnterQuestion.TabIndex = 10; this.EnterQuestion.Text = "常见问题"; @@ -307,7 +307,7 @@ private void InitializeComponent() this.EnterLLCG.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterLLCG.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterLLCG.Size = new System.Drawing.Size(176, 46); - this.EnterLLCG.Style = Sunny.UI.UIStyle.Custom; + this.EnterLLCG.Style = Sunny.UI.UIStyle.Colorful; this.EnterLLCG.Symbol = 61910; this.EnterLLCG.TabIndex = 9; this.EnterLLCG.Text = "LLCG"; @@ -332,7 +332,7 @@ private void InitializeComponent() this.EnterParatranz.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterParatranz.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterParatranz.Size = new System.Drawing.Size(176, 46); - this.EnterParatranz.Style = Sunny.UI.UIStyle.Custom; + this.EnterParatranz.Style = Sunny.UI.UIStyle.Colorful; this.EnterParatranz.Symbol = 300080; this.EnterParatranz.TabIndex = 8; this.EnterParatranz.Text = "Paratranz"; @@ -357,7 +357,7 @@ private void InitializeComponent() this.EnterBilibili.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterBilibili.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterBilibili.Size = new System.Drawing.Size(176, 46); - this.EnterBilibili.Style = Sunny.UI.UIStyle.Custom; + this.EnterBilibili.Style = Sunny.UI.UIStyle.Colorful; this.EnterBilibili.Symbol = 158329; this.EnterBilibili.TabIndex = 5; this.EnterBilibili.Text = "我们的BiliBili"; @@ -382,7 +382,7 @@ private void InitializeComponent() this.EnterWebsite.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterWebsite.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterWebsite.Size = new System.Drawing.Size(176, 46); - this.EnterWebsite.Style = Sunny.UI.UIStyle.Custom; + this.EnterWebsite.Style = Sunny.UI.UIStyle.Colorful; this.EnterWebsite.Symbol = 362844; this.EnterWebsite.TabIndex = 4; this.EnterWebsite.Text = "官网"; @@ -407,7 +407,7 @@ private void InitializeComponent() this.EnterSteampp.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterSteampp.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterSteampp.Size = new System.Drawing.Size(176, 46); - this.EnterSteampp.Style = Sunny.UI.UIStyle.Custom; + this.EnterSteampp.Style = Sunny.UI.UIStyle.Colorful; this.EnterSteampp.Symbol = 357527; this.EnterSteampp.TabIndex = 3; this.EnterSteampp.Text = "Watt Toolkit"; @@ -432,7 +432,7 @@ private void InitializeComponent() this.EnterLLCGithub.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterLLCGithub.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterLLCGithub.Size = new System.Drawing.Size(176, 46); - this.EnterLLCGithub.Style = Sunny.UI.UIStyle.Custom; + this.EnterLLCGithub.Style = Sunny.UI.UIStyle.Colorful; this.EnterLLCGithub.Symbol = 161595; this.EnterLLCGithub.TabIndex = 2; this.EnterLLCGithub.Text = "汉化补丁 Github"; @@ -457,7 +457,7 @@ private void InitializeComponent() this.EnterWiki.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterWiki.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterWiki.Size = new System.Drawing.Size(176, 46); - this.EnterWiki.Style = Sunny.UI.UIStyle.Custom; + this.EnterWiki.Style = Sunny.UI.UIStyle.Colorful; this.EnterWiki.Symbol = 361912; this.EnterWiki.TabIndex = 1; this.EnterWiki.Text = "边狱公司 灰机Wiki"; @@ -482,7 +482,7 @@ private void InitializeComponent() this.EnterToolBoxGithub.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterToolBoxGithub.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(152)))), ((int)(((byte)(138))))); this.EnterToolBoxGithub.Size = new System.Drawing.Size(176, 46); - this.EnterToolBoxGithub.Style = Sunny.UI.UIStyle.Custom; + this.EnterToolBoxGithub.Style = Sunny.UI.UIStyle.Colorful; this.EnterToolBoxGithub.Symbol = 161595; this.EnterToolBoxGithub.TabIndex = 0; this.EnterToolBoxGithub.Text = "工具箱 Github"; @@ -515,17 +515,17 @@ private void InitializeComponent() this.uiGroupBox2.Controls.Add(this.uiLabel7); this.uiGroupBox2.Controls.Add(this.useGithub); this.uiGroupBox2.Controls.Add(this.uiLabel2); - this.uiGroupBox2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(248)))), ((int)(((byte)(248))))); - this.uiGroupBox2.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(248)))), ((int)(((byte)(248))))); + this.uiGroupBox2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); + this.uiGroupBox2.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); this.uiGroupBox2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiGroupBox2.Location = new System.Drawing.Point(17, 5); this.uiGroupBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiGroupBox2.MinimumSize = new System.Drawing.Size(1, 1); this.uiGroupBox2.Name = "uiGroupBox2"; this.uiGroupBox2.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0); - this.uiGroupBox2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136))))); + this.uiGroupBox2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.uiGroupBox2.Size = new System.Drawing.Size(1041, 422); - this.uiGroupBox2.Style = Sunny.UI.UIStyle.Custom; + this.uiGroupBox2.Style = Sunny.UI.UIStyle.Colorful; this.uiGroupBox2.TabIndex = 3; this.uiGroupBox2.Text = "设置"; this.uiGroupBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -585,8 +585,8 @@ private void InitializeComponent() this.NodeComboBox.ItemHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(242)))), ((int)(((byte)(238))))); this.NodeComboBox.ItemRectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.NodeComboBox.Items.AddRange(new object[] { - "镜像节点-1", - "镜像节点-2-联通优化", + "镜像节点-1-高速", + "镜像节点-2-高速-联通优化", "镜像节点-3-支持我们"}); this.NodeComboBox.ItemSelectBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.NodeComboBox.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250))))); @@ -694,7 +694,7 @@ private void InitializeComponent() this.filereplace_open_text.Location = new System.Drawing.Point(17, 270); this.filereplace_open_text.Name = "filereplace_open_text"; this.filereplace_open_text.Size = new System.Drawing.Size(357, 23); - this.filereplace_open_text.Style = Sunny.UI.UIStyle.Custom; + this.filereplace_open_text.Style = Sunny.UI.UIStyle.Colorful; this.filereplace_open_text.TabIndex = 8; this.filereplace_open_text.Text = "开启文件覆盖页面"; this.filereplace_open_text.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -705,7 +705,7 @@ private void InitializeComponent() this.config_open_text.Location = new System.Drawing.Point(17, 218); this.config_open_text.Name = "config_open_text"; this.config_open_text.Size = new System.Drawing.Size(357, 23); - this.config_open_text.Style = Sunny.UI.UIStyle.Custom; + this.config_open_text.Style = Sunny.UI.UIStyle.Colorful; this.config_open_text.TabIndex = 7; this.config_open_text.Text = "开启更改配置页面"; this.config_open_text.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -716,7 +716,7 @@ private void InitializeComponent() this.manual_open_text.Location = new System.Drawing.Point(17, 165); this.manual_open_text.Name = "manual_open_text"; this.manual_open_text.Size = new System.Drawing.Size(357, 23); - this.manual_open_text.Style = Sunny.UI.UIStyle.Custom; + this.manual_open_text.Style = Sunny.UI.UIStyle.Colorful; this.manual_open_text.TabIndex = 6; this.manual_open_text.Text = "开启手动安装页面"; this.manual_open_text.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -750,19 +750,20 @@ private void InitializeComponent() this.uiLabel7.Location = new System.Drawing.Point(17, 110); this.uiLabel7.Name = "uiLabel7"; this.uiLabel7.Size = new System.Drawing.Size(357, 23); - this.uiLabel7.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel7.Style = Sunny.UI.UIStyle.Colorful; this.uiLabel7.TabIndex = 4; this.uiLabel7.Text = "删除汉化补丁"; this.uiLabel7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // useGithub // + this.useGithub.ActiveColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.useGithub.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.useGithub.Location = new System.Drawing.Point(430, 56); this.useGithub.MinimumSize = new System.Drawing.Size(1, 1); this.useGithub.Name = "useGithub"; this.useGithub.Size = new System.Drawing.Size(74, 29); - this.useGithub.Style = Sunny.UI.UIStyle.Custom; + this.useGithub.Style = Sunny.UI.UIStyle.Colorful; this.useGithub.SwitchShape = Sunny.UI.UISwitch.UISwitchShape.Square; this.useGithub.TabIndex = 3; this.useGithub.Text = "uiSwitch1"; @@ -773,7 +774,7 @@ private void InitializeComponent() this.uiLabel2.Location = new System.Drawing.Point(17, 58); this.uiLabel2.Name = "uiLabel2"; this.uiLabel2.Size = new System.Drawing.Size(357, 23); - this.uiLabel2.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel2.Style = Sunny.UI.UIStyle.Colorful; this.uiLabel2.TabIndex = 2; this.uiLabel2.Text = "从 Github 下载文件"; this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -795,9 +796,9 @@ private void InitializeComponent() this.uiLabel9.Location = new System.Drawing.Point(18, 16); this.uiLabel9.Name = "uiLabel9"; this.uiLabel9.Size = new System.Drawing.Size(502, 36); - this.uiLabel9.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel9.Style = Sunny.UI.UIStyle.Colorful; this.uiLabel9.TabIndex = 1; - this.uiLabel9.Text = "LLC_Toolbox 版本0.5.1"; + this.uiLabel9.Text = "LLC_Toolbox 版本0.5.2"; this.uiLabel9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // uiLabel8 @@ -806,7 +807,7 @@ private void InitializeComponent() this.uiLabel8.Location = new System.Drawing.Point(18, 52); this.uiLabel8.Name = "uiLabel8"; this.uiLabel8.Size = new System.Drawing.Size(996, 278); - this.uiLabel8.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel8.Style = Sunny.UI.UIStyle.Colorful; this.uiLabel8.TabIndex = 0; this.uiLabel8.Text = resources.GetString("uiLabel8.Text"); this.uiLabel8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -1486,8 +1487,8 @@ private void InitializeComponent() this.ShowRadius = false; this.ShowRect = false; this.ShowTitleIcon = true; - this.Style = Sunny.UI.UIStyle.Custom; - this.Text = "零协会工具箱 v0.5.1"; + this.Style = Sunny.UI.UIStyle.Colorful; + this.Text = "零协会工具箱 v0.5.2"; this.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172))))); this.TitleFont = new System.Drawing.Font("微软雅黑", 12F); this.TitleHeight = 40; diff --git a/src/MainPage.cs b/src/MainPage.cs index bc37534..41acc99 100644 --- a/src/MainPage.cs +++ b/src/MainPage.cs @@ -10,6 +10,7 @@ using System.Net; using System.Net.Http; using System.Runtime.InteropServices; +using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -19,7 +20,7 @@ namespace LLC_MOD_Toolbox public partial class MainPage : UIForm { - public const string VERSION = "0.5.1"; + public const string VERSION = "0.5.2"; // 注册日志系统 private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -53,14 +54,7 @@ private void Init_Toolbox() // ChangeStatu("获取最快节点。"); // fastestNode = GetFastnetNode(); - fastestNode = "tianyi"; - - bool isgit = fastestNode == "github.com"; - if (isgit == true) - { - useGithub.Active = true; - } - if (CheckToolboxUpdate(VERSION, isgit)) + if (CheckToolboxUpdate(VERSION, false)) { logger.Error("安装器存在更新"); MessageBox.Show("安装器存在更新", "存在更新", MessageBoxButtons.OK); @@ -128,11 +122,6 @@ private async void installButton_Click(object sender, EventArgs e) logger.Info("检查某些可能出现的问题。"); - if (useGithub.Active == false && fastestNode == "github.com") - { - logger.Warn("在关闭使用 Github 的情况下,最快节点为 Github 。已自动切换至 Onedrive For Business 。"); - fastestNode = "download.zeroasso.top"; - } try { logger.Info("下载 BepInEx For LLC 中。"); @@ -169,7 +158,6 @@ private async void installButton_Click(object sender, EventArgs e) { logger.Info("未检测到正确Bepinex。"); MessageBox.Show("如果你安装了杀毒软件,接下来可能会提示工具箱正在修改关键dll。\n允许即可。如果不信任汉化补丁,可以退出本程序。", "警告"); - BepInExUrl = "https://" + fastestNode + "/files/BepInEx-IL2CPP-x64.7z"; BepInExZipPath = Path.Combine(limbusCompanyDir, "BepInEx-IL2CPP-x64.7z"); logger.Info("BepInEx Zip目录: " + BepInExZipPath); await DownloadFileAutoSelect("BepInEx-IL2CPP-x64.7z", BepInExZipPath); @@ -308,6 +296,12 @@ private async void installButton_Click(object sender, EventArgs e) if (new Version(currentVersion) < new Version(latestLLCVersion.Remove(0, 1))) { await DownloadFileAutoSelect("LimbusLocalize_BIE_" + latestLLCVersion + ".7z", limbusLocalizeZipPath); + if (GetLimbusLocalizeHash() != CalculateSHA256(limbusLocalizeZipPath)) + { + logger.Error("校验Hash失败。"); + MessageBox.Show("校验Hash失败。\n请等待数分钟或更换节点。\n如果问题仍然出现,请进行反馈。","校验失败"); + Close(); + } logger.Info("解压模组本体 zip 中。"); new SevenZipExtractor(limbusLocalizeZipPath).ExtractAll(limbusCompanyDir, true); logger.Info("删除模组本体 zip 。"); @@ -317,6 +311,16 @@ private async void installButton_Click(object sender, EventArgs e) else { await DownloadFileAutoSelect("LimbusLocalize_BIE_" + latestLLCVersion + ".7z", limbusLocalizeZipPath); + if (GetLimbusLocalizeHash() != CalculateSHA256(limbusLocalizeZipPath)) + { + logger.Error("校验Hash失败。"); + MessageBox.Show("校验Hash失败。\n请等待数分钟或更换节点。\n如果问题仍然出现,请进行反馈。", "校验失败"); + Close(); + } + else + { + logger.Info("校验Hash成功。"); + } logger.Info("解压模组本体 zip 中。"); new SevenZipExtractor(limbusLocalizeZipPath).ExtractAll(limbusCompanyDir, true); logger.Info("删除模组本体 zip 。"); @@ -480,28 +484,12 @@ private async Task DownloadFileAutoSelect(string file, string filePath) { string unicom = "http://81.70.83.185:5244/d/unicom/" + file; string tianyi = "http://81.70.83.185:5244/d/tianyi/" + file; - string ofb = "http://81.70.83.185:5244/d/ofb/" + file; + string ofb = "http://81.70.83.185:5244/d/od/" + file; // 是,我知道这段代码和if else一样,很屎。 // 体谅一下。没办法。 if (node == String.Empty) { - try - { - await DownloadFileAsync(unicom, filePath); - } - catch (Exception ex2) - { - logger.Error("从unicom下载文件出现了问题。\n" + ex2.ToString()); - try - { - await DownloadFileAsync(tianyi, filePath); - } - catch (Exception ex3) - { - logger.Error("从tianyi下载文件出现了问题。\n" + ex3.ToString()); - await DownloadFileAsync(ofb, filePath); - } - } + await DownloadFileAsync(ofb, filePath); } else { @@ -689,6 +677,42 @@ static bool CheckChineseFontAssetUpdate(string version, bool IsGithub, out strin return false; } + private string GetLimbusLocalizeHash() + { + string unicom = "http://81.70.83.185:5244/d/unicom/LimbusLocalizeHash.json"; + string tianyi = "http://81.70.83.185:5244/d/tianyi/LimbusLocalizeHash.json"; + string ofb = "http://81.70.83.185:5244/d/od/LimbusLocalizeHash.json"; + using WebClient client = new(); + client.Headers.Add("User-Agent", "request"); + string raw = string.Empty; + if (node == String.Empty) + { + raw = new StreamReader(client.OpenRead(new Uri(ofb)), Encoding.UTF8).ReadToEnd(); + } + else + { + switch (node) + { + case "unicom": + raw = new StreamReader(client.OpenRead(new Uri(unicom)), Encoding.UTF8).ReadToEnd(); + break; + case "tianyi": + raw = new StreamReader(client.OpenRead(new Uri(tianyi)), Encoding.UTF8).ReadToEnd(); + break; + case "ofb": + raw = new StreamReader(client.OpenRead(new Uri(ofb)), Encoding.UTF8).ReadToEnd(); + break; + default: + raw = new StreamReader(client.OpenRead(new Uri(ofb)), Encoding.UTF8).ReadToEnd(); + break; + } + } + var hashObject = JSONNode.Parse(raw).AsObject; + string hash = hashObject["hash"].Value; + logger.Info("获取到的最新Hash为:" + hash); + return hash; + } + static bool CheckToolboxUpdate(string version, bool IsGithub) { logger.Info("正在检查工具箱更新。"); @@ -755,7 +779,18 @@ static bool CheckBepInExUpdate(string version, bool IsGithub, out string tag) } return false; } - + public static string CalculateSHA256(string filePath) + { + using (var sha256 = SHA256.Create()) + { + using (var fileStream = File.OpenRead(filePath)) + { + byte[] hashBytes = sha256.ComputeHash(fileStream); + logger.Info("计算位置为 " + filePath + " 的文件的Hash结果为:" + BitConverter.ToString(hashBytes).Replace("-", "").ToLower()); + return BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); + } + } + } private void deleteButton_Click(object sender, EventArgs e) { logger.Info("点击删除模组"); @@ -959,10 +994,10 @@ private void NodeComboBox_SelectedIndexChanged(object sender, EventArgs e) { switch (NodeComboBox.Text) { - case "镜像节点-1": + case "镜像节点-1-高速": node = "tianyi"; break; - case "镜像节点-2-联通优化": + case "镜像节点-2-高速-联通优化": node = "unicom"; break; case "镜像节点-3-支持我们": @@ -1328,17 +1363,17 @@ private void download_filereplace_Click(object sender, EventArgs e) private bool Has_NET_6_0 = false; private bool isWindows10; - private bool canUseAutoInstall; private string node = string.Empty; - private string fastestNode; private string limbusCompanyDir; private string limbusCompanyGameDir; private string BepInExUrl; private string BepInExZipPath; + private string LimbusLocalizeHash; + private bool manual_has_open; private bool config_has_open; private bool filereplace_has_open; diff --git a/src/MainPage.resx b/src/MainPage.resx index 9f601f3..ea7bb29 100644 --- a/src/MainPage.resx +++ b/src/MainPage.resx @@ -117,6 +117,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 汉化:零协会全体成员 +首席外交官(划掉)LLTT系长:N071(北岚) +LLC部长:Bright1192(奈芙) +汉化补丁作者:Bright1192(奈芙) +BepInEx作者:BepInEx团队 +BepInEx For LLC分支作者:Bright1192(奈芙) +字体贡献者:茜 +安装器原作者&技术支持:Bright1192(奈芙) +工具箱重制:曾小皮-ZengXiaoPi +镜像节点:曾小皮-ZengXiaoPi + +使用 SunnyUI https://gitee.com/yhuse/SunnyUI +最棒的WinForm美化! + @@ -1884,19 +1899,4 @@ //8= - - 汉化:零协会全体成员 -首席外交官(划掉)LLTT系长:N071(北岚) -LLC部长:Bright1192(奈芙) -汉化补丁作者:Bright1192(奈芙) -BepInEx作者:BepInEx团队 -BepInEx For LLC分支作者:Bright1192(奈芙) -字体贡献者:茜 -安装器原作者&技术支持:Bright1192(奈芙) -工具箱重制:曾小皮-ZengXiaoPi -镜像节点:曾小皮-ZengXiaoPi - -使用 SunnyUI https://gitee.com/yhuse/SunnyUI -最棒的WinForm美化! - \ No newline at end of file