using System; using System.Collections.Generic; using System.Text; namespace Apewer { /// 系统实用工具。 public class SystemUtility { #if NETSTD || NETCORE /// 当前操作系统是 Windows。 public static bool IsWindows { get => System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows); } /// 当前操作系统是 OS X 或 macOS。 public static bool IsOSX { get => System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX); } /// 当前操作系统是 Linux。 public static bool IsLinux { get => System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux); } #endif } }