mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Detect CPU model name on Windows ARM
Uses WMI query
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
<PackageVersion Include="SpaceWizards.NFluidsynth" Version="0.2.0" />
|
||||
<PackageVersion Include="SpaceWizards.SharpFont" Version="1.0.2" />
|
||||
<PackageVersion Include="SpaceWizards.Sodium" Version="0.2.1" />
|
||||
<PackageVersion Include="System.Management" Version="9.0.8" />
|
||||
<PackageVersion Include="TerraFX.Interop.Windows" Version="10.0.26100.1" />
|
||||
<PackageVersion Include="TerraFX.Interop.Xlib" Version="6.4.0" />
|
||||
<PackageVersion Include="VorbisPizza" Version="1.3.0" />
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<PackageReference Include="Microsoft.ILVerification" PrivateAssets="compile" />
|
||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
|
||||
<PackageReference Include="Nett" PrivateAssets="compile" />
|
||||
<PackageReference Include="System.Management" />
|
||||
<PackageReference Include="VorbisPizza" PrivateAssets="compile" />
|
||||
<PackageReference Include="Pidgin" />
|
||||
<PackageReference Include="prometheus-net" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Intrinsics.Arm;
|
||||
using System.Runtime.Intrinsics.Wasm;
|
||||
@@ -31,8 +32,14 @@ internal static class SystemInformation
|
||||
if (name != null)
|
||||
return name;
|
||||
}
|
||||
else if (OperatingSystem.IsWindows())
|
||||
{
|
||||
var name = GetProcessorModelWindows();
|
||||
if (name != null)
|
||||
return name;
|
||||
}
|
||||
|
||||
// TODO: ask OS as fallback for when x86 CPUID isn't available on Windows and Linux.
|
||||
// TODO: ask OS as fallback for when x86 CPUID isn't available on Linux.
|
||||
|
||||
return "Unknown processor model";
|
||||
}
|
||||
@@ -93,6 +100,18 @@ internal static class SystemInformation
|
||||
void* newp,
|
||||
nint newlen);
|
||||
|
||||
private static string? GetProcessorModelWindows()
|
||||
{
|
||||
var mgs = new ManagementObjectSearcher("select Name from Win32_Processor");
|
||||
foreach (var o in mgs.Get())
|
||||
{
|
||||
var obj = (ManagementObject)o;
|
||||
return (string)obj["Name"];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<string> GetIntrinsics()
|
||||
{
|
||||
var options = new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user