pschelpdesk/Vendor/Prise/Platform/IPlatformAbstraction.cs
2024-11-04 20:45:34 +01:00

18 lines
674 B
C#

namespace Prise.Platform
{
public interface IPlatformAbstraction
{
bool IsLinux();
bool IsOSX();
bool IsWindows();
}
public class DefaultPlatformAbstraction : IPlatformAbstraction
{
public bool IsLinux() => System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux);
public bool IsOSX() => System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX);
public bool IsWindows() => System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
}
}