From 7ce1127006fb3b0e5d68d3fe1a0f5c762097e706 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Fri, 1 Oct 2021 12:30:57 +0800 Subject: [PATCH] Move bin folder check before create directories exist. cleanup Core.bin strings --- Netch/Constants.cs | 1 - Netch/Netch.cs | 27 +++++++++++++++++---------- Netch/Resources/zh-CN | 3 +-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Netch/Constants.cs b/Netch/Constants.cs index e87dd354..716639ad 100644 --- a/Netch/Constants.cs +++ b/Netch/Constants.cs @@ -7,7 +7,6 @@ public const string AioDnsRuleFile = "bin\\aiodns.conf"; public const string NFDriver = "bin\\nfdriver.sys"; - public const string NFCore = "bin\\core.bin"; public const string STUNServersFile = "bin\\stun.txt"; public const string LogFile = "logging\\application.log"; diff --git a/Netch/Netch.cs b/Netch/Netch.cs index 20c874b0..e4b83ff3 100644 --- a/Netch/Netch.cs +++ b/Netch/Netch.cs @@ -45,6 +45,13 @@ namespace Netch var binPath = Path.Combine(Global.NetchDir, "bin"); Environment.SetEnvironmentVariable("PATH", $"{Environment.GetEnvironmentVariable("PATH")};{binPath}"); + if (!Directory.Exists("bin") || !Directory.EnumerateFileSystemEntries("bin").Any()) + { + i18N.Load("System"); + MessageBoxX.Show(i18N.Translate("Please extract all files then run the program!")); + Environment.Exit(2); + } + Updater.CleanOld(Global.NetchDir); // 预创建目录 @@ -86,12 +93,6 @@ namespace Netch // 加载语言 i18N.Load(Global.Settings.Language); - if (!Directory.Exists("bin") || !Directory.EnumerateFileSystemEntries("bin").Any()) - { - MessageBoxX.Show(i18N.Translate("Please extract all files then run the program!")); - Environment.Exit(2); - } - Task.Run(LogEnvironment).Forget(); CheckClr(); CheckOS(); @@ -137,8 +138,11 @@ namespace Netch { Log.Information("CLR: {Version}", Environment.Version); Flags.NoSupport = true; - if(!Global.Settings.NoSupportDialog) - MessageBoxX.Show(i18N.TranslateFormat("{0} won't get developers' support, Please do not report any issues or seek help from developers.", "CLR " + Environment.Version), LogLevel.WARNING); + if (!Global.Settings.NoSupportDialog) + MessageBoxX.Show( + i18N.TranslateFormat("{0} won't get developers' support, Please do not report any issues or seek help from developers.", + "CLR " + Environment.Version), + LogLevel.WARNING); } } @@ -147,8 +151,11 @@ namespace Netch if (Environment.OSVersion.Version.Build < 17763) { Flags.NoSupport = true; - if(!Global.Settings.NoSupportDialog) - MessageBoxX.Show(i18N.TranslateFormat("{0} won't get developers' support, Please do not report any issues or seek help from developers.", Environment.OSVersion), LogLevel.WARNING); + if (!Global.Settings.NoSupportDialog) + MessageBoxX.Show( + i18N.TranslateFormat("{0} won't get developers' support, Please do not report any issues or seek help from developers.", + Environment.OSVersion), + LogLevel.WARNING); } } diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index 33efd1f5..2440d839 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -178,8 +178,7 @@ "The {0} port is in use.": "{0} 端口已被占用", "The {0} port is reserved by system.": "{0} 端口是系统保留端口", - - "\"Core.bin\" is missing. Please check your Antivirus software": "找不到 \"Core.bin\" 文件!请检查你的杀毒软件。", + "{0} won't get developers' support, Please do not report any issues or seek help from developers.": "{0} 将不会得到开发者的支持,请不要报告任何问题或寻求开发人员的帮助。", "No Support": "不受支持" }