mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add IsAdmin
This commit is contained in:
parent
a3212affd7
commit
8b8fcd8c7b
1 changed files with 9 additions and 0 deletions
|
|
@ -47,6 +47,8 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\WindowsApps\wt.exe"),
|
||||
};
|
||||
|
||||
private static readonly bool IsAdmin = IsAdministrator();
|
||||
|
||||
private Settings _settings;
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
|
|
@ -518,5 +520,12 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
{
|
||||
Context.API.RemoveGlobalKeyboardCallback(API_GlobalKeyboardEvent);
|
||||
}
|
||||
|
||||
private static bool IsAdministrator()
|
||||
{
|
||||
using var identity = WindowsIdentity.GetCurrent();
|
||||
var principal = new WindowsPrincipal(identity);
|
||||
return principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue