1
1
using System ;
2
-
2
+ using System . Runtime . InteropServices ;
3
3
4
4
namespace brainflow
5
5
{
@@ -18,28 +18,28 @@ public static LibraryEnvironment get_library_environment ()
18
18
{
19
19
if ( library_env == LibraryEnvironment . Unknown )
20
20
{
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 ) )
22
32
{
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
+ }
43
43
}
44
44
}
45
45
0 commit comments