diff --git a/GUI/HardwareNode.cs b/GUI/HardwareNode.cs index 3c90d34..def8753 100644 --- a/GUI/HardwareNode.cs +++ b/GUI/HardwareNode.cs @@ -64,6 +64,7 @@ namespace OpenHardwareMonitor.GUI { typeNodes.Add(new TypeNode(SensorType.Fan)); typeNodes.Add(new TypeNode(SensorType.Flow)); typeNodes.Add(new TypeNode(SensorType.Control)); + typeNodes.Add(new TypeNode(SensorType.Level)); foreach (ISensor sensor in hardware.Sensors) SensorAdded(sensor); diff --git a/GUI/SensorGadget.cs b/GUI/SensorGadget.cs index ee079c9..684a73f 100644 --- a/GUI/SensorGadget.cs +++ b/GUI/SensorGadget.cs @@ -429,7 +429,8 @@ namespace OpenHardwareMonitor.GUI { if ((sensor.SensorType != SensorType.Load && - sensor.SensorType != SensorType.Control) || !sensor.Value.HasValue) + sensor.SensorType != SensorType.Control && + sensor.SensorType != SensorType.Level) || !sensor.Value.HasValue) { string formatted; diff --git a/GUI/SensorNode.cs b/GUI/SensorNode.cs index 8cb39b9..9d721bf 100644 --- a/GUI/SensorNode.cs +++ b/GUI/SensorNode.cs @@ -74,6 +74,7 @@ namespace OpenHardwareMonitor.GUI { case SensorType.Fan: format = "{0:F0} RPM"; break; case SensorType.Flow: format = "{0:F0} L/h"; break; case SensorType.Control: format = "{0:F1} %"; break; + case SensorType.Level: format = "{0:F1} %"; break; } bool hidden = settings.GetValue(new Identifier(sensor.Identifier, diff --git a/GUI/SensorNotifyIcon.cs b/GUI/SensorNotifyIcon.cs index 46ea599..8a5f704 100644 --- a/GUI/SensorNotifyIcon.cs +++ b/GUI/SensorNotifyIcon.cs @@ -66,7 +66,10 @@ namespace OpenHardwareMonitor.GUI { this.notifyIcon = new NotifyIcon(); Color defaultColor = Color.Black; - if (sensor.SensorType == SensorType.Load) { + if (sensor.SensorType == SensorType.Load || + sensor.SensorType == SensorType.Control || + sensor.SensorType == SensorType.Level) + { defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1); } Color = settings.GetValue(new Identifier(sensor.Identifier, @@ -173,6 +176,8 @@ namespace OpenHardwareMonitor.GUI { return string.Format("{0:F11}", 1e-3f * sensor.Value); case SensorType.Control: return string.Format("{0:F0}", sensor.Value); + case SensorType.Level: + return string.Format("{0:F0}", sensor.Value); } return "-"; } @@ -209,7 +214,7 @@ namespace OpenHardwareMonitor.GUI { return IconFactory.Create(bytes, 16, 16, PixelFormat.Format32bppArgb); } - private Icon CreateLoadIcon() { + private Icon CreatePercentageIcon() { try { graphics.Clear(Color.Transparent); } catch (ArgumentException) { @@ -233,11 +238,17 @@ namespace OpenHardwareMonitor.GUI { public void Update() { Icon icon = notifyIcon.Icon; - if (sensor.SensorType == SensorType.Load) { - notifyIcon.Icon = CreateLoadIcon(); - } else { - notifyIcon.Icon = CreateTransparentIcon(); + switch (sensor.SensorType) { + case SensorType.Load: + case SensorType.Control: + case SensorType.Level: + notifyIcon.Icon = CreatePercentageIcon(); + break; + default: + notifyIcon.Icon = CreateTransparentIcon(); + break; } + if (icon != null) icon.Dispose(); @@ -250,6 +261,7 @@ namespace OpenHardwareMonitor.GUI { case SensorType.Fan: format = "\n{0}: {1:F0} RPM"; break; case SensorType.Flow: format = "\n{0}: {1:F0} L/h"; break; case SensorType.Control: format = "\n{0}: {1:F1} %"; break; + case SensorType.Level: format = "\n{0}: {1:F1} %"; break; } string formattedValue = string.Format(format, sensor.Name, sensor.Value); string hardwareName = sensor.Hardware.Name; diff --git a/GUI/TypeNode.cs b/GUI/TypeNode.cs index eabd722..f53b393 100644 --- a/GUI/TypeNode.cs +++ b/GUI/TypeNode.cs @@ -76,6 +76,10 @@ namespace OpenHardwareMonitor.GUI { this.Image = Utilities.EmbeddedResources.GetImage("control.png"); this.Text = "Controls"; break; + case SensorType.Level: + this.Image = Utilities.EmbeddedResources.GetImage("level.png"); + this.Text = "Levels"; + break; } NodeAdded += new NodeEventHandler(TypeNode_NodeAdded); diff --git a/Hardware/ISensor.cs b/Hardware/ISensor.cs index 3e12069..849d1a4 100644 --- a/Hardware/ISensor.cs +++ b/Hardware/ISensor.cs @@ -48,7 +48,8 @@ namespace OpenHardwareMonitor.Hardware { Load, Fan, Flow, - Control + Control, + Level } public struct SensorValue { diff --git a/OpenHardwareMonitor.csproj b/OpenHardwareMonitor.csproj index 5e27749..41463eb 100644 --- a/OpenHardwareMonitor.csproj +++ b/OpenHardwareMonitor.csproj @@ -205,6 +205,9 @@ + + + diff --git a/Resources/level.png b/Resources/level.png new file mode 100644 index 0000000..0c78b53 Binary files /dev/null and b/Resources/level.png differ