mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-30 13:57:38 +00:00
Added an Identifier class for IHardware, ISensor and IParameter Identifier properties.
This commit is contained in:
@@ -71,7 +71,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
if (sensor.SensorType == SensorType.Load) {
|
if (sensor.SensorType == SensorType.Load) {
|
||||||
defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1);
|
defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1);
|
||||||
}
|
}
|
||||||
Color = Config.Get(sensor.Identifier + "/traycolor", defaultColor);
|
Color = Config.Get(new Identifier(sensor.Identifier,
|
||||||
|
"traycolor").ToString(), defaultColor);
|
||||||
|
|
||||||
this.pen = new Pen(Color.FromArgb(96, Color.Black));
|
this.pen = new Pen(Color.FromArgb(96, Color.Black));
|
||||||
this.font = new Font(SystemFonts.MessageBoxFont.FontFamily, 9);
|
this.font = new Font(SystemFonts.MessageBoxFont.FontFamily, 9);
|
||||||
@@ -88,7 +89,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
dialog.Color = Color;
|
dialog.Color = Color;
|
||||||
if (dialog.ShowDialog() == DialogResult.OK) {
|
if (dialog.ShowDialog() == DialogResult.OK) {
|
||||||
Color = dialog.Color;
|
Color = dialog.Color;
|
||||||
Config.Set(sensor.Identifier + "/traycolor", Color);
|
Config.Set(new Identifier(sensor.Identifier,
|
||||||
|
"traycolor").ToString(), Color);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
contextMenuStrip.Items.Add(colorItem);
|
contextMenuStrip.Items.Add(colorItem);
|
||||||
|
@@ -73,7 +73,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SensorAdded(ISensor sensor) {
|
private void SensorAdded(ISensor sensor) {
|
||||||
if (Config.Get(sensor.Identifier + "/tray", false))
|
if (Config.Get(new Identifier(sensor.Identifier,
|
||||||
|
"tray").ToString(), false))
|
||||||
Add(sensor, false);
|
Add(sensor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +105,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
|
list.Add(new SensorNotifyIcon(this, sensor, balloonTip));
|
||||||
Config.Set(sensor.Identifier + "/tray", true);
|
Config.Set(new Identifier(sensor.Identifier, "tray").ToString(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,8 +115,10 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
private void Remove(ISensor sensor, bool deleteConfig) {
|
private void Remove(ISensor sensor, bool deleteConfig) {
|
||||||
if (deleteConfig) {
|
if (deleteConfig) {
|
||||||
Config.Remove(sensor.Identifier + "/tray");
|
Config.Remove(
|
||||||
Config.Remove(sensor.Identifier + "/traycolor");
|
new Identifier(sensor.Identifier, "tray").ToString());
|
||||||
|
Config.Remove(
|
||||||
|
new Identifier(sensor.Identifier, "traycolor").ToString());
|
||||||
}
|
}
|
||||||
SensorNotifyIcon instance = null;
|
SensorNotifyIcon instance = null;
|
||||||
foreach (SensorNotifyIcon icon in list)
|
foreach (SensorNotifyIcon icon in list)
|
||||||
|
@@ -69,7 +69,8 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
|||||||
|
|
||||||
this.temperature =
|
this.temperature =
|
||||||
new Sensor("GPU Core", 0, SensorType.Temperature, this);
|
new Sensor("GPU Core", 0, SensorType.Temperature, this);
|
||||||
this.fan = new Sensor("GPU", 0, speedInfo.MaxRPM, SensorType.Fan, this);
|
this.fan = new Sensor("GPU", 0, speedInfo.MaxRPM, SensorType.Fan, this,
|
||||||
|
null);
|
||||||
this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
|
this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this);
|
||||||
this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
|
this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this);
|
||||||
this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
|
this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this);
|
||||||
@@ -85,8 +86,8 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/atigpu/" + adapterIndex; }
|
get { return new Identifier("atigpu", adapterIndex.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -121,8 +121,8 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/amdcpu/" + processorIndex; }
|
get { return new Identifier("amdcpu", processorIndex.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -103,8 +103,8 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/amdcpu/" + processorIndex; }
|
get { return new Identifier("amdcpu", processorIndex.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -237,8 +237,8 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/intelcpu/" + processorIndex; }
|
get { return new Identifier("intelcpu", processorIndex.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -69,8 +69,8 @@ namespace OpenHardwareMonitor.Hardware.HDD {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/hdd/" + drive; }
|
get { return new Identifier("hdd", drive.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -46,7 +46,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
public interface IHardware {
|
public interface IHardware {
|
||||||
|
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Identifier { get; }
|
Identifier Identifier { get; }
|
||||||
|
|
||||||
Image Icon { get; }
|
Image Icon { get; }
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
public interface IParameter {
|
public interface IParameter {
|
||||||
|
|
||||||
ISensor Sensor { get; }
|
ISensor Sensor { get; }
|
||||||
string Identifier { get; }
|
Identifier Identifier { get; }
|
||||||
|
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Description { get; }
|
string Description { get; }
|
||||||
|
@@ -60,10 +60,13 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
IHardware Hardware { get; }
|
IHardware Hardware { get; }
|
||||||
|
|
||||||
SensorType SensorType { get; }
|
SensorType SensorType { get; }
|
||||||
string Identifier { get; }
|
Identifier Identifier { get; }
|
||||||
|
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
int Index { get; }
|
int Index { get; }
|
||||||
|
|
||||||
|
bool IsDefaultHidden { get; }
|
||||||
|
|
||||||
IReadOnlyArray<IParameter> Parameters { get; }
|
IReadOnlyArray<IParameter> Parameters { get; }
|
||||||
|
|
||||||
float? Value { get; }
|
float? Value { get; }
|
||||||
|
96
Hardware/Identifier.cs
Normal file
96
Hardware/Identifier.cs
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
||||||
|
The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
for the specific language governing rights and limitations under the License.
|
||||||
|
|
||||||
|
The Original Code is the Open Hardware Monitor code.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is
|
||||||
|
Michael Möller <m.moeller@gmx.ch>.
|
||||||
|
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
|
||||||
|
Alternatively, the contents of this file may be used under the terms of
|
||||||
|
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
of those above. If you wish to allow use of your version of this file only
|
||||||
|
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
use your version of this file under the terms of the MPL, indicate your
|
||||||
|
decision by deleting the provisions above and replace them with the notice
|
||||||
|
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
the provisions above, a recipient may use your version of this file under
|
||||||
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenHardwareMonitor.Hardware {
|
||||||
|
public class Identifier {
|
||||||
|
private string identifier;
|
||||||
|
|
||||||
|
private static char SEPARATOR = '/';
|
||||||
|
|
||||||
|
private void CheckIdentifiers(string[] identifiers) {
|
||||||
|
foreach (string s in identifiers)
|
||||||
|
if (s.Contains(" ") || s.Contains(SEPARATOR.ToString()))
|
||||||
|
throw new ArgumentException("Invalid identifier");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Identifier(params string[] identifiers) {
|
||||||
|
CheckIdentifiers(identifiers);
|
||||||
|
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
for (int i = 0; i < identifiers.Length; i++) {
|
||||||
|
s.Append(SEPARATOR);
|
||||||
|
s.Append(identifiers[i]);
|
||||||
|
}
|
||||||
|
this.identifier = s.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Identifier(Identifier identifier, params string[] extensions) {
|
||||||
|
CheckIdentifiers(extensions);
|
||||||
|
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
s.Append(identifier.ToString());
|
||||||
|
for (int i = 0; i < extensions.Length; i++) {
|
||||||
|
s.Append(SEPARATOR);
|
||||||
|
s.Append(extensions[i]);
|
||||||
|
}
|
||||||
|
this.identifier = s.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(System.Object obj) {
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Identifier id = obj as Identifier;
|
||||||
|
if (id == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (identifier == id.identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
return identifier.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -73,8 +73,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/lpc/" + chip.ToString().ToLower(); }
|
get { return new Identifier("lpc", chip.ToString().ToLower()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -75,8 +75,8 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/mainboard"; }
|
get { return new Identifier("mainboard"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -75,7 +75,7 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
default: name = "GPU"; break;
|
default: name = "GPU"; break;
|
||||||
}
|
}
|
||||||
temperatures[i] = new Sensor(name, i, sensor.DefaultMaxTemp,
|
temperatures[i] = new Sensor(name, i, sensor.DefaultMaxTemp,
|
||||||
SensorType.Temperature, this);
|
SensorType.Temperature, this, new ParameterDescription[0]);
|
||||||
ActivateSensor(temperatures[i]);
|
ActivateSensor(temperatures[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,8 +93,8 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/nvidiagpu/" + adapterIndex; }
|
get { return new Identifier("nvidiagpu", adapterIndex.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image Icon {
|
public Image Icon {
|
||||||
|
@@ -68,8 +68,9 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
public Parameter(ParameterDescription description, ISensor sensor) {
|
public Parameter(ParameterDescription description, ISensor sensor) {
|
||||||
this.sensor = sensor;
|
this.sensor = sensor;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.value = Utilities.Config.Get(Identifier, description.DefaultValue);
|
this.value = Utilities.Config.Get(Identifier.ToString(),
|
||||||
this.isDefault = !Utilities.Config.Contains(Identifier);
|
description.DefaultValue);
|
||||||
|
this.isDefault = !Utilities.Config.Contains(Identifier.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISensor Sensor {
|
public ISensor Sensor {
|
||||||
@@ -78,10 +79,10 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get {
|
get {
|
||||||
return sensor.Identifier + "/parameter/" +
|
return new Identifier(sensor.Identifier, "parameter",
|
||||||
Name.Replace(" ", "").ToLower();
|
Name.Replace(" ", "").ToLower());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
set {
|
set {
|
||||||
this.isDefault = false;
|
this.isDefault = false;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
Utilities.Config.Set(Identifier, value);
|
Utilities.Config.Set(Identifier.ToString(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
this.isDefault = value;
|
this.isDefault = value;
|
||||||
if (value) {
|
if (value) {
|
||||||
this.value = description.DefaultValue;
|
this.value = description.DefaultValue;
|
||||||
Utilities.Config.Remove(Identifier);
|
Utilities.Config.Remove(Identifier.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,6 +46,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
private string defaultName;
|
private string defaultName;
|
||||||
private string name;
|
private string name;
|
||||||
private int index;
|
private int index;
|
||||||
|
private bool defaultHidden;
|
||||||
private SensorType sensorType;
|
private SensorType sensorType;
|
||||||
private IHardware hardware;
|
private IHardware hardware;
|
||||||
private ReadOnlyArray<IParameter> parameters;
|
private ReadOnlyArray<IParameter> parameters;
|
||||||
@@ -64,31 +65,37 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
|
|
||||||
public Sensor(string name, int index, SensorType sensorType,
|
public Sensor(string name, int index, SensorType sensorType,
|
||||||
IHardware hardware) : this(name, index, null, sensorType, hardware,
|
IHardware hardware) : this(name, index, null, sensorType, hardware,
|
||||||
new ParameterDescription[0]) { }
|
null) { }
|
||||||
|
|
||||||
public Sensor(string name, int index, float? limit,
|
|
||||||
SensorType sensorType, IHardware hardware) : this(name, index, limit,
|
|
||||||
sensorType, hardware, new ParameterDescription[0]) { }
|
|
||||||
|
|
||||||
public Sensor(string name, int index, float? limit, SensorType sensorType,
|
public Sensor(string name, int index, float? limit, SensorType sensorType,
|
||||||
IHardware hardware, ParameterDescription[] parameterDescriptions)
|
IHardware hardware, ParameterDescription[] parameterDescriptions) :
|
||||||
|
this(name, index, false, limit, sensorType, hardware,
|
||||||
|
parameterDescriptions) { }
|
||||||
|
|
||||||
|
public Sensor(string name, int index, bool defaultHidden,
|
||||||
|
float? limit, SensorType sensorType, IHardware hardware,
|
||||||
|
ParameterDescription[] parameterDescriptions)
|
||||||
{
|
{
|
||||||
this.defaultName = name;
|
this.defaultName = name;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
this.defaultHidden = defaultHidden;
|
||||||
this.defaultLimit = limit;
|
this.defaultLimit = limit;
|
||||||
this.sensorType = sensorType;
|
this.sensorType = sensorType;
|
||||||
this.hardware = hardware;
|
this.hardware = hardware;
|
||||||
Parameter[] parameters = new Parameter[parameterDescriptions.Length];
|
Parameter[] parameters = new Parameter[parameterDescriptions == null ?
|
||||||
|
0 : parameterDescriptions.Length];
|
||||||
for (int i = 0; i < parameters.Length; i++ )
|
for (int i = 0; i < parameters.Length; i++ )
|
||||||
parameters[i] = new Parameter(parameterDescriptions[i], this);
|
parameters[i] = new Parameter(parameterDescriptions[i], this);
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
|
|
||||||
string configName = Config.Settings[Identifier + "/name"];
|
string configName = Config.Settings[
|
||||||
|
new Identifier(Identifier, "name").ToString()];
|
||||||
if (configName != null)
|
if (configName != null)
|
||||||
this.name = configName;
|
this.name = configName;
|
||||||
else
|
else
|
||||||
this.name = name;
|
this.name = name;
|
||||||
string configLimit = Config.Settings[Identifier + "/limit"];
|
string configLimit = Config.Settings[
|
||||||
|
new Identifier(Identifier, "limit").ToString()];
|
||||||
if (configLimit != null && configLimit != "")
|
if (configLimit != null && configLimit != "")
|
||||||
this.limit = float.Parse(configLimit);
|
this.limit = float.Parse(configLimit);
|
||||||
else
|
else
|
||||||
@@ -103,10 +110,10 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
get { return sensorType; }
|
get { return sensorType; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get {
|
get {
|
||||||
return hardware.Identifier + "/" + sensorType.ToString().ToLower() +
|
return new Identifier(hardware.Identifier,
|
||||||
"/" + index;
|
sensorType.ToString().ToLower(), index.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +126,7 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
name = value;
|
name = value;
|
||||||
else
|
else
|
||||||
name = defaultName;
|
name = defaultName;
|
||||||
Config.Settings[Identifier + "/name"] = name;
|
Config.Settings[new Identifier(Identifier, "name").ToString()] = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +134,10 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
get { return index; }
|
get { return index; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsDefaultHidden {
|
||||||
|
get { return defaultHidden; }
|
||||||
|
}
|
||||||
|
|
||||||
public IReadOnlyArray<IParameter> Parameters {
|
public IReadOnlyArray<IParameter> Parameters {
|
||||||
get { return parameters; }
|
get { return parameters; }
|
||||||
}
|
}
|
||||||
@@ -169,11 +180,11 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
set {
|
set {
|
||||||
if (value.HasValue) {
|
if (value.HasValue) {
|
||||||
limit = value;
|
limit = value;
|
||||||
Config.Settings[Identifier + "/limit"] =
|
Config.Settings[new Identifier(Identifier, "limit").ToString()] =
|
||||||
limit.ToString();
|
limit.ToString();
|
||||||
} else {
|
} else {
|
||||||
limit = defaultLimit;
|
limit = defaultLimit;
|
||||||
Config.Settings[Identifier + "/limit"] = "";
|
Config.Settings[new Identifier(Identifier, "limit").ToString()] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -153,7 +153,7 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
|||||||
if (miniNGFans[number * 2 + i] == null)
|
if (miniNGFans[number * 2 + i] == null)
|
||||||
miniNGFans[number * 2 + i] =
|
miniNGFans[number * 2 + i] =
|
||||||
new Sensor("miniNG #" + (number + 1) + " Fan Channel " + (i + 1),
|
new Sensor("miniNG #" + (number + 1) + " Fan Channel " + (i + 1),
|
||||||
4 + number * 2 + i, maxRPM, SensorType.Fan, this);
|
4 + number * 2 + i, maxRPM, SensorType.Fan, this, null);
|
||||||
|
|
||||||
Sensor sensor = miniNGFans[number * 2 + i];
|
Sensor sensor = miniNGFans[number * 2 + i];
|
||||||
|
|
||||||
@@ -251,8 +251,8 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
|
|||||||
get { return "T-Balancer bigNG"; }
|
get { return "T-Balancer bigNG"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Identifier {
|
public Identifier Identifier {
|
||||||
get { return "/bigng/" + this.portIndex; }
|
get { return new Identifier("bigng", this.portIndex.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHardware[] SubHardware {
|
public IHardware[] SubHardware {
|
||||||
|
@@ -85,6 +85,7 @@
|
|||||||
<Compile Include="Hardware\HDD\HDDGroup.cs" />
|
<Compile Include="Hardware\HDD\HDDGroup.cs" />
|
||||||
<Compile Include="Hardware\HDD\SMART.cs" />
|
<Compile Include="Hardware\HDD\SMART.cs" />
|
||||||
<Compile Include="Hardware\IComputer.cs" />
|
<Compile Include="Hardware\IComputer.cs" />
|
||||||
|
<Compile Include="Hardware\Identifier.cs" />
|
||||||
<Compile Include="Hardware\IParameter.cs" />
|
<Compile Include="Hardware\IParameter.cs" />
|
||||||
<Compile Include="Hardware\LPC\Chip.cs" />
|
<Compile Include="Hardware\LPC\Chip.cs" />
|
||||||
<Compile Include="Hardware\LPC\F718XX.cs" />
|
<Compile Include="Hardware\LPC\F718XX.cs" />
|
||||||
@@ -127,6 +128,7 @@
|
|||||||
<Compile Include="Utilities\HexStringArray.cs" />
|
<Compile Include="Utilities\HexStringArray.cs" />
|
||||||
<Compile Include="Utilities\IconFactory.cs" />
|
<Compile Include="Utilities\IconFactory.cs" />
|
||||||
<Compile Include="Utilities\IReadOnlyArray.cs" />
|
<Compile Include="Utilities\IReadOnlyArray.cs" />
|
||||||
|
<Compile Include="Utilities\ListSet.cs" />
|
||||||
<Compile Include="Utilities\PInvokeDelegateFactory.cs" />
|
<Compile Include="Utilities\PInvokeDelegateFactory.cs" />
|
||||||
<Compile Include="GUI\PlotPanel.cs">
|
<Compile Include="GUI\PlotPanel.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
|
70
Utilities/ListSet.cs
Normal file
70
Utilities/ListSet.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
||||||
|
The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
for the specific language governing rights and limitations under the License.
|
||||||
|
|
||||||
|
The Original Code is the Open Hardware Monitor code.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is
|
||||||
|
Michael Möller <m.moeller@gmx.ch>.
|
||||||
|
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
|
||||||
|
Alternatively, the contents of this file may be used under the terms of
|
||||||
|
either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
of those above. If you wish to allow use of your version of this file only
|
||||||
|
under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
use your version of this file under the terms of the MPL, indicate your
|
||||||
|
decision by deleting the provisions above and replace them with the notice
|
||||||
|
and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
the provisions above, a recipient may use your version of this file under
|
||||||
|
the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenHardwareMonitor.Utilities {
|
||||||
|
public class ListSet<T> {
|
||||||
|
|
||||||
|
private List<T> list = new List<T>();
|
||||||
|
|
||||||
|
public ListSet() { }
|
||||||
|
|
||||||
|
public bool Add(T item) {
|
||||||
|
if (list.Contains(item))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
list.Add(item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Remove(T item) {
|
||||||
|
if (!list.Contains(item))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
list.Remove(item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Contains(T item) {
|
||||||
|
return list.Contains(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user