Files
qhmes/yy-admin-master/YY.Admin.Core/Helper/SystemHelper.cs

30 lines
1.0 KiB
C#
Raw Normal View History

using HandyControl.Data;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using YY.Admin.Tools.Interop;
namespace YY.Admin.Core.Helper
{
public class SystemHelper
{
public static SystemVersionInfo GetSystemVersionInfo()
{
var osv = new InteropValues.RTL_OSVERSIONINFOEX();
osv.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osv);
InteropMethods.Gdip.RtlGetVersion(out osv);
return new SystemVersionInfo((int)osv.dwMajorVersion, (int)osv.dwMinorVersion, (int)osv.dwBuildNumber);
}
private const string SkinTypeRegistryKeyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
private const string SkinTypeRegistryValueName = "AppsUseLightTheme";
public static bool DetermineIfInLightThemeMode()
{
var value = Registry.GetValue(SkinTypeRegistryKeyName, SkinTypeRegistryValueName, "0");
return value != null && value.ToString() != "0";
}
}
}