forked from openhardwaremonitor/openhardwaremonitor
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ProgramReport.cs
53 lines (37 loc) · 1.25 KB
/
ProgramReport.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2012 Michael Möller <[email protected]>
*/
using System;
using OpenHardwareMonitor.Hardware;
namespace OpenHardwareMonitorReport {
class Program {
static void Main(string[] args) {
Computer computer = new Computer();
computer.CPUEnabled = true;
computer.FanControllerEnabled = true;
computer.GPUEnabled = true;
computer.HDDEnabled = true;
computer.MainboardEnabled = true;
computer.RAMEnabled = true;
computer.Open();
computer.Accept(new UpdateVisitor());
Console.Out.Write(computer.GetReport());
computer.Close();
}
}
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) { }
}
}