revert to VB and update to new project file format
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
|
||||
namespace Pilz.Runtime
|
||||
{
|
||||
public enum OSType
|
||||
{
|
||||
Windows,
|
||||
Linux,
|
||||
OSX
|
||||
}
|
||||
}
|
||||
9
Pilz/Runtime/OSType.vb
Normal file
9
Pilz/Runtime/OSType.vb
Normal file
@@ -0,0 +1,9 @@
|
||||
Namespace Runtime
|
||||
|
||||
Public Enum OSType
|
||||
Windows
|
||||
Linux
|
||||
OSX
|
||||
End Enum
|
||||
|
||||
End Namespace
|
||||
@@ -1,32 +0,0 @@
|
||||
using global::System.Runtime.InteropServices;
|
||||
|
||||
namespace Pilz.Runtime
|
||||
{
|
||||
public static class RuntimeInformationsEx
|
||||
{
|
||||
private static OSType? oSType = null;
|
||||
public static OSType OSType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (oSType is null)
|
||||
{
|
||||
switch (true)
|
||||
{
|
||||
case object _ when RuntimeInformation.IsOSPlatform(OSPlatform.Windows):
|
||||
oSType = OSType.Windows;
|
||||
break;
|
||||
case object _ when RuntimeInformation.IsOSPlatform(OSPlatform.Linux):
|
||||
oSType = OSType.Linux;
|
||||
break;
|
||||
case object _ when RuntimeInformation.IsOSPlatform(OSPlatform.OSX):
|
||||
oSType = OSType.OSX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (OSType)OSType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Pilz/Runtime/RuntimeInformationsEx.vb
Normal file
28
Pilz/Runtime/RuntimeInformationsEx.vb
Normal file
@@ -0,0 +1,28 @@
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
Namespace Runtime
|
||||
|
||||
Public Module RuntimeInformationsEx
|
||||
|
||||
Public ReadOnly Property OSType As OSType
|
||||
Get
|
||||
Static t As OSType? = Nothing
|
||||
|
||||
If t Is Nothing Then
|
||||
Select Case True
|
||||
Case RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
|
||||
t = OSType.Windows
|
||||
Case RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
|
||||
t = OSType.Linux
|
||||
Case RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
|
||||
t = OSType.OSX
|
||||
End Select
|
||||
End If
|
||||
|
||||
Return t
|
||||
End Get
|
||||
End Property
|
||||
|
||||
End Module
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user