This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/UpToolLib/v1/PlatformCheck.cs

23 lines
687 B
C#

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");
}
}