34 lines
952 B
C#
34 lines
952 B
C#
using System;
|
|
using OpenHardwareMonitor.Hardware;
|
|
|
|
namespace CPUGPUTempMonitorArduinoSerialSend
|
|
{
|
|
class Program
|
|
{
|
|
|
|
public class UpdateVisitor : IVisitor
|
|
{
|
|
public void VisitComputer(IComputer computer)
|
|
{
|
|
computer.Traverse(this);
|
|
}
|
|
public void VisitHardware(IHardware hardware)
|
|
{
|
|
hardware.Update();
|
|
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
|
|
}
|
|
public void VisitSensor(ISensor sensor) { }
|
|
public void VisitParameter(IParameter parameter) { }
|
|
}
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
UpdateVisitor updateVisitor = new UpdateVisitor();
|
|
Computer computer = new Computer();
|
|
computer.Open();
|
|
computer.CPUEnabled = true;
|
|
computer.Accept(updateVisitor);
|
|
}
|
|
}
|
|
}
|