add Pilz.Runtime.RuntimeInformationsEx & Pilz.OSType
This commit is contained in:
@@ -83,6 +83,8 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Runtime\OSType.vb" />
|
||||||
|
<Compile Include="Runtime\RuntimeInformationsEx.vb" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="My Project\Resources.resx">
|
<EmbeddedResource Include="My Project\Resources.resx">
|
||||||
|
|||||||
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