Fixed the following Exception:

System.ArgumentOutOfRangeException: 텍스트 길이는 64자 미만이어야 합니다.
매개 변수 이름: Text
실제 값은 ATI Radeon HD 4800 Series  (Microsoft Corporation WDDM 1.1)
GPU Core: 56.5 °C입니다.
   위치: System.Windows.Forms.NotifyIcon.set_Text(String value)
   위치: OpenHardwareMonitor.GUI.SensorNotifyIcon.Update()
   위치: OpenHardwareMonitor.GUI.SensorSystemTray.Redraw()
   위치: System.Windows.Forms.Timer.OnTick(EventArgs e)
   위치: System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   위치: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
This commit is contained in:
Michael Möller
2010-05-15 11:34:36 +00:00
parent 9b0113e6b0
commit 5e4b9607e7
+14 -8
View File
@@ -227,16 +227,22 @@ namespace OpenHardwareMonitor.GUI {
string format = "";
switch (sensor.SensorType) {
case SensorType.Voltage: format = "{0}\n{1}: {2:F2} V"; break;
case SensorType.Clock: format = "{0}\n{1}: {2:F0} MHz"; break;
case SensorType.Load: format = "{0}\n{1}: {2:F1} %"; break;
case SensorType.Temperature: format = "{0}\n{1}: {2:F1} °C"; break;
case SensorType.Fan: format = "{0}\n{1}: {2:F0} RPM"; break;
case SensorType.Flow: format = "{0}\n{1}: {2:F0} L/h"; break;
case SensorType.Voltage: format = "\n{0}: {1:F2} V"; break;
case SensorType.Clock: format = "\n{0}: {1:F0} MHz"; break;
case SensorType.Load: format = "\n{0}: {1:F1} %"; break;
case SensorType.Temperature: format = "\n{0}: {1:F1} °C"; break;
case SensorType.Fan: format = "\n{0}: {1:F0} RPM"; break;
case SensorType.Flow: format = "\n{0}: {1:F0} L/h"; break;
}
string formattedValue = string.Format(format, sensor.Name, sensor.Value);
string hardwareName = sensor.Hardware.Name;
hardwareName = hardwareName.Substring(0,
Math.Min(63 - formattedValue.Length, hardwareName.Length));
string text = hardwareName + formattedValue;
if (text.Length > 63)
text = null;
notifyIcon.Text = string.Format(format, sensor.Hardware.Name, sensor.Name,
sensor.Value);
notifyIcon.Text = text;
notifyIcon.Visible = true;
}
}