Если у меня есть следующий код, как мне нужно реализовать методы ResolveXIdToXName?
До сих пор мне не удалось получить простую в использовании библиотеку или API, чтобы быстро отправить эту проблему и решить ее.
Черт возьми, я бы даже был на седьмом небе от счастья, если бы я мог просто получить Devices PNPDeviceID, поскольку я знаю, как получить из него данные имени
using System.Text.Json;
using Vortice.DXGI;
namespace DxGPUReader;
internal class Program
{
static void Main(string[] args)
{
using (IDXGIFactory6 factory = DXGI.CreateDXGIFactory2(false))
{
for (uint i = 0; ; ++i)
{
// Enum adapters until DXGI_ERROR_NOT_FOUND
var result1 = factory.EnumAdapters1(i, out IDXGIAdapter1 adapter);
if (result1.Failure)
break;
using (adapter)
{
AdapterDescription1 desc = adapter.Description1;
// Skip software adapters (like Microsoft Basic Render Driver)
if ((desc.Flags & AdapterFlags.Software) != 0)
continue;
Console.WriteLine($"GPU {i}: {desc.Description}");
Console.WriteLine($" Vendor ID: {desc.VendorId}");
Console.WriteLine($" Vendor ID Decoded: {ResolveVendorIdToVendorName(desc.VendorId)}");
Console.WriteLine($" Device ID: {desc.DeviceId}");
Console.WriteLine($" Device ID Decoded: {ResolveDeviceIdToDeviceName(desc.DeviceId)}");
Console.WriteLine($" Dedicated Video Memory: {desc.DedicatedVideoMemory / (1024 * 1024)} MB");
Console.WriteLine();
JsonSerializerOptions options = new() { WriteIndented = true };
string gpuInfoString = JsonSerializer.Serialize(desc, options);
Console.WriteLine(gpuInfoString);
}
}
}
Console.ReadKey();
}
public static string ResolveVendorIdToVendorName(uint vendorId)
{
string vendorHexId = ReformUIntIdIntoHexNumber(vendorId);//this is here because if the ACTUAL vendor id is 8086 the field will return 32902
//so I have to turn it into 8086 again, but I already have that method
//todo
}
public static string ResolveDeviceIdToDeviceName(uint deviceId)
{
string deviceHexId = ReformUIntIdIntoHexNumber(deviceId);
//todo
}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... in-c-sharp