增加项目,分层

This commit is contained in:
chfei committed 2026-09-11 19:11:12 +08:00
1 parent 6e995a5bdb
commit 0a3e5af6a9
234 files changed
+26994 -1

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace MAX.Framework.Helpers;
public class SystemHelper
{
public static bool IsAdministratorSafe
{
get
{
try
{
return IsAdministrator;
}
catch (Exception ex)
{
Debug.WriteLine(ex);
return false;
}
}
}
public static bool IsAdministrator
{
get
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new(current);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}
}
}