From ff059104c658d3a6cc9efd9bf42d97c821d3be48 Mon Sep 17 00:00:00 2001 From: schedpas Date: Tue, 15 Sep 2020 14:39:30 +0200 Subject: [PATCH] add Pilz.Runtime.RuntimeInformationsEx & Pilz.OSType --- Pilz/Pilz.vbproj | 2 ++ Pilz/Runtime/OSType.vb | 9 +++++++++ Pilz/Runtime/RuntimeInformationsEx.vb | 28 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 Pilz/Runtime/OSType.vb create mode 100644 Pilz/Runtime/RuntimeInformationsEx.vb diff --git a/Pilz/Pilz.vbproj b/Pilz/Pilz.vbproj index daca82a..a45f138 100644 --- a/Pilz/Pilz.vbproj +++ b/Pilz/Pilz.vbproj @@ -83,6 +83,8 @@ Settings.settings True + + diff --git a/Pilz/Runtime/OSType.vb b/Pilz/Runtime/OSType.vb new file mode 100644 index 0000000..caf344b --- /dev/null +++ b/Pilz/Runtime/OSType.vb @@ -0,0 +1,9 @@ +Namespace Runtime + + Public Enum OSType + Windows + Linux + OSX + End Enum + +End Namespace diff --git a/Pilz/Runtime/RuntimeInformationsEx.vb b/Pilz/Runtime/RuntimeInformationsEx.vb new file mode 100644 index 0000000..a215a3c --- /dev/null +++ b/Pilz/Runtime/RuntimeInformationsEx.vb @@ -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