Initial WIP commit
Some checks failed
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Failing after 9s
Some checks failed
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Failing after 9s
This commit is contained in:
41
Service/HardwareMonitorService.cs
Normal file
41
Service/HardwareMonitorService.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
|
||||
namespace HardwareMonitorStatusWindow.Service;
|
||||
|
||||
public class HardwareMonitorService : IHardwareMonitorService
|
||||
{
|
||||
public const string ScheduledTaskName = "HardwareMonitorService";
|
||||
public const string PipeName = "HardwareMonitorService";
|
||||
|
||||
private static readonly Computer Computer;
|
||||
private static readonly HardwareUpdateVisitor HardwareUpdateVisitor;
|
||||
|
||||
static HardwareMonitorService()
|
||||
{
|
||||
Computer = new Computer
|
||||
{
|
||||
IsCpuEnabled = true,
|
||||
IsGpuEnabled = true,
|
||||
IsMemoryEnabled = true,
|
||||
IsMotherboardEnabled = true,
|
||||
IsControllerEnabled = true,
|
||||
IsNetworkEnabled = true,
|
||||
IsStorageEnabled = true,
|
||||
IsBatteryEnabled = true,
|
||||
IsPsuEnabled = true
|
||||
};
|
||||
|
||||
Computer.Open();
|
||||
|
||||
HardwareUpdateVisitor = new HardwareUpdateVisitor();
|
||||
}
|
||||
|
||||
public IEnumerable<Hardware> GetHardware()
|
||||
{
|
||||
Computer.Accept(HardwareUpdateVisitor);
|
||||
|
||||
var hardwareEntries = Computer.Hardware.Select(Hardware.Create);
|
||||
|
||||
return hardwareEntries;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user