Logger.StackTrace
This commit is contained in:
1 parent
d3daf1988f
commit
c18fef7074
3 files changed
+9
-2
No files matched your search
@@ -0,0 +1,14 @@
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace MeloongCore;
|
||||
public static class WindowsUtils {
|
||||
|
||||
/// <summary>
|
||||
/// 当前程序是否拥有管理员权限。
|
||||
/// </summary>
|
||||
public static bool HasAdminRole() {
|
||||
using var id = WindowsIdentity.GetCurrent();
|
||||
return new WindowsPrincipal(id).IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user