diff --git a/Netch/Global.cs b/Netch/Global.cs index eb1cfceb..9d317c50 100644 --- a/Netch/Global.cs +++ b/Netch/Global.cs @@ -22,6 +22,8 @@ namespace Netch public static readonly string NetchDir = Application.StartupPath; + public static readonly string NetchExecutable = Application.ExecutablePath; + /// /// 主窗体的静态实例 /// diff --git a/Netch/Netch.cs b/Netch/Netch.cs index 50abb4a0..840ece01 100644 --- a/Netch/Netch.cs +++ b/Netch/Netch.cs @@ -69,7 +69,7 @@ namespace Netch } Logging.Info($"版本: {UpdateChecker.Owner}/{UpdateChecker.Repo}@{UpdateChecker.Version}"); - Task.Run(() => { Logging.Info($"主程序 SHA256: {Utils.Utils.SHA256CheckSum(Application.ExecutablePath)}"); }); + Task.Run(() => { Logging.Info($"主程序 SHA256: {Utils.Utils.SHA256CheckSum(Global.NetchExecutable)}"); }); Task.Run(() => { Logging.Info("启动单实例"); diff --git a/Netch/Updater/Updater.cs b/Netch/Updater/Updater.cs index 486d8a0a..4ee34456 100644 --- a/Netch/Updater/Updater.cs +++ b/Netch/Updater/Updater.cs @@ -41,7 +41,7 @@ namespace Netch.Updater MoveDirectory(Path.Combine(extractPath, "Netch"), Global.NetchDir, true); Global.Mutex.ReleaseMutex(); - Process.Start(Application.ExecutablePath); + Process.Start(Global.NetchExecutable); Global.MainForm.Exit(true); } diff --git a/Netch/Utils/Utils.cs b/Netch/Utils/Utils.cs index 92acbc1f..048a88ef 100644 --- a/Netch/Utils/Utils.cs +++ b/Netch/Utils/Utils.cs @@ -257,7 +257,7 @@ namespace Netch.Utils td.Principal.RunLevel = TaskRunLevel.Highest; td.Triggers.Add(new LogonTrigger()); - td.Actions.Add(new ExecAction(Application.ExecutablePath)); + td.Actions.Add(new ExecAction(Global.NetchExecutable)); td.Settings.ExecutionTimeLimit = TimeSpan.Zero; td.Settings.DisallowStartIfOnBatteries = false;