Getting Started Requirements
Installation
using HardMon; Core Classes Hardware Class The main class that provides access to all monitoring functionality. Constructor Hardware hardware = new Hardware(); Data Classes The library provides several data classes that contain structured information about each component:
Usage Examples Basic Initialization // Create an instance of the Hardware class Hardware hardware = new Hardware(); // Refresh all hardware data hardware.Refresh(); Getting System Information string userName = hardware.GetUserName(); string systemName = hardware.GetSystemName(); string cpuName = hardware.GetCPUName(); int coreCount = hardware.CoreCount(); Retrieving CPU Information List<CPUInfo> cpuInfos = hardware.CPUInfos(); foreach (CPUInfo cpu in cpuInfos) { Console.WriteLine($"CPU: {cpu.Name}"); foreach (string clock in cpu.Clock) { Console.WriteLine($" {clock}"); } foreach (string temp in cpu.Temperature) { Console.WriteLine($" {temp}"); } foreach (string load in cpu.Load) { Console.WriteLine($" {load}"); } } Retrieving GPU Information List<GPUInfo> gpuInfos = hardware.GPUInfos(); foreach (GPUInfo gpu in gpuInfos) { Console.WriteLine($"GPU: {gpu.Name}"); foreach (string temp in gpu.Temperature) { Console.WriteLine($" {temp}"); } foreach (string load in gpu.Load) { Console.WriteLine($" {load}"); } foreach (string clock in gpu.Clock) { Console.WriteLine($" {clock}"); } } Retrieving RAM Information List<RAMInfo> ramInfos = hardware.RAMInfos(); foreach (RAMInfo ram in ramInfos) { Console.WriteLine($"RAM: {ram.Name}"); foreach (string load in ram.Load) { Console.WriteLine($" {load}"); } foreach (string used in ram.Used) { Console.WriteLine($" {used}"); } foreach (string available in ram.Available) { Console.WriteLine($" {available}"); } } Retrieving HDD Information List<HDDInfo> hddInfos = hardware.HDDInfos(); foreach (HDDInfo hdd in hddInfos) { Console.WriteLine($"HDD: {hdd.Name}"); foreach (string temp in hdd.Temperature) { Console.WriteLine($" {temp}"); } foreach (string load in hdd.Load) { Console.WriteLine($" {load}"); } foreach (string data in hdd.Data) { Console.WriteLine($" {data}"); } } Data Format All data is returned as formatted strings with consistent alignment. Each value includes:
Example output format: CPU Core #1 3400.0 MHz Max: 4200.0 MHz CPU Temperature 45.0°C Max: 85.0°C Best Practices
Performance Considerations
Copyright (c) 2015 - 2025 Ari Sohandri Putra. All rights reserved.
|