Refactored the hardware code and added the visitor pattern for operations on the computer/hardware/sensor/parameter tree.
authormoel.mich
Sun, 09 May 2010 16:22:13 +0000
changeset 110411b72b73d8f
parent 109 70d0c3102424
child 111 2b8a8cf92c3a
Refactored the hardware code and added the visitor pattern for operations on the computer/hardware/sensor/parameter tree.
GUI/MainForm.cs
GUI/SensorProperties.cs
GUI/UpdateVisitor.cs
Hardware/ATI/ATIGPU.cs
Hardware/CPU/AMD0FCPU.cs
Hardware/CPU/AMD10CPU.cs
Hardware/CPU/IntelCPU.cs
Hardware/Computer.cs
Hardware/HDD/HDD.cs
Hardware/Hardware.cs
Hardware/IComputer.cs
Hardware/IElement.cs
Hardware/IHardware.cs
Hardware/IParameter.cs
Hardware/ISensor.cs
Hardware/IVisitor.cs
Hardware/LPC/F718XX.cs
Hardware/LPC/IT87XX.cs
Hardware/LPC/LPCGroup.cs
Hardware/LPC/LPCHardware.cs
Hardware/LPC/LPCIO.cs
Hardware/LPC/W836XX.cs
Hardware/Mainboard/Mainboard.cs
Hardware/Nvidia/NvidiaGPU.cs
Hardware/Parameter.cs
Hardware/Sensor.cs
Hardware/TBalancer/TBalancer.cs
OpenHardwareMonitor.csproj
Utilities/ListSet.cs
     1.1 --- a/GUI/MainForm.cs	Thu May 06 19:20:38 2010 +0000
     1.2 +++ b/GUI/MainForm.cs	Sun May 09 16:22:13 2010 +0000
     1.3 @@ -60,6 +60,8 @@
     1.4      private SensorSystemTray sensorSystemTray;
     1.5      private NotifyIcon notifyIcon;
     1.6      private StartupManager startupManager = new StartupManager();
     1.7 +    private SensorProperties sensorProperties = new SensorProperties();
     1.8 +    private UpdateVisitor updateVisitor = new UpdateVisitor();
     1.9  
    1.10      public MainForm() {      
    1.11        InitializeComponent();
    1.12 @@ -241,7 +243,7 @@
    1.13      }
    1.14  
    1.15      private void timer_Tick(object sender, EventArgs e) {
    1.16 -      computer.Update();  
    1.17 +      computer.Accept(updateVisitor);
    1.18        treeView.Invalidate();
    1.19        plotPanel.Invalidate();
    1.20        sensorSystemTray.Redraw();
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/GUI/SensorProperties.cs	Sun May 09 16:22:13 2010 +0000
     2.3 @@ -0,0 +1,76 @@
     2.4 +/*
     2.5 +  
     2.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     2.7 +
     2.8 +  The contents of this file are subject to the Mozilla Public License Version
     2.9 +  1.1 (the "License"); you may not use this file except in compliance with
    2.10 +  the License. You may obtain a copy of the License at
    2.11 + 
    2.12 +  http://www.mozilla.org/MPL/
    2.13 +
    2.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    2.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    2.16 +  for the specific language governing rights and limitations under the License.
    2.17 +
    2.18 +  The Original Code is the Open Hardware Monitor code.
    2.19 +
    2.20 +  The Initial Developer of the Original Code is 
    2.21 +  Michael Möller <m.moeller@gmx.ch>.
    2.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    2.23 +  the Initial Developer. All Rights Reserved.
    2.24 +
    2.25 +  Contributor(s):
    2.26 +
    2.27 +  Alternatively, the contents of this file may be used under the terms of
    2.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    2.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    2.31 +  of those above. If you wish to allow use of your version of this file only
    2.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    2.33 +  use your version of this file under the terms of the MPL, indicate your
    2.34 +  decision by deleting the provisions above and replace them with the notice
    2.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    2.36 +  the provisions above, a recipient may use your version of this file under
    2.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    2.38 + 
    2.39 +*/
    2.40 +
    2.41 +using System;
    2.42 +using System.Collections.Generic;
    2.43 +using OpenHardwareMonitor.Hardware;
    2.44 +using OpenHardwareMonitor.Utilities;
    2.45 +
    2.46 +namespace OpenHardwareMonitor.GUI {
    2.47 +  public class SensorProperties {
    2.48 +
    2.49 +    private IDictionary<Identifier, Properties> properties = 
    2.50 +      new Dictionary<Identifier, Properties>();
    2.51 +
    2.52 +    private Properties GetProperties(ISensor sensor) {
    2.53 +      Properties value;
    2.54 +      if (!properties.TryGetValue(sensor.Identifier, out value)) {
    2.55 +        value = new Properties(sensor.Identifier, sensor.IsDefaultHidden);
    2.56 +        properties.Add(sensor.Identifier, value);
    2.57 +      }
    2.58 +      return value;
    2.59 +    }
    2.60 +
    2.61 +    public bool IsHidden(ISensor sensor) {
    2.62 +      return GetProperties(sensor).IsHidden;
    2.63 +    }
    2.64 +
    2.65 +    private class Properties {
    2.66 +      private Identifier identifier;
    2.67 +      private bool hidden;
    2.68 +
    2.69 +      public Properties(Identifier identifier, bool defaultHidden) {
    2.70 +        this.identifier = identifier;
    2.71 +
    2.72 +        hidden = Config.Get(new Identifier(identifier, "hidden").ToString(), 
    2.73 +          defaultHidden);    
    2.74 +      }
    2.75 +
    2.76 +      public bool IsHidden { get { return hidden; } }
    2.77 +    }
    2.78 +  }
    2.79 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/GUI/UpdateVisitor.cs	Sun May 09 16:22:13 2010 +0000
     3.3 @@ -0,0 +1,58 @@
     3.4 +/*
     3.5 +  
     3.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     3.7 +
     3.8 +  The contents of this file are subject to the Mozilla Public License Version
     3.9 +  1.1 (the "License"); you may not use this file except in compliance with
    3.10 +  the License. You may obtain a copy of the License at
    3.11 + 
    3.12 +  http://www.mozilla.org/MPL/
    3.13 +
    3.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    3.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    3.16 +  for the specific language governing rights and limitations under the License.
    3.17 +
    3.18 +  The Original Code is the Open Hardware Monitor code.
    3.19 +
    3.20 +  The Initial Developer of the Original Code is 
    3.21 +  Michael Möller <m.moeller@gmx.ch>.
    3.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    3.23 +  the Initial Developer. All Rights Reserved.
    3.24 +
    3.25 +  Contributor(s):
    3.26 +
    3.27 +  Alternatively, the contents of this file may be used under the terms of
    3.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    3.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    3.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    3.31 +  of those above. If you wish to allow use of your version of this file only
    3.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    3.33 +  use your version of this file under the terms of the MPL, indicate your
    3.34 +  decision by deleting the provisions above and replace them with the notice
    3.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    3.36 +  the provisions above, a recipient may use your version of this file under
    3.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    3.38 + 
    3.39 +*/
    3.40 +
    3.41 +using System;
    3.42 +using System.Collections.Generic;
    3.43 +using OpenHardwareMonitor.Hardware;
    3.44 +
    3.45 +namespace OpenHardwareMonitor.GUI {
    3.46 +  public class UpdateVisitor : IVisitor {
    3.47 +    public void VisitComputer(IComputer computer) {
    3.48 +      computer.Traverse(this);
    3.49 +    }
    3.50 +
    3.51 +    public void VisitHardware(IHardware hardware) {
    3.52 +      hardware.Update();
    3.53 +      foreach (IHardware subHardware in hardware.SubHardware)
    3.54 +        subHardware.Accept(this);
    3.55 +    }
    3.56 +
    3.57 +    public void VisitSensor(ISensor sensor) { }
    3.58 +
    3.59 +    public void VisitParameter(IParameter parameter) { }
    3.60 +  }
    3.61 +}
     4.1 --- a/Hardware/ATI/ATIGPU.cs	Thu May 06 19:20:38 2010 +0000
     4.2 +++ b/Hardware/ATI/ATIGPU.cs	Sun May 09 16:22:13 2010 +0000
     4.3 @@ -82,23 +82,19 @@
     4.4  
     4.5      public int DeviceNumber { get { return deviceNumber; } }
     4.6  
     4.7 -    public string Name {
     4.8 +    public override string Name {
     4.9        get { return name; }
    4.10      }
    4.11  
    4.12 -    public Identifier Identifier {
    4.13 +    public override Identifier Identifier {
    4.14        get { return new Identifier("atigpu", adapterIndex.ToString()); }
    4.15      }
    4.16  
    4.17 -    public Image Icon {
    4.18 +    public override Image Icon {
    4.19        get { return icon; }
    4.20      }
    4.21  
    4.22 -    public string GetReport() {
    4.23 -      return null;
    4.24 -    }
    4.25 -
    4.26 -    public void Update() {
    4.27 +    public override void Update() {
    4.28        ADLTemperature adlt = new ADLTemperature();
    4.29        if (ADL.ADL_Overdrive5_Temperature_Get(adapterIndex, 0, ref adlt)
    4.30          == ADL.ADL_OK) 
     5.1 --- a/Hardware/CPU/AMD0FCPU.cs	Thu May 06 19:20:38 2010 +0000
     5.2 +++ b/Hardware/CPU/AMD0FCPU.cs	Sun May 09 16:22:13 2010 +0000
     5.3 @@ -117,23 +117,19 @@
     5.4        Update();                   
     5.5      }
     5.6  
     5.7 -    public string Name {
     5.8 +    public override string Name {
     5.9        get { return name; }
    5.10      }
    5.11  
    5.12 -    public Identifier Identifier {
    5.13 +    public override Identifier Identifier {
    5.14        get { return new Identifier("amdcpu", processorIndex.ToString()); }
    5.15      }
    5.16  
    5.17 -    public Image Icon {
    5.18 +    public override Image Icon {
    5.19        get { return icon; }
    5.20      }
    5.21  
    5.22 -    public string GetReport() {
    5.23 -      return null;
    5.24 -    }
    5.25 -
    5.26 -    public void Update() {
    5.27 +    public override void Update() {
    5.28        if (pciAddress != 0xFFFFFFFF) {
    5.29          for (uint i = 0; i < coreTemperatures.Length; i++) {
    5.30            if (WinRing0.WritePciConfigDwordEx(
     6.1 --- a/Hardware/CPU/AMD10CPU.cs	Thu May 06 19:20:38 2010 +0000
     6.2 +++ b/Hardware/CPU/AMD10CPU.cs	Sun May 09 16:22:13 2010 +0000
     6.3 @@ -99,23 +99,19 @@
     6.4        Update();                   
     6.5      }
     6.6  
     6.7 -    public string Name {
     6.8 +    public override string Name {
     6.9        get { return name; }
    6.10      }
    6.11  
    6.12 -    public Identifier Identifier {
    6.13 +    public override Identifier Identifier {
    6.14        get { return new Identifier("amdcpu", processorIndex.ToString()); }
    6.15      }
    6.16  
    6.17 -    public Image Icon {
    6.18 +    public override Image Icon {
    6.19        get { return icon; }
    6.20      }
    6.21  
    6.22 -    public string GetReport() {
    6.23 -      return null;
    6.24 -    }
    6.25 -
    6.26 -    public void Update() {
    6.27 +    public override void Update() {
    6.28        if (pciAddress != 0xFFFFFFFF) {
    6.29          uint value;
    6.30          if (WinRing0.ReadPciConfigDwordEx(pciAddress,
     7.1 --- a/Hardware/CPU/IntelCPU.cs	Thu May 06 19:20:38 2010 +0000
     7.2 +++ b/Hardware/CPU/IntelCPU.cs	Sun May 09 16:22:13 2010 +0000
     7.3 @@ -233,15 +233,15 @@
     7.4        Update();                   
     7.5      }
     7.6  
     7.7 -    public string Name {
     7.8 +    public override string Name {
     7.9        get { return name; }
    7.10      }
    7.11  
    7.12 -    public Identifier Identifier {
    7.13 +    public override Identifier Identifier {
    7.14        get { return new Identifier("intelcpu", processorIndex.ToString()); }
    7.15      }
    7.16  
    7.17 -    public Image Icon {
    7.18 +    public override Image Icon {
    7.19        get { return icon; }
    7.20      }
    7.21  
    7.22 @@ -258,7 +258,7 @@
    7.23        }
    7.24      }
    7.25  
    7.26 -    public string GetReport() {
    7.27 +    public override string GetReport() {
    7.28        StringBuilder r = new StringBuilder();
    7.29  
    7.30        r.AppendLine("Intel CPU");
    7.31 @@ -311,7 +311,7 @@
    7.32          (timeEnd - timeBegin);
    7.33      }
    7.34  
    7.35 -    public void Update() {      
    7.36 +    public override void Update() {      
    7.37        for (int i = 0; i < coreTemperatures.Length; i++) {
    7.38          uint eax, edx;
    7.39          if (WinRing0.RdmsrTx(
     8.1 --- a/Hardware/Computer.cs	Thu May 06 19:20:38 2010 +0000
     8.2 +++ b/Hardware/Computer.cs	Sun May 09 16:22:13 2010 +0000
     8.3 @@ -91,21 +91,6 @@
     8.4        open = true;
     8.5      }
     8.6  
     8.7 -    private void SubHardwareUpdate(IHardware hardware) {
     8.8 -      foreach (IHardware subHardware in hardware.SubHardware) {
     8.9 -        subHardware.Update();
    8.10 -        SubHardwareUpdate(subHardware);
    8.11 -      }
    8.12 -    }
    8.13 -
    8.14 -    public void Update() {
    8.15 -      foreach (IGroup group in groups)
    8.16 -        foreach (IHardware hardware in group.Hardware) {
    8.17 -          hardware.Update();
    8.18 -          SubHardwareUpdate(hardware);
    8.19 -        }
    8.20 -    }
    8.21 -
    8.22      public bool HDDEnabled {
    8.23        get { return hddEnabled; }
    8.24        set {
    8.25 @@ -221,5 +206,15 @@
    8.26  
    8.27      public event HardwareEventHandler HardwareAdded;
    8.28      public event HardwareEventHandler HardwareRemoved;
    8.29 +
    8.30 +    public void Accept(IVisitor visitor) {
    8.31 +      visitor.VisitComputer(this);
    8.32 +    }
    8.33 +
    8.34 +    public void Traverse(IVisitor visitor) {
    8.35 +      foreach (IGroup group in groups)
    8.36 +        foreach (IHardware hardware in group.Hardware) 
    8.37 +          hardware.Accept(visitor);
    8.38 +    }
    8.39    }
    8.40  }
     9.1 --- a/Hardware/HDD/HDD.cs	Thu May 06 19:20:38 2010 +0000
     9.2 +++ b/Hardware/HDD/HDD.cs	Sun May 09 16:22:13 2010 +0000
     9.3 @@ -110,6 +110,12 @@
     9.4      #pragma warning disable 67
     9.5      public event SensorEventHandler SensorAdded;
     9.6      public event SensorEventHandler SensorRemoved;
     9.7 -    #pragma warning restore 67
     9.8 +    #pragma warning restore 67    
     9.9 +
    9.10 +    public void Accept(IVisitor visitor) {
    9.11 +      visitor.VisitHardware(this);
    9.12 +    }
    9.13 +
    9.14 +    public void Traverse(IVisitor visitor) { }
    9.15    }
    9.16  }
    10.1 --- a/Hardware/Hardware.cs	Thu May 06 19:20:38 2010 +0000
    10.2 +++ b/Hardware/Hardware.cs	Sun May 09 16:22:13 2010 +0000
    10.3 @@ -37,11 +37,13 @@
    10.4  
    10.5  using System;
    10.6  using System.Collections.Generic;
    10.7 +using System.Drawing;
    10.8 +using OpenHardwareMonitor.Utilities;
    10.9  
   10.10  namespace OpenHardwareMonitor.Hardware {
   10.11 -  public abstract class Hardware {
   10.12 +  public abstract class Hardware : IHardware {
   10.13  
   10.14 -    private List<ISensor> active = new List<ISensor>();
   10.15 +    private ListSet<ISensor> active = new ListSet<ISensor>();
   10.16  
   10.17      public IHardware[] SubHardware {
   10.18        get { return new IHardware[0]; }
   10.19 @@ -52,24 +54,39 @@
   10.20      }
   10.21  
   10.22      protected void ActivateSensor(Sensor sensor) {
   10.23 -      if (!active.Contains(sensor)) {
   10.24 -        active.Add(sensor);
   10.25 +      if (active.Add(sensor)) 
   10.26          if (SensorAdded != null)
   10.27            SensorAdded(sensor);
   10.28 -      }
   10.29      }
   10.30  
   10.31      protected void DeactivateSensor(Sensor sensor) {
   10.32 -      if (active.Contains(sensor)) {
   10.33 -        active.Remove(sensor);
   10.34 +      if (active.Remove(sensor))
   10.35          if (SensorRemoved != null)
   10.36 -          SensorRemoved(sensor);
   10.37 -      }
   10.38 +          SensorRemoved(sensor);     
   10.39      }
   10.40  
   10.41      #pragma warning disable 67
   10.42      public event SensorEventHandler SensorAdded;
   10.43      public event SensorEventHandler SensorRemoved;
   10.44      #pragma warning restore 67
   10.45 +  
   10.46 +    public abstract string Name { get; }
   10.47 +    public abstract Identifier Identifier { get; }
   10.48 +    public abstract Image Icon { get; }
   10.49 +
   10.50 +    public virtual string GetReport() {
   10.51 +      return null;
   10.52 +    }
   10.53 +
   10.54 +    public abstract void Update();
   10.55 +
   10.56 +    public void Accept(IVisitor visitor) {
   10.57 +      visitor.VisitHardware(this);
   10.58 +    }
   10.59 +
   10.60 +    public void Traverse(IVisitor visitor) {
   10.61 +      foreach (ISensor sensor in active)
   10.62 +        sensor.Accept(visitor);
   10.63 +    }
   10.64    }
   10.65  }
    11.1 --- a/Hardware/IComputer.cs	Thu May 06 19:20:38 2010 +0000
    11.2 +++ b/Hardware/IComputer.cs	Sun May 09 16:22:13 2010 +0000
    11.3 @@ -42,7 +42,7 @@
    11.4  
    11.5    public delegate void HardwareEventHandler(IHardware hardware);
    11.6  
    11.7 -  public interface IComputer {
    11.8 +  public interface IComputer : IElement {
    11.9  
   11.10      IHardware[] Hardware { get; }
   11.11  
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/Hardware/IElement.cs	Sun May 09 16:22:13 2010 +0000
    12.3 @@ -0,0 +1,52 @@
    12.4 +/*
    12.5 +  
    12.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
    12.7 +
    12.8 +  The contents of this file are subject to the Mozilla Public License Version
    12.9 +  1.1 (the "License"); you may not use this file except in compliance with
   12.10 +  the License. You may obtain a copy of the License at
   12.11 + 
   12.12 +  http://www.mozilla.org/MPL/
   12.13 +
   12.14 +  Software distributed under the License is distributed on an "AS IS" basis,
   12.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   12.16 +  for the specific language governing rights and limitations under the License.
   12.17 +
   12.18 +  The Original Code is the Open Hardware Monitor code.
   12.19 +
   12.20 +  The Initial Developer of the Original Code is 
   12.21 +  Michael Möller <m.moeller@gmx.ch>.
   12.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
   12.23 +  the Initial Developer. All Rights Reserved.
   12.24 +
   12.25 +  Contributor(s):
   12.26 +
   12.27 +  Alternatively, the contents of this file may be used under the terms of
   12.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
   12.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   12.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
   12.31 +  of those above. If you wish to allow use of your version of this file only
   12.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
   12.33 +  use your version of this file under the terms of the MPL, indicate your
   12.34 +  decision by deleting the provisions above and replace them with the notice
   12.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
   12.36 +  the provisions above, a recipient may use your version of this file under
   12.37 +  the terms of any one of the MPL, the GPL or the LGPL.
   12.38 + 
   12.39 +*/
   12.40 +
   12.41 +using System;
   12.42 +using System.Collections.Generic;
   12.43 +using System.Text;
   12.44 +
   12.45 +namespace OpenHardwareMonitor.Hardware {
   12.46 +  
   12.47 +  public interface IElement {
   12.48 +    // accept visitor on this element
   12.49 +    void Accept(IVisitor visitor);
   12.50 +
   12.51 +    // call accept(visitor) on all child elements (called only from visitors)
   12.52 +    void Traverse(IVisitor visitor);
   12.53 +  }
   12.54 +
   12.55 +}
    13.1 --- a/Hardware/IHardware.cs	Thu May 06 19:20:38 2010 +0000
    13.2 +++ b/Hardware/IHardware.cs	Sun May 09 16:22:13 2010 +0000
    13.3 @@ -43,7 +43,7 @@
    13.4  
    13.5    public delegate void SensorEventHandler(ISensor sensor);
    13.6  
    13.7 -  public interface IHardware {
    13.8 +  public interface IHardware : IElement {
    13.9  
   13.10      string Name { get; }
   13.11      Identifier Identifier { get; }
    14.1 --- a/Hardware/IParameter.cs	Thu May 06 19:20:38 2010 +0000
    14.2 +++ b/Hardware/IParameter.cs	Sun May 09 16:22:13 2010 +0000
    14.3 @@ -40,7 +40,7 @@
    14.4  
    14.5  namespace OpenHardwareMonitor.Hardware {
    14.6  
    14.7 -  public interface IParameter {
    14.8 +  public interface IParameter : IElement {
    14.9  
   14.10      ISensor Sensor { get; }
   14.11      Identifier Identifier { get; }
    15.1 --- a/Hardware/ISensor.cs	Thu May 06 19:20:38 2010 +0000
    15.2 +++ b/Hardware/ISensor.cs	Sun May 09 16:22:13 2010 +0000
    15.3 @@ -55,7 +55,7 @@
    15.4      DateTime Time { get; }
    15.5    }
    15.6  
    15.7 -  public interface ISensor {
    15.8 +  public interface ISensor : IElement {
    15.9  
   15.10      IHardware Hardware { get; }
   15.11  
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/Hardware/IVisitor.cs	Sun May 09 16:22:13 2010 +0000
    16.3 @@ -0,0 +1,51 @@
    16.4 +/*
    16.5 +  
    16.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
    16.7 +
    16.8 +  The contents of this file are subject to the Mozilla Public License Version
    16.9 +  1.1 (the "License"); you may not use this file except in compliance with
   16.10 +  the License. You may obtain a copy of the License at
   16.11 + 
   16.12 +  http://www.mozilla.org/MPL/
   16.13 +
   16.14 +  Software distributed under the License is distributed on an "AS IS" basis,
   16.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   16.16 +  for the specific language governing rights and limitations under the License.
   16.17 +
   16.18 +  The Original Code is the Open Hardware Monitor code.
   16.19 +
   16.20 +  The Initial Developer of the Original Code is 
   16.21 +  Michael Möller <m.moeller@gmx.ch>.
   16.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
   16.23 +  the Initial Developer. All Rights Reserved.
   16.24 +
   16.25 +  Contributor(s):
   16.26 +
   16.27 +  Alternatively, the contents of this file may be used under the terms of
   16.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
   16.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   16.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
   16.31 +  of those above. If you wish to allow use of your version of this file only
   16.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
   16.33 +  use your version of this file under the terms of the MPL, indicate your
   16.34 +  decision by deleting the provisions above and replace them with the notice
   16.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
   16.36 +  the provisions above, a recipient may use your version of this file under
   16.37 +  the terms of any one of the MPL, the GPL or the LGPL.
   16.38 + 
   16.39 +*/
   16.40 +
   16.41 +using System;
   16.42 +using System.Collections.Generic;
   16.43 +using System.Text;
   16.44 +
   16.45 +namespace OpenHardwareMonitor.Hardware {
   16.46 +
   16.47 +  public interface IVisitor {
   16.48 +    void VisitComputer(IComputer computer);
   16.49 +    void VisitHardware(IHardware hardware);
   16.50 +    void VisitSensor(ISensor sensor);
   16.51 +    void VisitParameter(IParameter parameter);
   16.52 +  }
   16.53 +
   16.54 +}
    17.1 --- a/Hardware/LPC/F718XX.cs	Thu May 06 19:20:38 2010 +0000
    17.2 +++ b/Hardware/LPC/F718XX.cs	Sun May 09 16:22:13 2010 +0000
    17.3 @@ -99,7 +99,7 @@
    17.4        }
    17.5      }
    17.6  
    17.7 -    public string GetReport() {
    17.8 +    public override string GetReport() {
    17.9        StringBuilder r = new StringBuilder();
   17.10  
   17.11        r.AppendLine("LPC " + this.GetType().Name);
   17.12 @@ -123,7 +123,7 @@
   17.13        return r.ToString();
   17.14      }
   17.15  
   17.16 -    public void Update() {
   17.17 +    public override void Update() {
   17.18  
   17.19        foreach (Sensor sensor in voltages) {
   17.20          int value = ReadByte((byte)(VOLTAGE_BASE_REG + sensor.Index));
    18.1 --- a/Hardware/LPC/IT87XX.cs	Thu May 06 19:20:38 2010 +0000
    18.2 +++ b/Hardware/LPC/IT87XX.cs	Sun May 09 16:22:13 2010 +0000
    18.3 @@ -122,7 +122,7 @@
    18.4        get { return available; } 
    18.5      }
    18.6  
    18.7 -    public string GetReport() {
    18.8 +    public override string GetReport() {
    18.9        StringBuilder r = new StringBuilder();
   18.10  
   18.11        r.AppendLine("LPC " + this.GetType().Name);
   18.12 @@ -154,7 +154,7 @@
   18.13        return r.ToString();
   18.14      }
   18.15  
   18.16 -    public void Update() {
   18.17 +    public override void Update() {
   18.18  
   18.19        foreach (Sensor sensor in voltages) {
   18.20          bool valid;
    19.1 --- a/Hardware/LPC/LPCGroup.cs	Thu May 06 19:20:38 2010 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,400 +0,0 @@
    19.4 -/*
    19.5 -  
    19.6 -  Version: MPL 1.1/GPL 2.0/LGPL 2.1
    19.7 -
    19.8 -  The contents of this file are subject to the Mozilla Public License Version
    19.9 -  1.1 (the "License"); you may not use this file except in compliance with
   19.10 -  the License. You may obtain a copy of the License at
   19.11 - 
   19.12 -  http://www.mozilla.org/MPL/
   19.13 -
   19.14 -  Software distributed under the License is distributed on an "AS IS" basis,
   19.15 -  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   19.16 -  for the specific language governing rights and limitations under the License.
   19.17 -
   19.18 -  The Original Code is the Open Hardware Monitor code.
   19.19 -
   19.20 -  The Initial Developer of the Original Code is 
   19.21 -  Michael Möller <m.moeller@gmx.ch>.
   19.22 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
   19.23 -  the Initial Developer. All Rights Reserved.
   19.24 -
   19.25 -  Contributor(s):
   19.26 -
   19.27 -  Alternatively, the contents of this file may be used under the terms of
   19.28 -  either the GNU General Public License Version 2 or later (the "GPL"), or
   19.29 -  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   19.30 -  in which case the provisions of the GPL or the LGPL are applicable instead
   19.31 -  of those above. If you wish to allow use of your version of this file only
   19.32 -  under the terms of either the GPL or the LGPL, and not to allow others to
   19.33 -  use your version of this file under the terms of the MPL, indicate your
   19.34 -  decision by deleting the provisions above and replace them with the notice
   19.35 -  and other provisions required by the GPL or the LGPL. If you do not delete
   19.36 -  the provisions above, a recipient may use your version of this file under
   19.37 -  the terms of any one of the MPL, the GPL or the LGPL.
   19.38 - 
   19.39 -*/
   19.40 -
   19.41 -using System;
   19.42 -using System.Collections.Generic;
   19.43 -using System.Text;
   19.44 -using System.Threading;
   19.45 -
   19.46 -namespace OpenHardwareMonitor.Hardware.LPC {
   19.47 -  public class LPCGroup : IGroup {
   19.48 -
   19.49 -    private List<IHardware> hardware = new List<IHardware>();
   19.50 -    private StringBuilder report = new StringBuilder();
   19.51 -
   19.52 -    private Chip chip = Chip.Unknown;
   19.53 -
   19.54 -    // I/O Ports
   19.55 -    private ushort[] REGISTER_PORTS = new ushort[] { 0x2e, 0x4e };
   19.56 -    private ushort[] VALUE_PORTS = new ushort[] { 0x2f, 0x4f };
   19.57 -
   19.58 -    private ushort registerPort;
   19.59 -    private ushort valuePort;
   19.60 -
   19.61 -    // Registers
   19.62 -    private const byte CONFIGURATION_CONTROL_REGISTER = 0x02;
   19.63 -    private const byte DEVCIE_SELECT_REGISTER = 0x07;
   19.64 -    private const byte CHIP_ID_REGISTER = 0x20;
   19.65 -    private const byte CHIP_REVISION_REGISTER = 0x21;
   19.66 -    private const byte BASE_ADDRESS_REGISTER = 0x60;
   19.67 -
   19.68 -    private byte ReadByte(byte register) {
   19.69 -      WinRing0.WriteIoPortByte(registerPort, register);
   19.70 -      return WinRing0.ReadIoPortByte(valuePort);
   19.71 -    } 
   19.72 -
   19.73 -    private ushort ReadWord(byte register) {
   19.74 -      return (ushort)((ReadByte(register) << 8) | 
   19.75 -        ReadByte((byte)(register + 1)));
   19.76 -    }
   19.77 -
   19.78 -    private void Select(byte logicalDeviceNumber) {
   19.79 -      WinRing0.WriteIoPortByte(registerPort, DEVCIE_SELECT_REGISTER);
   19.80 -      WinRing0.WriteIoPortByte(valuePort, logicalDeviceNumber);
   19.81 -    }
   19.82 -
   19.83 -    // ITE
   19.84 -    private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;    
   19.85 -
   19.86 -    private void IT87Enter() {
   19.87 -      WinRing0.WriteIoPortByte(registerPort, 0x87);
   19.88 -      WinRing0.WriteIoPortByte(registerPort, 0x01);
   19.89 -      WinRing0.WriteIoPortByte(registerPort, 0x55);
   19.90 -      WinRing0.WriteIoPortByte(registerPort, 0x55);
   19.91 -    }
   19.92 -
   19.93 -    internal void IT87Exit() {
   19.94 -      WinRing0.WriteIoPortByte(registerPort, CONFIGURATION_CONTROL_REGISTER);
   19.95 -      WinRing0.WriteIoPortByte(valuePort, 0x02);
   19.96 -    }
   19.97 -
   19.98 -    // Winbond, Fintek
   19.99 -    private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
  19.100 -    private const ushort FINTEK_VENDOR_ID = 0x1934;
  19.101 -
  19.102 -    private const byte WINBOND_HARDWARE_MONITOR_LDN = 0x0B;
  19.103 -
  19.104 -    private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
  19.105 -    private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;
  19.106 -
  19.107 -    private void WinbondFintekEnter() {
  19.108 -      WinRing0.WriteIoPortByte(registerPort, 0x87);
  19.109 -      WinRing0.WriteIoPortByte(registerPort, 0x87);
  19.110 -    }
  19.111 -
  19.112 -    private void WinbondFintekExit() {
  19.113 -      WinRing0.WriteIoPortByte(registerPort, 0xAA);      
  19.114 -    }
  19.115 -
  19.116 -    // SMSC
  19.117 -    private void SMSCEnter() {
  19.118 -      WinRing0.WriteIoPortByte(registerPort, 0x55);
  19.119 -    }
  19.120 -
  19.121 -    private void SMSCExit() {
  19.122 -      WinRing0.WriteIoPortByte(registerPort, 0xAA);
  19.123 -    }
  19.124 -
  19.125 -    public LPCGroup() {
  19.126 -      if (!WinRing0.IsAvailable)
  19.127 -        return;
  19.128 -
  19.129 -      for (int i = 0; i < REGISTER_PORTS.Length; i++) {
  19.130 -        registerPort = REGISTER_PORTS[i];
  19.131 -        valuePort = VALUE_PORTS[i];
  19.132 -
  19.133 -        WinbondFintekEnter();
  19.134 -
  19.135 -        byte logicalDeviceNumber;
  19.136 -        byte id = ReadByte(CHIP_ID_REGISTER);
  19.137 -        byte revision = ReadByte(CHIP_REVISION_REGISTER);
  19.138 -        chip = Chip.Unknown;
  19.139 -        logicalDeviceNumber = 0;
  19.140 -        switch (id) {
  19.141 -          case 0x05:
  19.142 -            switch (revision) {
  19.143 -              case 0x07:
  19.144 -                chip = Chip.F71858;
  19.145 -                logicalDeviceNumber = F71858_HARDWARE_MONITOR_LDN;
  19.146 -                break;
  19.147 -              case 0x41:
  19.148 -                chip = Chip.F71882;
  19.149 -                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  19.150 -                break;              
  19.151 -            } break;
  19.152 -          case 0x06:
  19.153 -            switch (revision) {             
  19.154 -              case 0x01:
  19.155 -                chip = Chip.F71862;
  19.156 -                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  19.157 -                break;              
  19.158 -            } break;
  19.159 -          case 0x07:
  19.160 -            switch (revision) {
  19.161 -              case 0x23:
  19.162 -                chip = Chip.F71889F;
  19.163 -                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  19.164 -                break;              
  19.165 -            } break;
  19.166 -          case 0x08:
  19.167 -            switch (revision) {
  19.168 -              case 0x14:
  19.169 -                chip = Chip.F71869;
  19.170 -                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  19.171 -                break;              
  19.172 -            } break;
  19.173 -          case 0x09:
  19.174 -            switch (revision) {
  19.175 -              case 0x09:
  19.176 -                chip = Chip.F71889ED;
  19.177 -                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  19.178 -                break;              
  19.179 -            } break;
  19.180 -          case 0x52:
  19.181 -            switch (revision) {
  19.182 -              case 0x17:
  19.183 -              case 0x3A:
  19.184 -              case 0x41:
  19.185 -                chip = Chip.W83627HF;
  19.186 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.187 -                break;             
  19.188 -            } break;
  19.189 -          case 0x82:
  19.190 -            switch (revision) {
  19.191 -              case 0x83:
  19.192 -                chip = Chip.W83627THF;
  19.193 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.194 -                break;
  19.195 -            } break;
  19.196 -          case 0x85:
  19.197 -            switch (revision) {
  19.198 -              case 0x41:
  19.199 -                chip = Chip.W83687THF;
  19.200 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.201 -                break;
  19.202 -            } break;
  19.203 -          case 0x88:
  19.204 -            switch (revision & 0xF0) {
  19.205 -              case 0x50:
  19.206 -              case 0x60:
  19.207 -                chip = Chip.W83627EHF;
  19.208 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.209 -                break;
  19.210 -            } break;
  19.211 -          case 0xA0:
  19.212 -            switch (revision & 0xF0) {
  19.213 -              case 0x20: 
  19.214 -                chip = Chip.W83627DHG;
  19.215 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;  
  19.216 -                break;             
  19.217 -            } break;
  19.218 -          case 0xA5:
  19.219 -            switch (revision & 0xF0) {
  19.220 -              case 0x10:
  19.221 -                chip = Chip.W83667HG;
  19.222 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.223 -                break;
  19.224 -            } break;
  19.225 -          case 0xB0:
  19.226 -            switch (revision & 0xF0) {
  19.227 -              case 0x70:
  19.228 -                chip = Chip.W83627DHGP;
  19.229 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.230 -                break;             
  19.231 -            } break;
  19.232 -          case 0xB3:
  19.233 -            switch (revision & 0xF0) {
  19.234 -              case 0x50:
  19.235 -                chip = Chip.W83667HGB;
  19.236 -                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  19.237 -                break;
  19.238 -            } break; 
  19.239 -        }
  19.240 -        if (chip == Chip.Unknown) {
  19.241 -          if (id != 0 && id != 0xff) {
  19.242 -            WinbondFintekExit();
  19.243 -
  19.244 -            report.Append("Chip ID: Unknown Winbond / Fintek with ID 0x"); 
  19.245 -            report.AppendLine(((id << 8) | revision).ToString("X"));
  19.246 -            report.AppendLine();
  19.247 -          }
  19.248 -        } else {
  19.249 -
  19.250 -          Select(logicalDeviceNumber);
  19.251 -          ushort address = ReadWord(BASE_ADDRESS_REGISTER);          
  19.252 -          Thread.Sleep(1);
  19.253 -          ushort verify = ReadWord(BASE_ADDRESS_REGISTER);
  19.254 -
  19.255 -          ushort vendorID = ReadWord(FINTEK_VENDOR_ID_REGISTER);
  19.256 -
  19.257 -          WinbondFintekExit();
  19.258 -
  19.259 -          if (address != verify) {            
  19.260 -            report.Append("Chip ID: 0x"); 
  19.261 -            report.AppendLine(chip.ToString("X"));
  19.262 -            report.Append("Chip revision: 0x"); 
  19.263 -            report.AppendLine(revision.ToString("X"));
  19.264 -            report.AppendLine("Error: Address verification failed");
  19.265 -            report.AppendLine();
  19.266 -            return;
  19.267 -          }
  19.268 -
  19.269 -          // some Fintek chips have address register offset 0x05 added already
  19.270 -          if ((address & 0x07) == 0x05)
  19.271 -            address &= 0xFFF8;
  19.272 -
  19.273 -          if (address < 0x100 || (address & 0xF007) != 0) {            
  19.274 -            report.Append("Chip ID: 0x");
  19.275 -            report.AppendLine(chip.ToString("X"));
  19.276 -            report.Append("Chip revision: 0x");
  19.277 -            report.AppendLine(revision.ToString("X"));
  19.278 -            report.Append("Error: Invalid address 0x");
  19.279 -            report.AppendLine(address.ToString("X"));
  19.280 -            report.AppendLine();
  19.281 -            return;
  19.282 -          }
  19.283 -
  19.284 -          switch (chip) {
  19.285 -            case Chip.W83627DHG:
  19.286 -            case Chip.W83627DHGP:
  19.287 -            case Chip.W83627EHF:
  19.288 -            case Chip.W83627HF:
  19.289 -            case Chip.W83627THF:
  19.290 -            case Chip.W83667HG:
  19.291 -            case Chip.W83667HGB:
  19.292 -            case Chip.W83687THF:
  19.293 -              W836XX w836XX = new W836XX(chip, revision, address);
  19.294 -              if (w836XX.IsAvailable)
  19.295 -                hardware.Add(w836XX);
  19.296 -              break;
  19.297 -            case Chip.F71858:
  19.298 -            case Chip.F71862:
  19.299 -            case Chip.F71869:
  19.300 -            case Chip.F71882:
  19.301 -            case Chip.F71889ED:
  19.302 -            case Chip.F71889F:
  19.303 -              if (vendorID != FINTEK_VENDOR_ID) {
  19.304 -                report.Append("Chip ID: 0x");
  19.305 -                report.AppendLine(chip.ToString("X"));
  19.306 -                report.Append("Chip revision: 0x");
  19.307 -                report.AppendLine(revision.ToString("X"));
  19.308 -                report.Append("Error: Invalid vendor ID 0x");
  19.309 -                report.AppendLine(vendorID.ToString("X"));
  19.310 -                report.AppendLine();
  19.311 -                return;
  19.312 -              }
  19.313 -              hardware.Add(new F718XX(chip, address));
  19.314 -              break;
  19.315 -            default: break;
  19.316 -          }
  19.317 -          
  19.318 -          return;
  19.319 -        }
  19.320 -
  19.321 -        IT87Enter();
  19.322 -
  19.323 -        ushort chipID = ReadWord(CHIP_ID_REGISTER);
  19.324 -        switch (chipID) {
  19.325 -          case 0x8712: chip = Chip.IT8712F; break;
  19.326 -          case 0x8716: chip = Chip.IT8716F; break;
  19.327 -          case 0x8718: chip = Chip.IT8718F; break;
  19.328 -          case 0x8720: chip = Chip.IT8720F; break;
  19.329 -          case 0x8726: chip = Chip.IT8726F; break; 
  19.330 -          default: chip = Chip.Unknown; break;
  19.331 -        }
  19.332 -        if (chip == Chip.Unknown) {
  19.333 -          if (chipID != 0 && chipID != 0xffff) {
  19.334 -            IT87Exit();
  19.335 -
  19.336 -            report.Append("Chip ID: Unknown ITE with ID 0x");
  19.337 -            report.AppendLine(chipID.ToString("X"));
  19.338 -            report.AppendLine();
  19.339 -          }
  19.340 -        } else {
  19.341 -          Select(IT87_ENVIRONMENT_CONTROLLER_LDN);
  19.342 -          ushort address = ReadWord(BASE_ADDRESS_REGISTER);
  19.343 -          Thread.Sleep(1);
  19.344 -          ushort verify = ReadWord(BASE_ADDRESS_REGISTER);
  19.345 -
  19.346 -          IT87Exit();
  19.347 -
  19.348 -          if (address != verify || address < 0x100 || (address & 0xF007) != 0) {
  19.349 -            report.Append("Chip ID: 0x");
  19.350 -            report.AppendLine(chip.ToString("X"));            
  19.351 -            report.Append("Error: Invalid address 0x");
  19.352 -            report.AppendLine(address.ToString("X"));
  19.353 -            report.AppendLine();
  19.354 -            return;
  19.355 -          }
  19.356 -
  19.357 -          IT87XX it87 = new IT87XX(chip, address);
  19.358 -          if (it87.IsAvailable)
  19.359 -            hardware.Add(it87);
  19.360 -
  19.361 -          return;
  19.362 -        }
  19.363 -
  19.364 -        SMSCEnter();
  19.365 -
  19.366 -        chipID = ReadWord(CHIP_ID_REGISTER);
  19.367 -        switch (chipID) {
  19.368 -          default: chip = Chip.Unknown; break;
  19.369 -        }
  19.370 -        if (chip == Chip.Unknown) {
  19.371 -          if (chipID != 0 && chipID != 0xffff) {
  19.372 -            SMSCExit();
  19.373 -
  19.374 -            report.Append("Chip ID: Unknown SMSC with ID 0x");
  19.375 -            report.AppendLine(chipID.ToString("X"));
  19.376 -            report.AppendLine();
  19.377 -          }
  19.378 -        } else {
  19.379 -          SMSCExit();
  19.380 -
  19.381 -          return;
  19.382 -        }
  19.383 -      }   
  19.384 -    }
  19.385 -
  19.386 -    public IHardware[] Hardware {
  19.387 -      get {
  19.388 -        return hardware.ToArray();
  19.389 -      }
  19.390 -    }
  19.391 -
  19.392 -    public string GetReport() {
  19.393 -      if (report.Length > 0) {
  19.394 -        report.Insert(0, "LPCIO" + Environment.NewLine +
  19.395 -          Environment.NewLine);        
  19.396 -        return report.ToString();
  19.397 -      } else
  19.398 -        return null;
  19.399 -    }
  19.400 -
  19.401 -    public void Close() { }
  19.402 -  }
  19.403 -}
    20.1 --- a/Hardware/LPC/LPCHardware.cs	Thu May 06 19:20:38 2010 +0000
    20.2 +++ b/Hardware/LPC/LPCHardware.cs	Sun May 09 16:22:13 2010 +0000
    20.3 @@ -73,15 +73,15 @@
    20.4        }
    20.5      }
    20.6  
    20.7 -    public Identifier Identifier {
    20.8 +    public override Identifier Identifier {
    20.9        get { return new Identifier("lpc", chip.ToString().ToLower()); }
   20.10      }
   20.11  
   20.12 -    public Image Icon {
   20.13 +    public override Image Icon {
   20.14        get { return icon; }
   20.15      }
   20.16  
   20.17 -    public string Name {
   20.18 +    public override string Name {
   20.19        get { return name; }
   20.20      }
   20.21    }
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/Hardware/LPC/LPCIO.cs	Sun May 09 16:22:13 2010 +0000
    21.3 @@ -0,0 +1,398 @@
    21.4 +/*
    21.5 +  
    21.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
    21.7 +
    21.8 +  The contents of this file are subject to the Mozilla Public License Version
    21.9 +  1.1 (the "License"); you may not use this file except in compliance with
   21.10 +  the License. You may obtain a copy of the License at
   21.11 + 
   21.12 +  http://www.mozilla.org/MPL/
   21.13 +
   21.14 +  Software distributed under the License is distributed on an "AS IS" basis,
   21.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   21.16 +  for the specific language governing rights and limitations under the License.
   21.17 +
   21.18 +  The Original Code is the Open Hardware Monitor code.
   21.19 +
   21.20 +  The Initial Developer of the Original Code is 
   21.21 +  Michael Möller <m.moeller@gmx.ch>.
   21.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
   21.23 +  the Initial Developer. All Rights Reserved.
   21.24 +
   21.25 +  Contributor(s):
   21.26 +
   21.27 +  Alternatively, the contents of this file may be used under the terms of
   21.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
   21.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   21.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
   21.31 +  of those above. If you wish to allow use of your version of this file only
   21.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
   21.33 +  use your version of this file under the terms of the MPL, indicate your
   21.34 +  decision by deleting the provisions above and replace them with the notice
   21.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
   21.36 +  the provisions above, a recipient may use your version of this file under
   21.37 +  the terms of any one of the MPL, the GPL or the LGPL.
   21.38 + 
   21.39 +*/
   21.40 +
   21.41 +using System;
   21.42 +using System.Collections.Generic;
   21.43 +using System.Text;
   21.44 +using System.Threading;
   21.45 +
   21.46 +namespace OpenHardwareMonitor.Hardware.LPC {
   21.47 +  public class LPCIO {
   21.48 +
   21.49 +    private List<IHardware> hardware = new List<IHardware>();
   21.50 +    private StringBuilder report = new StringBuilder();
   21.51 +
   21.52 +    private Chip chip = Chip.Unknown;
   21.53 +
   21.54 +    // I/O Ports
   21.55 +    private ushort[] REGISTER_PORTS = new ushort[] { 0x2e, 0x4e };
   21.56 +    private ushort[] VALUE_PORTS = new ushort[] { 0x2f, 0x4f };
   21.57 +
   21.58 +    private ushort registerPort;
   21.59 +    private ushort valuePort;
   21.60 +
   21.61 +    // Registers
   21.62 +    private const byte CONFIGURATION_CONTROL_REGISTER = 0x02;
   21.63 +    private const byte DEVCIE_SELECT_REGISTER = 0x07;
   21.64 +    private const byte CHIP_ID_REGISTER = 0x20;
   21.65 +    private const byte CHIP_REVISION_REGISTER = 0x21;
   21.66 +    private const byte BASE_ADDRESS_REGISTER = 0x60;
   21.67 +
   21.68 +    private byte ReadByte(byte register) {
   21.69 +      WinRing0.WriteIoPortByte(registerPort, register);
   21.70 +      return WinRing0.ReadIoPortByte(valuePort);
   21.71 +    } 
   21.72 +
   21.73 +    private ushort ReadWord(byte register) {
   21.74 +      return (ushort)((ReadByte(register) << 8) | 
   21.75 +        ReadByte((byte)(register + 1)));
   21.76 +    }
   21.77 +
   21.78 +    private void Select(byte logicalDeviceNumber) {
   21.79 +      WinRing0.WriteIoPortByte(registerPort, DEVCIE_SELECT_REGISTER);
   21.80 +      WinRing0.WriteIoPortByte(valuePort, logicalDeviceNumber);
   21.81 +    }
   21.82 +
   21.83 +    // ITE
   21.84 +    private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;    
   21.85 +
   21.86 +    private void IT87Enter() {
   21.87 +      WinRing0.WriteIoPortByte(registerPort, 0x87);
   21.88 +      WinRing0.WriteIoPortByte(registerPort, 0x01);
   21.89 +      WinRing0.WriteIoPortByte(registerPort, 0x55);
   21.90 +      WinRing0.WriteIoPortByte(registerPort, 0x55);
   21.91 +    }
   21.92 +
   21.93 +    internal void IT87Exit() {
   21.94 +      WinRing0.WriteIoPortByte(registerPort, CONFIGURATION_CONTROL_REGISTER);
   21.95 +      WinRing0.WriteIoPortByte(valuePort, 0x02);
   21.96 +    }
   21.97 +
   21.98 +    // Winbond, Fintek
   21.99 +    private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
  21.100 +    private const ushort FINTEK_VENDOR_ID = 0x1934;
  21.101 +
  21.102 +    private const byte WINBOND_HARDWARE_MONITOR_LDN = 0x0B;
  21.103 +
  21.104 +    private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
  21.105 +    private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;
  21.106 +
  21.107 +    private void WinbondFintekEnter() {
  21.108 +      WinRing0.WriteIoPortByte(registerPort, 0x87);
  21.109 +      WinRing0.WriteIoPortByte(registerPort, 0x87);
  21.110 +    }
  21.111 +
  21.112 +    private void WinbondFintekExit() {
  21.113 +      WinRing0.WriteIoPortByte(registerPort, 0xAA);      
  21.114 +    }
  21.115 +
  21.116 +    // SMSC
  21.117 +    private void SMSCEnter() {
  21.118 +      WinRing0.WriteIoPortByte(registerPort, 0x55);
  21.119 +    }
  21.120 +
  21.121 +    private void SMSCExit() {
  21.122 +      WinRing0.WriteIoPortByte(registerPort, 0xAA);
  21.123 +    }
  21.124 +
  21.125 +    public LPCIO() {
  21.126 +      if (!WinRing0.IsAvailable)
  21.127 +        return;
  21.128 +
  21.129 +      for (int i = 0; i < REGISTER_PORTS.Length; i++) {
  21.130 +        registerPort = REGISTER_PORTS[i];
  21.131 +        valuePort = VALUE_PORTS[i];
  21.132 +
  21.133 +        WinbondFintekEnter();
  21.134 +
  21.135 +        byte logicalDeviceNumber;
  21.136 +        byte id = ReadByte(CHIP_ID_REGISTER);
  21.137 +        byte revision = ReadByte(CHIP_REVISION_REGISTER);
  21.138 +        chip = Chip.Unknown;
  21.139 +        logicalDeviceNumber = 0;
  21.140 +        switch (id) {
  21.141 +          case 0x05:
  21.142 +            switch (revision) {
  21.143 +              case 0x07:
  21.144 +                chip = Chip.F71858;
  21.145 +                logicalDeviceNumber = F71858_HARDWARE_MONITOR_LDN;
  21.146 +                break;
  21.147 +              case 0x41:
  21.148 +                chip = Chip.F71882;
  21.149 +                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  21.150 +                break;              
  21.151 +            } break;
  21.152 +          case 0x06:
  21.153 +            switch (revision) {             
  21.154 +              case 0x01:
  21.155 +                chip = Chip.F71862;
  21.156 +                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  21.157 +                break;              
  21.158 +            } break;
  21.159 +          case 0x07:
  21.160 +            switch (revision) {
  21.161 +              case 0x23:
  21.162 +                chip = Chip.F71889F;
  21.163 +                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  21.164 +                break;              
  21.165 +            } break;
  21.166 +          case 0x08:
  21.167 +            switch (revision) {
  21.168 +              case 0x14:
  21.169 +                chip = Chip.F71869;
  21.170 +                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  21.171 +                break;              
  21.172 +            } break;
  21.173 +          case 0x09:
  21.174 +            switch (revision) {
  21.175 +              case 0x09:
  21.176 +                chip = Chip.F71889ED;
  21.177 +                logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
  21.178 +                break;              
  21.179 +            } break;
  21.180 +          case 0x52:
  21.181 +            switch (revision) {
  21.182 +              case 0x17:
  21.183 +              case 0x3A:
  21.184 +              case 0x41:
  21.185 +                chip = Chip.W83627HF;
  21.186 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.187 +                break;             
  21.188 +            } break;
  21.189 +          case 0x82:
  21.190 +            switch (revision) {
  21.191 +              case 0x83:
  21.192 +                chip = Chip.W83627THF;
  21.193 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.194 +                break;
  21.195 +            } break;
  21.196 +          case 0x85:
  21.197 +            switch (revision) {
  21.198 +              case 0x41:
  21.199 +                chip = Chip.W83687THF;
  21.200 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.201 +                break;
  21.202 +            } break;
  21.203 +          case 0x88:
  21.204 +            switch (revision & 0xF0) {
  21.205 +              case 0x50:
  21.206 +              case 0x60:
  21.207 +                chip = Chip.W83627EHF;
  21.208 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.209 +                break;
  21.210 +            } break;
  21.211 +          case 0xA0:
  21.212 +            switch (revision & 0xF0) {
  21.213 +              case 0x20: 
  21.214 +                chip = Chip.W83627DHG;
  21.215 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;  
  21.216 +                break;             
  21.217 +            } break;
  21.218 +          case 0xA5:
  21.219 +            switch (revision & 0xF0) {
  21.220 +              case 0x10:
  21.221 +                chip = Chip.W83667HG;
  21.222 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.223 +                break;
  21.224 +            } break;
  21.225 +          case 0xB0:
  21.226 +            switch (revision & 0xF0) {
  21.227 +              case 0x70:
  21.228 +                chip = Chip.W83627DHGP;
  21.229 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.230 +                break;             
  21.231 +            } break;
  21.232 +          case 0xB3:
  21.233 +            switch (revision & 0xF0) {
  21.234 +              case 0x50:
  21.235 +                chip = Chip.W83667HGB;
  21.236 +                logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
  21.237 +                break;
  21.238 +            } break; 
  21.239 +        }
  21.240 +        if (chip == Chip.Unknown) {
  21.241 +          if (id != 0 && id != 0xff) {
  21.242 +            WinbondFintekExit();
  21.243 +
  21.244 +            report.Append("Chip ID: Unknown Winbond / Fintek with ID 0x"); 
  21.245 +            report.AppendLine(((id << 8) | revision).ToString("X"));
  21.246 +            report.AppendLine();
  21.247 +          }
  21.248 +        } else {
  21.249 +
  21.250 +          Select(logicalDeviceNumber);
  21.251 +          ushort address = ReadWord(BASE_ADDRESS_REGISTER);          
  21.252 +          Thread.Sleep(1);
  21.253 +          ushort verify = ReadWord(BASE_ADDRESS_REGISTER);
  21.254 +
  21.255 +          ushort vendorID = ReadWord(FINTEK_VENDOR_ID_REGISTER);
  21.256 +
  21.257 +          WinbondFintekExit();
  21.258 +
  21.259 +          if (address != verify) {            
  21.260 +            report.Append("Chip ID: 0x"); 
  21.261 +            report.AppendLine(chip.ToString("X"));
  21.262 +            report.Append("Chip revision: 0x"); 
  21.263 +            report.AppendLine(revision.ToString("X"));
  21.264 +            report.AppendLine("Error: Address verification failed");
  21.265 +            report.AppendLine();
  21.266 +            return;
  21.267 +          }
  21.268 +
  21.269 +          // some Fintek chips have address register offset 0x05 added already
  21.270 +          if ((address & 0x07) == 0x05)
  21.271 +            address &= 0xFFF8;
  21.272 +
  21.273 +          if (address < 0x100 || (address & 0xF007) != 0) {            
  21.274 +            report.Append("Chip ID: 0x");
  21.275 +            report.AppendLine(chip.ToString("X"));
  21.276 +            report.Append("Chip revision: 0x");
  21.277 +            report.AppendLine(revision.ToString("X"));
  21.278 +            report.Append("Error: Invalid address 0x");
  21.279 +            report.AppendLine(address.ToString("X"));
  21.280 +            report.AppendLine();
  21.281 +            return;
  21.282 +          }
  21.283 +
  21.284 +          switch (chip) {
  21.285 +            case Chip.W83627DHG:
  21.286 +            case Chip.W83627DHGP:
  21.287 +            case Chip.W83627EHF:
  21.288 +            case Chip.W83627HF:
  21.289 +            case Chip.W83627THF:
  21.290 +            case Chip.W83667HG:
  21.291 +            case Chip.W83667HGB:
  21.292 +            case Chip.W83687THF:
  21.293 +              W836XX w836XX = new W836XX(chip, revision, address);
  21.294 +              if (w836XX.IsAvailable)
  21.295 +                hardware.Add(w836XX);
  21.296 +              break;
  21.297 +            case Chip.F71858:
  21.298 +            case Chip.F71862:
  21.299 +            case Chip.F71869:
  21.300 +            case Chip.F71882:
  21.301 +            case Chip.F71889ED:
  21.302 +            case Chip.F71889F:
  21.303 +              if (vendorID != FINTEK_VENDOR_ID) {
  21.304 +                report.Append("Chip ID: 0x");
  21.305 +                report.AppendLine(chip.ToString("X"));
  21.306 +                report.Append("Chip revision: 0x");
  21.307 +                report.AppendLine(revision.ToString("X"));
  21.308 +                report.Append("Error: Invalid vendor ID 0x");
  21.309 +                report.AppendLine(vendorID.ToString("X"));
  21.310 +                report.AppendLine();
  21.311 +                return;
  21.312 +              }
  21.313 +              hardware.Add(new F718XX(chip, address));
  21.314 +              break;
  21.315 +            default: break;
  21.316 +          }
  21.317 +          
  21.318 +          return;
  21.319 +        }
  21.320 +
  21.321 +        IT87Enter();
  21.322 +
  21.323 +        ushort chipID = ReadWord(CHIP_ID_REGISTER);
  21.324 +        switch (chipID) {
  21.325 +          case 0x8712: chip = Chip.IT8712F; break;
  21.326 +          case 0x8716: chip = Chip.IT8716F; break;
  21.327 +          case 0x8718: chip = Chip.IT8718F; break;
  21.328 +          case 0x8720: chip = Chip.IT8720F; break;
  21.329 +          case 0x8726: chip = Chip.IT8726F; break; 
  21.330 +          default: chip = Chip.Unknown; break;
  21.331 +        }
  21.332 +        if (chip == Chip.Unknown) {
  21.333 +          if (chipID != 0 && chipID != 0xffff) {
  21.334 +            IT87Exit();
  21.335 +
  21.336 +            report.Append("Chip ID: Unknown ITE with ID 0x");
  21.337 +            report.AppendLine(chipID.ToString("X"));
  21.338 +            report.AppendLine();
  21.339 +          }
  21.340 +        } else {
  21.341 +          Select(IT87_ENVIRONMENT_CONTROLLER_LDN);
  21.342 +          ushort address = ReadWord(BASE_ADDRESS_REGISTER);
  21.343 +          Thread.Sleep(1);
  21.344 +          ushort verify = ReadWord(BASE_ADDRESS_REGISTER);
  21.345 +
  21.346 +          IT87Exit();
  21.347 +
  21.348 +          if (address != verify || address < 0x100 || (address & 0xF007) != 0) {
  21.349 +            report.Append("Chip ID: 0x");
  21.350 +            report.AppendLine(chip.ToString("X"));            
  21.351 +            report.Append("Error: Invalid address 0x");
  21.352 +            report.AppendLine(address.ToString("X"));
  21.353 +            report.AppendLine();
  21.354 +            return;
  21.355 +          }
  21.356 +
  21.357 +          IT87XX it87 = new IT87XX(chip, address);
  21.358 +          if (it87.IsAvailable)
  21.359 +            hardware.Add(it87);
  21.360 +
  21.361 +          return;
  21.362 +        }
  21.363 +
  21.364 +        SMSCEnter();
  21.365 +
  21.366 +        chipID = ReadWord(CHIP_ID_REGISTER);
  21.367 +        switch (chipID) {
  21.368 +          default: chip = Chip.Unknown; break;
  21.369 +        }
  21.370 +        if (chip == Chip.Unknown) {
  21.371 +          if (chipID != 0 && chipID != 0xffff) {
  21.372 +            SMSCExit();
  21.373 +
  21.374 +            report.Append("Chip ID: Unknown SMSC with ID 0x");
  21.375 +            report.AppendLine(chipID.ToString("X"));
  21.376 +            report.AppendLine();
  21.377 +          }
  21.378 +        } else {
  21.379 +          SMSCExit();
  21.380 +
  21.381 +          return;
  21.382 +        }
  21.383 +      }   
  21.384 +    }
  21.385 +
  21.386 +    public IHardware[] Hardware {
  21.387 +      get {
  21.388 +        return hardware.ToArray();
  21.389 +      }
  21.390 +    }
  21.391 +
  21.392 +    public string GetReport() {
  21.393 +      if (report.Length > 0) {
  21.394 +        report.Insert(0, "LPCIO" + Environment.NewLine +
  21.395 +          Environment.NewLine);        
  21.396 +        return report.ToString();
  21.397 +      } else
  21.398 +        return null;
  21.399 +    }
  21.400 +  }
  21.401 +}
    22.1 --- a/Hardware/LPC/W836XX.cs	Thu May 06 19:20:38 2010 +0000
    22.2 +++ b/Hardware/LPC/W836XX.cs	Sun May 09 16:22:13 2010 +0000
    22.3 @@ -206,7 +206,7 @@
    22.4        return value > 0 ? target | mask : target & ~mask;
    22.5      }
    22.6  
    22.7 -    public void Update() {
    22.8 +    public override void Update() {
    22.9  
   22.10        foreach (Sensor sensor in voltages) {
   22.11          if (sensor.Index < 7) {
   22.12 @@ -300,7 +300,7 @@
   22.13        }
   22.14      }
   22.15  
   22.16 -    public string GetReport() {
   22.17 +    public override string GetReport() {
   22.18        StringBuilder r = new StringBuilder();
   22.19  
   22.20        r.AppendLine("LPC " + this.GetType().Name);
    23.1 --- a/Hardware/Mainboard/Mainboard.cs	Thu May 06 19:20:38 2010 +0000
    23.2 +++ b/Hardware/Mainboard/Mainboard.cs	Sun May 09 16:22:13 2010 +0000
    23.3 @@ -47,7 +47,7 @@
    23.4      private string name;
    23.5      private Image icon;
    23.6  
    23.7 -    private LPCGroup lpcGroup;
    23.8 +    private LPCIO lpcGroup;
    23.9  
   23.10      public Mainboard() {
   23.11        this.smbios = new SMBIOS();
   23.12 @@ -68,7 +68,7 @@
   23.13        }
   23.14  
   23.15        this.icon = Utilities.EmbeddedResources.GetImage("mainboard.png");
   23.16 -      this.lpcGroup = new LPCGroup();
   23.17 +      this.lpcGroup = new LPCIO();
   23.18      }
   23.19  
   23.20      public string Name {
   23.21 @@ -97,9 +97,7 @@
   23.22  
   23.23      public void Update() { }
   23.24  
   23.25 -    public void Close() {
   23.26 -      lpcGroup.Close();
   23.27 -    }
   23.28 +    public void Close() { }
   23.29  
   23.30      public IHardware[] SubHardware {
   23.31        get { return lpcGroup.Hardware; }
   23.32 @@ -113,5 +111,14 @@
   23.33      public event SensorEventHandler SensorAdded;
   23.34      public event SensorEventHandler SensorRemoved;
   23.35      #pragma warning restore 67
   23.36 +
   23.37 +    public void Accept(IVisitor visitor) {
   23.38 +      visitor.VisitHardware(this);
   23.39 +    }
   23.40 +
   23.41 +    public void Traverse(IVisitor visitor) {
   23.42 +      foreach (IHardware hardware in lpcGroup.Hardware)
   23.43 +        hardware.Accept(visitor);     
   23.44 +    }
   23.45    }
   23.46  }
    24.1 --- a/Hardware/Nvidia/NvidiaGPU.cs	Thu May 06 19:20:38 2010 +0000
    24.2 +++ b/Hardware/Nvidia/NvidiaGPU.cs	Sun May 09 16:22:13 2010 +0000
    24.3 @@ -89,22 +89,18 @@
    24.4        }
    24.5      }
    24.6  
    24.7 -    public string Name {
    24.8 +    public override string Name {
    24.9        get { return name; }
   24.10      }
   24.11  
   24.12 -    public Identifier Identifier {
   24.13 +    public override Identifier Identifier {
   24.14        get { return new Identifier("nvidiagpu", adapterIndex.ToString()); }
   24.15      }
   24.16  
   24.17 -    public Image Icon {
   24.18 +    public override Image Icon {
   24.19        get { return icon; }
   24.20      }
   24.21  
   24.22 -    public string GetReport() {
   24.23 -      return null;
   24.24 -    }
   24.25 -
   24.26      private NvGPUThermalSettings GetThermalSettings() {
   24.27        NvGPUThermalSettings settings = new NvGPUThermalSettings();
   24.28        settings.Version = NVAPI.GPU_THERMAL_SETTINGS_VER;
   24.29 @@ -117,7 +113,7 @@
   24.30        return settings;
   24.31      }
   24.32  
   24.33 -    public void Update() {
   24.34 +    public override void Update() {
   24.35        NvGPUThermalSettings settings = GetThermalSettings();
   24.36        foreach (Sensor sensor in temperatures) 
   24.37          sensor.Value = settings.Sensor[sensor.Index].CurrentTemp;
    25.1 --- a/Hardware/Parameter.cs	Thu May 06 19:20:38 2010 +0000
    25.2 +++ b/Hardware/Parameter.cs	Sun May 09 16:22:13 2010 +0000
    25.3 @@ -114,6 +114,12 @@
    25.4            Utilities.Config.Remove(Identifier.ToString());
    25.5          }
    25.6        }
    25.7 -    }   
    25.8 +    }
    25.9 +
   25.10 +    public void Accept(IVisitor visitor) {
   25.11 +      visitor.VisitParameter(this);
   25.12 +    }
   25.13 +
   25.14 +    public void Traverse(IVisitor visitor) { }
   25.15    }
   25.16  }
    26.1 --- a/Hardware/Sensor.cs	Thu May 06 19:20:38 2010 +0000
    26.2 +++ b/Hardware/Sensor.cs	Sun May 09 16:22:13 2010 +0000
    26.3 @@ -205,5 +205,14 @@
    26.4        public float Value { get { return value; } }
    26.5        public DateTime Time { get { return time; } }
    26.6      }
    26.7 +
    26.8 +    public void Accept(IVisitor visitor) {
    26.9 +      visitor.VisitSensor(this);
   26.10 +    }
   26.11 +
   26.12 +    public void Traverse(IVisitor visitor) {
   26.13 +      foreach (IParameter parameter in parameters)
   26.14 +        parameter.Accept(visitor);
   26.15 +    }
   26.16    }
   26.17  }
    27.1 --- a/Hardware/TBalancer/TBalancer.cs	Thu May 06 19:20:38 2010 +0000
    27.2 +++ b/Hardware/TBalancer/TBalancer.cs	Sun May 09 16:22:13 2010 +0000
    27.3 @@ -341,5 +341,11 @@
    27.4  
    27.5      public event SensorEventHandler SensorAdded;
    27.6      public event SensorEventHandler SensorRemoved;
    27.7 +
    27.8 +    public void Accept(IVisitor visitor) {
    27.9 +      visitor.VisitHardware(this);
   27.10 +    }
   27.11 +
   27.12 +    public void Traverse(IVisitor visitor) { }
   27.13    }
   27.14  }
    28.1 --- a/OpenHardwareMonitor.csproj	Thu May 06 19:20:38 2010 +0000
    28.2 +++ b/OpenHardwareMonitor.csproj	Sun May 09 16:22:13 2010 +0000
    28.3 @@ -72,10 +72,12 @@
    28.4        <DependentUpon>ParameterForm.cs</DependentUpon>
    28.5      </Compile>
    28.6      <Compile Include="GUI\SensorNotifyIcon.cs" />
    28.7 +    <Compile Include="GUI\SensorProperties.cs" />
    28.8      <Compile Include="GUI\SensorSystemTray.cs" />
    28.9      <Compile Include="GUI\StartupManager.cs" />
   28.10      <Compile Include="GUI\TaskScheduler.cs" />
   28.11      <Compile Include="GUI\TypeNode.cs" />
   28.12 +    <Compile Include="GUI\UpdateVisitor.cs" />
   28.13      <Compile Include="Hardware\CPU\AMD10CPU.cs" />
   28.14      <Compile Include="Hardware\CPU\AMD0FCPU.cs" />
   28.15      <Compile Include="Hardware\CPU\CPUID.cs" />
   28.16 @@ -86,6 +88,8 @@
   28.17      <Compile Include="Hardware\HDD\SMART.cs" />
   28.18      <Compile Include="Hardware\IComputer.cs" />
   28.19      <Compile Include="Hardware\Identifier.cs" />
   28.20 +    <Compile Include="Hardware\IElement.cs" />
   28.21 +    <Compile Include="Hardware\IVisitor.cs" />
   28.22      <Compile Include="Hardware\IParameter.cs" />
   28.23      <Compile Include="Hardware\LPC\Chip.cs" />
   28.24      <Compile Include="Hardware\LPC\F718XX.cs" />
   28.25 @@ -115,7 +119,7 @@
   28.26      <Compile Include="Hardware\IHardware.cs" />
   28.27      <Compile Include="Hardware\ISensor.cs" />
   28.28      <Compile Include="Hardware\LPC\IT87XX.cs" />
   28.29 -    <Compile Include="Hardware\LPC\LPCGroup.cs" />
   28.30 +    <Compile Include="Hardware\LPC\LPCIO.cs" />
   28.31      <Compile Include="GUI\MainForm.cs">
   28.32        <SubType>Form</SubType>
   28.33      </Compile>
    29.1 --- a/Utilities/ListSet.cs	Thu May 06 19:20:38 2010 +0000
    29.2 +++ b/Utilities/ListSet.cs	Sun May 09 16:22:13 2010 +0000
    29.3 @@ -36,11 +36,12 @@
    29.4  */
    29.5  
    29.6  using System;
    29.7 +using System.Collections;
    29.8  using System.Collections.Generic;
    29.9  using System.Text;
   29.10  
   29.11  namespace OpenHardwareMonitor.Utilities {
   29.12 -  public class ListSet<T> {
   29.13 +  public class ListSet<T> : IEnumerable<T> {
   29.14  
   29.15      private List<T> list = new List<T>();
   29.16  
   29.17 @@ -65,6 +66,17 @@
   29.18      public bool Contains(T item) {
   29.19        return list.Contains(item);
   29.20      }
   29.21 -   
   29.22 +
   29.23 +    public T[] ToArray() {
   29.24 +      return list.ToArray();
   29.25 +    }
   29.26 +
   29.27 +    public IEnumerator<T> GetEnumerator() {
   29.28 +      return list.GetEnumerator();
   29.29 +    }
   29.30 +
   29.31 +    IEnumerator IEnumerable.GetEnumerator() {
   29.32 +      return list.GetEnumerator();
   29.33 +    }
   29.34    }
   29.35  }