From eae4a9584b9e021ff8ab6981a0560c36f647a727 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 23 May 2025 11:05:19 +0800 Subject: [PATCH] Use readonly bool variable --- Flow.Launcher/Helper/AutoStartup.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/Helper/AutoStartup.cs b/Flow.Launcher/Helper/AutoStartup.cs index 7a1a180b4..919eb52d2 100644 --- a/Flow.Launcher/Helper/AutoStartup.cs +++ b/Flow.Launcher/Helper/AutoStartup.cs @@ -17,6 +17,8 @@ public class AutoStartup private const string LogonTaskName = $"{Constant.FlowLauncher} Startup"; private const string LogonTaskDesc = $"{Constant.FlowLauncher} Auto Startup"; + private static readonly bool _isAdministrator = Win32Helper.IsAdministrator(); + public static void CheckIsEnabled(bool useLogonTaskForStartup, bool alwaysRunAsAdministrator) { // We need to check both because if both of them are enabled, @@ -186,7 +188,7 @@ public class AutoStartup td.Actions.Add(Constant.ExecutablePath); // Only if the app is running as administrator, we can set the run level to highest - if (Win32Helper.IsAdministrator() && alwaysRunAsAdministrator) + if (_isAdministrator && alwaysRunAsAdministrator) { td.Principal.RunLevel = TaskRunLevel.Highest; }