initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user