Added a WMI provider, documentation to follow.

This commit is contained in:
Paul Werelds
2010-10-16 13:29:06 +00:00
parent e7ab97fd84
commit ebc1e612d9
7 changed files with 243 additions and 23 deletions
+40
View File
@@ -0,0 +1,40 @@
using System.Management.Instrumentation;
using OpenHardwareMonitor.Hardware;
namespace OpenHardwareMonitor.WMIProvider {
[InstrumentationClass(InstrumentationType.Instance)]
public class Sensor : IWmiClass {
private ISensor _sensor;
public string SensorType { get; private set; }
public string Identifier { get; private set; }
public string Parent { get; private set; }
public string Name { get; private set; }
public float Value { get; private set; }
public float Min { get; private set; }
public float Max { get; private set; }
public int Index { get; private set; }
public Sensor(ISensor sensor) {
Name = sensor.Name;
Index = sensor.Index;
SensorType = sensor.SensorType.ToString();
Identifier = sensor.Identifier.ToString();
Parent = sensor.Hardware.Identifier.ToString();
_sensor = sensor;
}
public void Update() {
Value = (_sensor.Value != null) ? (float)_sensor.Value : 0;
if (_sensor.Min != null)
Min = (float)_sensor.Min;
if (_sensor.Max != null)
Max = (float)_sensor.Max;
}
}
}