From 5e4b9607e768dd6d6f1823c447db7565b190fbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Sat, 15 May 2010 11:34:36 +0000 Subject: [PATCH] Fixed the following Exception: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- GUI/SensorNotifyIcon.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/GUI/SensorNotifyIcon.cs b/GUI/SensorNotifyIcon.cs index 580c204..4d1b165 100644 --- a/GUI/SensorNotifyIcon.cs +++ b/GUI/SensorNotifyIcon.cs @@ -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; } }