Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite213a97

Browse files
committed
Implement InitializePlatformData without calling Python
1 parenta9b91a3 commite213a97

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎src/runtime/runtime.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ internal static void Initialize(bool initSigs = false)
356356
/// </summary>
357357
privatestaticvoidInitializePlatformData()
358358
{
359+
#if!NETSTANDARD
359360
IntPtrop;
360361
IntPtrfn;
361362
IntPtrplatformModule=PyImport_ImportModule("platform");
@@ -391,6 +392,34 @@ private static void InitializePlatformData()
391392
MType=MachineType.Other;
392393
}
393394
Machine=MType;
395+
#else
396+
OperatingSystem=OperatingSystemType.Other;
397+
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
398+
OperatingSystem=OperatingSystemType.Linux;
399+
elseif(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
400+
OperatingSystem=OperatingSystemType.Darwin;
401+
elseif(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
402+
OperatingSystem=OperatingSystemType.Windows;
403+
404+
switch(RuntimeInformation.ProcessArchitecture)
405+
{
406+
caseArchitecture.X86:
407+
Machine=MachineType.i386;
408+
break;
409+
caseArchitecture.X64:
410+
Machine=MachineType.x86_64;
411+
break;
412+
caseArchitecture.Arm:
413+
Machine=MachineType.armv7l;
414+
break;
415+
caseArchitecture.Arm64:
416+
Machine=MachineType.aarch64;
417+
break;
418+
default:
419+
Machine=MachineType.Other;
420+
break;
421+
}
422+
#endif
394423
}
395424

396425
internalstaticvoidShutdown()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp