30 lines
650 B
C#
30 lines
650 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace Deploymentcenter.Client;
|
|
|
|
public static class OperatingSystemHelpers
|
|
{
|
|
public static bool IsWindows()
|
|
{
|
|
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
|
}
|
|
|
|
public static bool IsLinux()
|
|
{
|
|
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
|
}
|
|
|
|
public static bool IsMacOS()
|
|
{
|
|
return RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
|
}
|
|
|
|
public static string GetPlatformCode()
|
|
{
|
|
if (IsWindows()) return "win";
|
|
if (IsLinux()) return "lin";
|
|
if (IsMacOS()) return "mac";
|
|
return "unk";
|
|
}
|
|
}
|