mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 06:15:08 +00:00
Refactored the hardware code and added the visitor pattern for operations on the computer/hardware/sensor/parameter tree.
This commit is contained in:
@@ -47,7 +47,7 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
|
||||
private string name;
|
||||
private Image icon;
|
||||
|
||||
private LPCGroup lpcGroup;
|
||||
private LPCIO lpcGroup;
|
||||
|
||||
public Mainboard() {
|
||||
this.smbios = new SMBIOS();
|
||||
@@ -68,7 +68,7 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
|
||||
}
|
||||
|
||||
this.icon = Utilities.EmbeddedResources.GetImage("mainboard.png");
|
||||
this.lpcGroup = new LPCGroup();
|
||||
this.lpcGroup = new LPCIO();
|
||||
}
|
||||
|
||||
public string Name {
|
||||
@@ -97,9 +97,7 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
|
||||
|
||||
public void Update() { }
|
||||
|
||||
public void Close() {
|
||||
lpcGroup.Close();
|
||||
}
|
||||
public void Close() { }
|
||||
|
||||
public IHardware[] SubHardware {
|
||||
get { return lpcGroup.Hardware; }
|
||||
@@ -113,5 +111,14 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
|
||||
public event SensorEventHandler SensorAdded;
|
||||
public event SensorEventHandler SensorRemoved;
|
||||
#pragma warning restore 67
|
||||
|
||||
public void Accept(IVisitor visitor) {
|
||||
visitor.VisitHardware(this);
|
||||
}
|
||||
|
||||
public void Traverse(IVisitor visitor) {
|
||||
foreach (IHardware hardware in lpcGroup.Hardware)
|
||||
hardware.Accept(visitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user