From 6da0b6a628fca2d9f011854bc8cac6c4cdd8f064 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 16 Mar 2020 06:31:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 组合 StartupPath 未见意义 --- v2rayN/v2rayN/Tool/Utils.cs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs index 06e3bd4e..c1322046 100644 --- a/v2rayN/v2rayN/Tool/Utils.cs +++ b/v2rayN/v2rayN/Tool/Utils.cs @@ -485,24 +485,16 @@ namespace v2rayN /// /// /// - public static int SetAutoRun(bool run) + public static void SetAutoRun(bool run) { try { - if (run) - { - string exePath = GetExePath(); - RegWriteValue(autoRunRegPath, autoRunName, exePath); - } - else - { - RegWriteValue(autoRunRegPath, autoRunName, ""); - } + string exePath = GetExePath(); + RegWriteValue(autoRunRegPath, autoRunName, run ? exePath : ""); } catch { } - return 0; } /// @@ -551,15 +543,7 @@ namespace v2rayN public static string StartupPath() { - try - { - string exePath = GetExePath(); - return exePath.Substring(0, exePath.LastIndexOf("\\", StringComparison.Ordinal)); - } - catch - { - return Application.StartupPath; - } + return Application.StartupPath; } public static string RegReadValue(string path, string name, string def)