Skip to content

Commit 739de22

Browse files
committed
wip
Signed-off-by: Andrey Parfenov <[email protected]>
1 parent b2e080e commit 739de22

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

csharp_package/brainflow/brainflow/platform_helper.cs

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
2+
using System.Runtime.InteropServices;
33

44
namespace brainflow
55
{
@@ -18,28 +18,28 @@ public static LibraryEnvironment get_library_environment ()
1818
{
1919
if (library_env == LibraryEnvironment.Unknown)
2020
{
21-
switch (Environment.OSVersion.Platform)
21+
if (RuntimeInformation.IsOSPlatform (OSPlatform.Linux))
22+
{
23+
Console.Error.Write ("Linux platform detected");
24+
library_env = LibraryEnvironment.x64;
25+
}
26+
if (RuntimeInformation.IsOSPlatform (OSPlatform.OSX))
27+
{
28+
Console.Error.Write ("OSX platform detected");
29+
library_env = LibraryEnvironment.MacOS;
30+
}
31+
if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows))
2232
{
23-
case PlatformID.MacOSX:
24-
library_env = LibraryEnvironment.MacOS;
25-
Console.Error.Write ("MacOS platform detected");
26-
break;
27-
case PlatformID.Unix:
28-
library_env = LibraryEnvironment.Linux;
29-
Console.Error.Write ("Linux platform detected");
30-
break;
31-
default:
32-
if (Environment.Is64BitProcess)
33-
{
34-
Console.Error.Write ("Win64 platform detected");
35-
library_env = LibraryEnvironment.x64;
36-
}
37-
else
38-
{
39-
Console.Error.Write ("Win32 platform detected");
40-
library_env = LibraryEnvironment.x86;
41-
}
42-
break;
33+
if (Environment.Is64BitProcess)
34+
{
35+
Console.Error.Write ("Win64 platform detected");
36+
library_env = LibraryEnvironment.x64;
37+
}
38+
else
39+
{
40+
Console.Error.Write ("Win32 platform detected");
41+
library_env = LibraryEnvironment.x86;
42+
}
4343
}
4444
}
4545

0 commit comments

Comments
 (0)