add Pilz.Runtime.RuntimeInformationsEx & Pilz.OSType
This commit is contained in:
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
|
||||
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 OSPlattform
|
||||
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