Added an Identifier class for IHardware, ISensor and IParameter Identifier properties.
authormoel.mich
Thu, 06 May 2010 19:20:38 +0000
changeset 10970d0c3102424
parent 108 4f569432e14b
child 110 411b72b73d8f
Added an Identifier class for IHardware, ISensor and IParameter Identifier properties.
GUI/SensorNotifyIcon.cs
GUI/SensorSystemTray.cs
Hardware/ATI/ATIGPU.cs
Hardware/CPU/AMD0FCPU.cs
Hardware/CPU/AMD10CPU.cs
Hardware/CPU/IntelCPU.cs
Hardware/HDD/HDD.cs
Hardware/IHardware.cs
Hardware/IParameter.cs
Hardware/ISensor.cs
Hardware/Identifier.cs
Hardware/LPC/LPCHardware.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/SensorNotifyIcon.cs	Tue May 04 17:32:41 2010 +0000
     1.2 +++ b/GUI/SensorNotifyIcon.cs	Thu May 06 19:20:38 2010 +0000
     1.3 @@ -71,7 +71,8 @@
     1.4        if (sensor.SensorType == SensorType.Load) {
     1.5          defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1);
     1.6        }
     1.7 -      Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);      
     1.8 +      Color = Config.Get(new Identifier(sensor.Identifier, 
     1.9 +        "traycolor").ToString(), defaultColor);      
    1.10        
    1.11        this.pen = new Pen(Color.FromArgb(96, Color.Black));
    1.12        this.font = new Font(SystemFonts.MessageBoxFont.FontFamily, 9);
    1.13 @@ -88,7 +89,8 @@
    1.14          dialog.Color = Color;
    1.15          if (dialog.ShowDialog() == DialogResult.OK) {
    1.16            Color = dialog.Color;
    1.17 -          Config.Set(sensor.Identifier + "/traycolor", Color);
    1.18 +          Config.Set(new Identifier(sensor.Identifier,
    1.19 +            "traycolor").ToString(), Color);
    1.20          }
    1.21        };
    1.22        contextMenuStrip.Items.Add(colorItem);
     2.1 --- a/GUI/SensorSystemTray.cs	Tue May 04 17:32:41 2010 +0000
     2.2 +++ b/GUI/SensorSystemTray.cs	Thu May 06 19:20:38 2010 +0000
     2.3 @@ -73,7 +73,8 @@
     2.4      }
     2.5  
     2.6      private void SensorAdded(ISensor sensor) {
     2.7 -      if (Config.Get(sensor.Identifier + "/tray", false)) 
     2.8 +      if (Config.Get(new Identifier(sensor.Identifier, 
     2.9 +        "tray").ToString(), false)) 
    2.10          Add(sensor, false);   
    2.11      }
    2.12  
    2.13 @@ -104,7 +105,7 @@
    2.14          return;
    2.15        } else {        
    2.16          list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
    2.17 -        Config.Set(sensor.Identifier + "/tray", true);
    2.18 +        Config.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
    2.19        }
    2.20      }
    2.21  
    2.22 @@ -114,8 +115,10 @@
    2.23  
    2.24      private void Remove(ISensor sensor, bool deleteConfig) {
    2.25        if (deleteConfig) {
    2.26 -        Config.Remove(sensor.Identifier + "/tray");
    2.27 -        Config.Remove(sensor.Identifier + "/traycolor");
    2.28 +        Config.Remove(
    2.29 +          new Identifier(sensor.Identifier, "tray").ToString());
    2.30 +        Config.Remove(
    2.31 +          new Identifier(sensor.Identifier, "traycolor").ToString());
    2.32        }
    2.33        SensorNotifyIcon instance = null;
    2.34        foreach (SensorNotifyIcon icon in list)
     3.1 --- a/Hardware/ATI/ATIGPU.cs	Tue May 04 17:32:41 2010 +0000
     3.2 +++ b/Hardware/ATI/ATIGPU.cs	Thu May 06 19:20:38 2010 +0000
     3.3 @@ -69,7 +69,8 @@
     3.4  
     3.5        this.temperature = 
     3.6          new Sensor("GPU Core", 0, SensorType.Temperature, this);
     3.7 -      this.fan = new Sensor("GPU", 0, speedInfo.MaxRPM, SensorType.Fan, this);
     3.8 +      this.fan = new Sensor("GPU", 0, speedInfo.MaxRPM, SensorType.Fan, this,
     3.9 +        null);
    3.10        this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
    3.11        this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
    3.12        this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
    3.13 @@ -85,8 +86,8 @@
    3.14        get { return name; }
    3.15      }
    3.16  
    3.17 -    public string Identifier {
    3.18 -      get { return "/atigpu/" + adapterIndex; }
    3.19 +    public Identifier Identifier {
    3.20 +      get { return new Identifier("atigpu", adapterIndex.ToString()); }
    3.21      }
    3.22  
    3.23      public Image Icon {
     4.1 --- a/Hardware/CPU/AMD0FCPU.cs	Tue May 04 17:32:41 2010 +0000
     4.2 +++ b/Hardware/CPU/AMD0FCPU.cs	Thu May 06 19:20:38 2010 +0000
     4.3 @@ -121,8 +121,8 @@
     4.4        get { return name; }
     4.5      }
     4.6  
     4.7 -    public string Identifier {
     4.8 -      get { return "/amdcpu/" + processorIndex; }
     4.9 +    public Identifier Identifier {
    4.10 +      get { return new Identifier("amdcpu", processorIndex.ToString()); }
    4.11      }
    4.12  
    4.13      public Image Icon {
     5.1 --- a/Hardware/CPU/AMD10CPU.cs	Tue May 04 17:32:41 2010 +0000
     5.2 +++ b/Hardware/CPU/AMD10CPU.cs	Thu May 06 19:20:38 2010 +0000
     5.3 @@ -103,8 +103,8 @@
     5.4        get { return name; }
     5.5      }
     5.6  
     5.7 -    public string Identifier {
     5.8 -      get { return "/amdcpu/" + processorIndex; }
     5.9 +    public Identifier Identifier {
    5.10 +      get { return new Identifier("amdcpu", processorIndex.ToString()); }
    5.11      }
    5.12  
    5.13      public Image Icon {
     6.1 --- a/Hardware/CPU/IntelCPU.cs	Tue May 04 17:32:41 2010 +0000
     6.2 +++ b/Hardware/CPU/IntelCPU.cs	Thu May 06 19:20:38 2010 +0000
     6.3 @@ -237,8 +237,8 @@
     6.4        get { return name; }
     6.5      }
     6.6  
     6.7 -    public string Identifier {
     6.8 -      get { return "/intelcpu/" + processorIndex; }
     6.9 +    public Identifier Identifier {
    6.10 +      get { return new Identifier("intelcpu", processorIndex.ToString()); }
    6.11      }
    6.12  
    6.13      public Image Icon {
     7.1 --- a/Hardware/HDD/HDD.cs	Tue May 04 17:32:41 2010 +0000
     7.2 +++ b/Hardware/HDD/HDD.cs	Thu May 06 19:20:38 2010 +0000
     7.3 @@ -69,8 +69,8 @@
     7.4        get { return name; }
     7.5      }
     7.6  
     7.7 -    public string Identifier {
     7.8 -      get { return "/hdd/" + drive; }
     7.9 +    public Identifier Identifier {
    7.10 +      get { return new Identifier("hdd", drive.ToString()); }
    7.11      }
    7.12  
    7.13      public Image Icon {
     8.1 --- a/Hardware/IHardware.cs	Tue May 04 17:32:41 2010 +0000
     8.2 +++ b/Hardware/IHardware.cs	Thu May 06 19:20:38 2010 +0000
     8.3 @@ -46,7 +46,7 @@
     8.4    public interface IHardware {
     8.5  
     8.6      string Name { get; }
     8.7 -    string Identifier { get; }
     8.8 +    Identifier Identifier { get; }
     8.9  
    8.10      Image Icon { get; }
    8.11  
     9.1 --- a/Hardware/IParameter.cs	Tue May 04 17:32:41 2010 +0000
     9.2 +++ b/Hardware/IParameter.cs	Thu May 06 19:20:38 2010 +0000
     9.3 @@ -43,7 +43,7 @@
     9.4    public interface IParameter {
     9.5  
     9.6      ISensor Sensor { get; }
     9.7 -    string Identifier { get; }
     9.8 +    Identifier Identifier { get; }
     9.9      
    9.10      string Name { get; }
    9.11      string Description { get; }
    10.1 --- a/Hardware/ISensor.cs	Tue May 04 17:32:41 2010 +0000
    10.2 +++ b/Hardware/ISensor.cs	Thu May 06 19:20:38 2010 +0000
    10.3 @@ -60,10 +60,13 @@
    10.4      IHardware Hardware { get; }
    10.5  
    10.6      SensorType SensorType { get; }
    10.7 -    string Identifier { get; }
    10.8 +    Identifier Identifier { get; }
    10.9 +
   10.10      string Name { get; set; }
   10.11      int Index { get; }
   10.12  
   10.13 +    bool IsDefaultHidden { get; }
   10.14 +
   10.15      IReadOnlyArray<IParameter> Parameters { get; }
   10.16  
   10.17      float? Value { get; }
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/Hardware/Identifier.cs	Thu May 06 19:20:38 2010 +0000
    11.3 @@ -0,0 +1,96 @@
    11.4 +/*
    11.5 +  
    11.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
    11.7 +
    11.8 +  The contents of this file are subject to the Mozilla Public License Version
    11.9 +  1.1 (the "License"); you may not use this file except in compliance with
   11.10 +  the License. You may obtain a copy of the License at
   11.11 + 
   11.12 +  http://www.mozilla.org/MPL/
   11.13 +
   11.14 +  Software distributed under the License is distributed on an "AS IS" basis,
   11.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   11.16 +  for the specific language governing rights and limitations under the License.
   11.17 +
   11.18 +  The Original Code is the Open Hardware Monitor code.
   11.19 +
   11.20 +  The Initial Developer of the Original Code is 
   11.21 +  Michael Möller <m.moeller@gmx.ch>.
   11.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
   11.23 +  the Initial Developer. All Rights Reserved.
   11.24 +
   11.25 +  Contributor(s):
   11.26 +
   11.27 +  Alternatively, the contents of this file may be used under the terms of
   11.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
   11.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   11.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
   11.31 +  of those above. If you wish to allow use of your version of this file only
   11.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
   11.33 +  use your version of this file under the terms of the MPL, indicate your
   11.34 +  decision by deleting the provisions above and replace them with the notice
   11.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
   11.36 +  the provisions above, a recipient may use your version of this file under
   11.37 +  the terms of any one of the MPL, the GPL or the LGPL.
   11.38 + 
   11.39 +*/
   11.40 +
   11.41 +using System;
   11.42 +using System.Collections.Generic;
   11.43 +using System.Text;
   11.44 +
   11.45 +namespace OpenHardwareMonitor.Hardware {
   11.46 +  public class Identifier {
   11.47 +    private string identifier;
   11.48 +
   11.49 +    private static char SEPARATOR = '/';
   11.50 +
   11.51 +    private void CheckIdentifiers(string[] identifiers) {
   11.52 +      foreach (string s in identifiers)
   11.53 +        if (s.Contains(" ") || s.Contains(SEPARATOR.ToString()))
   11.54 +          throw new ArgumentException("Invalid identifier");
   11.55 +    }
   11.56 +
   11.57 +    public Identifier(params string[] identifiers) {
   11.58 +      CheckIdentifiers(identifiers);
   11.59 +
   11.60 +      StringBuilder s = new StringBuilder();
   11.61 +      for (int i = 0; i < identifiers.Length; i++) {
   11.62 +        s.Append(SEPARATOR);
   11.63 +        s.Append(identifiers[i]);
   11.64 +      }
   11.65 +      this.identifier = s.ToString();
   11.66 +    }
   11.67 +
   11.68 +    public Identifier(Identifier identifier, params string[] extensions) {
   11.69 +      CheckIdentifiers(extensions);
   11.70 +
   11.71 +      StringBuilder s = new StringBuilder();
   11.72 +      s.Append(identifier.ToString());
   11.73 +      for (int i = 0; i < extensions.Length; i++) {
   11.74 +        s.Append(SEPARATOR);
   11.75 +        s.Append(extensions[i]);
   11.76 +      }
   11.77 +      this.identifier = s.ToString();
   11.78 +    }
   11.79 +
   11.80 +    public override string ToString() {
   11.81 +      return identifier;
   11.82 +    }
   11.83 +
   11.84 +    public override bool Equals(System.Object obj) {
   11.85 +      if (obj == null)
   11.86 +        return false;
   11.87 +
   11.88 +      Identifier id = obj as Identifier;
   11.89 +      if (id == null)
   11.90 +        return false;
   11.91 +
   11.92 +      return (identifier == id.identifier);
   11.93 +    }
   11.94 +
   11.95 +    public override int GetHashCode() {
   11.96 +      return identifier.GetHashCode();
   11.97 +    }
   11.98 +  }
   11.99 +}
    12.1 --- a/Hardware/LPC/LPCHardware.cs	Tue May 04 17:32:41 2010 +0000
    12.2 +++ b/Hardware/LPC/LPCHardware.cs	Thu May 06 19:20:38 2010 +0000
    12.3 @@ -73,8 +73,8 @@
    12.4        }
    12.5      }
    12.6  
    12.7 -    public string Identifier {
    12.8 -      get { return "/lpc/" + chip.ToString().ToLower(); }
    12.9 +    public Identifier Identifier {
   12.10 +      get { return new Identifier("lpc", chip.ToString().ToLower()); }
   12.11      }
   12.12  
   12.13      public Image Icon {
    13.1 --- a/Hardware/Mainboard/Mainboard.cs	Tue May 04 17:32:41 2010 +0000
    13.2 +++ b/Hardware/Mainboard/Mainboard.cs	Thu May 06 19:20:38 2010 +0000
    13.3 @@ -75,8 +75,8 @@
    13.4        get { return name; } 
    13.5      }
    13.6  
    13.7 -    public string Identifier {
    13.8 -      get { return "/mainboard"; }
    13.9 +    public Identifier Identifier {
   13.10 +      get { return new Identifier("mainboard"); }
   13.11      }
   13.12  
   13.13      public Image Icon {
    14.1 --- a/Hardware/Nvidia/NvidiaGPU.cs	Tue May 04 17:32:41 2010 +0000
    14.2 +++ b/Hardware/Nvidia/NvidiaGPU.cs	Thu May 06 19:20:38 2010 +0000
    14.3 @@ -75,7 +75,7 @@
    14.4            default: name = "GPU"; break;
    14.5          }
    14.6          temperatures[i] = new Sensor(name, i, sensor.DefaultMaxTemp,
    14.7 -          SensorType.Temperature, this);
    14.8 +          SensorType.Temperature, this, new ParameterDescription[0]);
    14.9          ActivateSensor(temperatures[i]);
   14.10        }
   14.11  
   14.12 @@ -93,8 +93,8 @@
   14.13        get { return name; }
   14.14      }
   14.15  
   14.16 -    public string Identifier {
   14.17 -      get { return "/nvidiagpu/" + adapterIndex; }
   14.18 +    public Identifier Identifier {
   14.19 +      get { return new Identifier("nvidiagpu", adapterIndex.ToString()); }
   14.20      }
   14.21  
   14.22      public Image Icon {
    15.1 --- a/Hardware/Parameter.cs	Tue May 04 17:32:41 2010 +0000
    15.2 +++ b/Hardware/Parameter.cs	Thu May 06 19:20:38 2010 +0000
    15.3 @@ -68,8 +68,9 @@
    15.4      public Parameter(ParameterDescription description, ISensor sensor) {
    15.5        this.sensor = sensor;
    15.6        this.description = description;
    15.7 -      this.value = Utilities.Config.Get(Identifier, description.DefaultValue);
    15.8 -      this.isDefault = !Utilities.Config.Contains(Identifier);
    15.9 +      this.value = Utilities.Config.Get(Identifier.ToString(), 
   15.10 +        description.DefaultValue);
   15.11 +      this.isDefault = !Utilities.Config.Contains(Identifier.ToString());
   15.12      }
   15.13  
   15.14      public ISensor Sensor {
   15.15 @@ -78,10 +79,10 @@
   15.16        }
   15.17      }
   15.18  
   15.19 -    public string Identifier {
   15.20 +    public Identifier Identifier {
   15.21        get {
   15.22 -        return sensor.Identifier + "/parameter/" + 
   15.23 -          Name.Replace(" ", "").ToLower();
   15.24 +        return new Identifier(sensor.Identifier, "parameter", 
   15.25 +          Name.Replace(" ", "").ToLower());
   15.26        }
   15.27      }
   15.28  
   15.29 @@ -96,7 +97,7 @@
   15.30        set {
   15.31          this.isDefault = false;
   15.32          this.value = value;        
   15.33 -        Utilities.Config.Set(Identifier, value);
   15.34 +        Utilities.Config.Set(Identifier.ToString(), value);
   15.35        }
   15.36      }
   15.37  
   15.38 @@ -110,7 +111,7 @@
   15.39          this.isDefault = value;
   15.40          if (value) {
   15.41            this.value = description.DefaultValue;
   15.42 -          Utilities.Config.Remove(Identifier);
   15.43 +          Utilities.Config.Remove(Identifier.ToString());
   15.44          }
   15.45        }
   15.46      }   
    16.1 --- a/Hardware/Sensor.cs	Tue May 04 17:32:41 2010 +0000
    16.2 +++ b/Hardware/Sensor.cs	Thu May 06 19:20:38 2010 +0000
    16.3 @@ -46,6 +46,7 @@
    16.4      private string defaultName;
    16.5      private string name;
    16.6      private int index;
    16.7 +    private bool defaultHidden;
    16.8      private SensorType sensorType;
    16.9      private IHardware hardware;
   16.10      private ReadOnlyArray<IParameter> parameters;
   16.11 @@ -64,31 +65,37 @@
   16.12     
   16.13      public Sensor(string name, int index, SensorType sensorType,
   16.14        IHardware hardware) : this(name, index, null, sensorType, hardware, 
   16.15 -      new ParameterDescription[0]) { }
   16.16 +      null) { }
   16.17  
   16.18 -    public Sensor(string name, int index, float? limit,
   16.19 -      SensorType sensorType, IHardware hardware) : this(name, index, limit, 
   16.20 -      sensorType, hardware, new ParameterDescription[0]) { }    
   16.21 +    public Sensor(string name, int index, float? limit, SensorType sensorType,
   16.22 +      IHardware hardware, ParameterDescription[] parameterDescriptions) :
   16.23 +      this(name, index, false, limit, sensorType, hardware,
   16.24 +        parameterDescriptions) { }
   16.25  
   16.26 -    public Sensor(string name, int index, float? limit, SensorType sensorType, 
   16.27 -      IHardware hardware, ParameterDescription[] parameterDescriptions) 
   16.28 +    public Sensor(string name, int index, bool defaultHidden, 
   16.29 +      float? limit, SensorType sensorType, IHardware hardware, 
   16.30 +      ParameterDescription[] parameterDescriptions) 
   16.31      {
   16.32        this.defaultName = name;      
   16.33        this.index = index;
   16.34 +      this.defaultHidden = defaultHidden;
   16.35        this.defaultLimit = limit;
   16.36        this.sensorType = sensorType;
   16.37        this.hardware = hardware;
   16.38 -      Parameter[] parameters = new Parameter[parameterDescriptions.Length];
   16.39 +      Parameter[] parameters = new Parameter[parameterDescriptions == null ?
   16.40 +        0 : parameterDescriptions.Length];
   16.41        for (int i = 0; i < parameters.Length; i++ ) 
   16.42          parameters[i] = new Parameter(parameterDescriptions[i], this);
   16.43        this.parameters = parameters;
   16.44  
   16.45 -      string configName = Config.Settings[Identifier + "/name"];
   16.46 +      string configName = Config.Settings[
   16.47 +        new Identifier(Identifier, "name").ToString()];
   16.48        if (configName != null)
   16.49          this.name = configName;
   16.50        else
   16.51          this.name = name;
   16.52 -      string configLimit = Config.Settings[Identifier + "/limit"];
   16.53 +      string configLimit = Config.Settings[
   16.54 +        new Identifier(Identifier, "limit").ToString()];
   16.55        if (configLimit != null && configLimit != "")
   16.56          this.limit = float.Parse(configLimit);
   16.57        else
   16.58 @@ -103,10 +110,10 @@
   16.59        get { return sensorType; }
   16.60      }
   16.61  
   16.62 -    public string Identifier {
   16.63 +    public Identifier Identifier {
   16.64        get {
   16.65 -        return hardware.Identifier + "/" + sensorType.ToString().ToLower() +
   16.66 -          "/" + index;
   16.67 +        return new Identifier(hardware.Identifier, 
   16.68 +          sensorType.ToString().ToLower(), index.ToString());
   16.69        }
   16.70      }
   16.71  
   16.72 @@ -119,7 +126,7 @@
   16.73            name = value;          
   16.74          else 
   16.75            name = defaultName;
   16.76 -        Config.Settings[Identifier + "/name"] = name;
   16.77 +        Config.Settings[new Identifier(Identifier, "name").ToString()] = name;
   16.78        }
   16.79      }
   16.80  
   16.81 @@ -127,6 +134,10 @@
   16.82        get { return index; }
   16.83      }
   16.84  
   16.85 +    public bool IsDefaultHidden {
   16.86 +      get { return defaultHidden; }
   16.87 +    }
   16.88 +
   16.89      public IReadOnlyArray<IParameter> Parameters {
   16.90        get { return parameters; }
   16.91      }
   16.92 @@ -169,11 +180,11 @@
   16.93        set {
   16.94          if (value.HasValue) {
   16.95            limit = value;
   16.96 -          Config.Settings[Identifier + "/limit"] =
   16.97 +          Config.Settings[new Identifier(Identifier, "limit").ToString()] =
   16.98              limit.ToString();
   16.99          } else {
  16.100            limit = defaultLimit;
  16.101 -          Config.Settings[Identifier + "/limit"] = "";          
  16.102 +          Config.Settings[new Identifier(Identifier, "limit").ToString()] = "";          
  16.103          }        
  16.104        }
  16.105      }
    17.1 --- a/Hardware/TBalancer/TBalancer.cs	Tue May 04 17:32:41 2010 +0000
    17.2 +++ b/Hardware/TBalancer/TBalancer.cs	Thu May 06 19:20:38 2010 +0000
    17.3 @@ -153,7 +153,7 @@
    17.4          if (miniNGFans[number * 2 + i] == null)
    17.5            miniNGFans[number * 2 + i] = 
    17.6              new Sensor("miniNG #" + (number + 1) + " Fan Channel " + (i + 1),
    17.7 -            4 + number * 2 + i, maxRPM, SensorType.Fan, this);
    17.8 +            4 + number * 2 + i, maxRPM, SensorType.Fan, this, null);
    17.9          
   17.10          Sensor sensor = miniNGFans[number * 2 + i];
   17.11  
   17.12 @@ -251,8 +251,8 @@
   17.13        get { return "T-Balancer bigNG"; }
   17.14      }
   17.15  
   17.16 -    public string Identifier {
   17.17 -      get { return "/bigng/" + this.portIndex; }
   17.18 +    public Identifier Identifier {
   17.19 +      get { return new Identifier("bigng", this.portIndex.ToString()); }
   17.20      }
   17.21  
   17.22      public IHardware[] SubHardware {
    18.1 --- a/OpenHardwareMonitor.csproj	Tue May 04 17:32:41 2010 +0000
    18.2 +++ b/OpenHardwareMonitor.csproj	Thu May 06 19:20:38 2010 +0000
    18.3 @@ -85,6 +85,7 @@
    18.4      <Compile Include="Hardware\HDD\HDDGroup.cs" />
    18.5      <Compile Include="Hardware\HDD\SMART.cs" />
    18.6      <Compile Include="Hardware\IComputer.cs" />
    18.7 +    <Compile Include="Hardware\Identifier.cs" />
    18.8      <Compile Include="Hardware\IParameter.cs" />
    18.9      <Compile Include="Hardware\LPC\Chip.cs" />
   18.10      <Compile Include="Hardware\LPC\F718XX.cs" />
   18.11 @@ -127,6 +128,7 @@
   18.12      <Compile Include="Utilities\HexStringArray.cs" />
   18.13      <Compile Include="Utilities\IconFactory.cs" />
   18.14      <Compile Include="Utilities\IReadOnlyArray.cs" />
   18.15 +    <Compile Include="Utilities\ListSet.cs" />
   18.16      <Compile Include="Utilities\PInvokeDelegateFactory.cs" />
   18.17      <Compile Include="GUI\PlotPanel.cs">
   18.18        <SubType>UserControl</SubType>
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/Utilities/ListSet.cs	Thu May 06 19:20:38 2010 +0000
    19.3 @@ -0,0 +1,70 @@
    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 +
   19.45 +namespace OpenHardwareMonitor.Utilities {
   19.46 +  public class ListSet<T> {
   19.47 +
   19.48 +    private List<T> list = new List<T>();
   19.49 +
   19.50 +    public ListSet() { }
   19.51 +
   19.52 +    public bool Add(T item) {
   19.53 +      if (list.Contains(item))
   19.54 +        return false;
   19.55 +
   19.56 +      list.Add(item);
   19.57 +      return true;
   19.58 +    }
   19.59 +
   19.60 +    public bool Remove(T item) {
   19.61 +      if (!list.Contains(item))
   19.62 +        return false;
   19.63 +
   19.64 +      list.Remove(item);
   19.65 +      return true;
   19.66 +    }
   19.67 +
   19.68 +    public bool Contains(T item) {
   19.69 +      return list.Contains(item);
   19.70 +    }
   19.71 +   
   19.72 +  }
   19.73 +}