using System; using System.Linq; namespace UpToolLib.v1 { public static class PlatformCheck { public static bool IsWindows => new[] { PlatformID.Xbox, PlatformID.Win32S, PlatformID.Win32Windows, PlatformID.Win32NT, PlatformID.WinCE } .Contains(Environment.OSVersion.Platform); public static bool IsPosix => !IsWindows; public const string Windows = "WINDOWS"; public const string Posix = "POSIX"; public static string CurrentPlatform => IsWindows ? Windows : IsPosix ? Posix : throw new Exception("Unexpected PlatformCheck"); } }