convert VB to C#

This commit is contained in:
2020-09-24 11:21:53 +02:00
parent 64277916cd
commit fecbeb4659
320 changed files with 17755 additions and 10320 deletions

10
Pilz/Runtime/OSType.cs Normal file
View File

@@ -0,0 +1,10 @@
namespace Pilz.Runtime
{
public enum OSType
{
Windows,
Linux,
OSX
}
}

View File

@@ -1,9 +0,0 @@
Namespace Runtime
Public Enum OSType
Windows
Linux
OSX
End Enum
End Namespace

View File

@@ -0,0 +1,32 @@
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;
}
}
}
}

View File

@@ -1,28 +0,0 @@
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