From 739de2260ac48ae46613357f6f9006bfe8a128d9 Mon Sep 17 00:00:00 2001 From: Andrey Parfenov Date: Tue, 7 Nov 2023 22:19:11 +0100 Subject: [PATCH] wip Signed-off-by: Andrey Parfenov --- .../brainflow/brainflow/platform_helper.cs | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/csharp_package/brainflow/brainflow/platform_helper.cs b/csharp_package/brainflow/brainflow/platform_helper.cs index c25ab5498..b6d3adf69 100644 --- a/csharp_package/brainflow/brainflow/platform_helper.cs +++ b/csharp_package/brainflow/brainflow/platform_helper.cs @@ -1,5 +1,5 @@ using System; - +using System.Runtime.InteropServices; namespace brainflow { @@ -18,28 +18,28 @@ public static LibraryEnvironment get_library_environment () { if (library_env == LibraryEnvironment.Unknown) { - switch (Environment.OSVersion.Platform) + if (RuntimeInformation.IsOSPlatform (OSPlatform.Linux)) + { + Console.Error.Write ("Linux platform detected"); + library_env = LibraryEnvironment.x64; + } + if (RuntimeInformation.IsOSPlatform (OSPlatform.OSX)) + { + Console.Error.Write ("OSX platform detected"); + library_env = LibraryEnvironment.MacOS; + } + if (RuntimeInformation.IsOSPlatform (OSPlatform.Windows)) { - case PlatformID.MacOSX: - library_env = LibraryEnvironment.MacOS; - Console.Error.Write ("MacOS platform detected"); - break; - case PlatformID.Unix: - library_env = LibraryEnvironment.Linux; - Console.Error.Write ("Linux platform detected"); - break; - default: - if (Environment.Is64BitProcess) - { - Console.Error.Write ("Win64 platform detected"); - library_env = LibraryEnvironment.x64; - } - else - { - Console.Error.Write ("Win32 platform detected"); - library_env = LibraryEnvironment.x86; - } - break; + if (Environment.Is64BitProcess) + { + Console.Error.Write ("Win64 platform detected"); + library_env = LibraryEnvironment.x64; + } + else + { + Console.Error.Write ("Win32 platform detected"); + library_env = LibraryEnvironment.x86; + } } }