mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-22 09:36:09 +08:00
23 lines
637 B
C#
23 lines
637 B
C#
using System.Security.Principal;
|
|
|
|
namespace System.Application.Services.Implementation
|
|
{
|
|
partial class WindowsDesktopPlatformServiceImpl
|
|
{
|
|
#region Administrator
|
|
|
|
static readonly Lazy<bool> mIsAdministrator = new Lazy<bool>(IsAdministrator_);
|
|
|
|
static bool IsAdministrator_()
|
|
=> new WindowsPrincipal(WindowsIdentity.GetCurrent())
|
|
.IsInRole(WindowsBuiltInRole.Administrator);
|
|
|
|
/// <summary>
|
|
/// 是否是管理员权限
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool IsAdministrator => mIsAdministrator.Value;
|
|
|
|
#endregion
|
|
}
|
|
} |