Files

33 lines
604 B
C#
Raw Permalink Normal View History

2026-08-27 10:55:23 -06:00
using System;
using Microsoft.Win32;
namespace Intelix.Helper;
public static class CpuInfo
{
public static string GetName()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
return (registryKey?.GetValue("ProcessorNameString") as string) ?? (registryKey?.GetValue("VendorIdentifier") as string) ?? "Unknown";
}
catch
{
return "Unknown";
}
}
public static int GetLogicalCores()
{
try
{
return Environment.ProcessorCount;
}
catch
{
return 0;
}
}
}