# HG changeset patch # User moel.mich # Date 1281646407 0 # Node ID fa9dfbfc4145075b37249c6d4c40a9619345549f # Parent 813d8bc3192f4b854a114256d670c14f9657b5b3 Changed the project files to Visual Studio 2010. Fixed some Code Analysis warnings. diff -r 813d8bc3192f -r fa9dfbfc4145 GUI/MainForm.cs --- a/GUI/MainForm.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/GUI/MainForm.cs Thu Aug 12 20:53:27 2010 +0000 @@ -107,9 +107,9 @@ nodeTextBoxText.EditorShowing += nodeTextBoxText_EditorShowing; if (settings.Contains("mainForm.Location.X")) { - int x = settings.Get("mainForm.Location.X", Location.X); + int x = settings.GetValue("mainForm.Location.X", Location.X); x = x < 0 ? 0 : x; - int y = settings.Get("mainForm.Location.Y", Location.Y); + int y = settings.GetValue("mainForm.Location.Y", Location.Y); y = y < 0 ? 0 : y; this.Location = new Point(x, y); } else { @@ -117,12 +117,12 @@ } ClientSize = new Size( - settings.Get("mainForm.Width", 470), - settings.Get("mainForm.Height", 640)); + settings.GetValue("mainForm.Width", 470), + settings.GetValue("mainForm.Height", 640)); foreach (TreeColumn column in treeView.Columns) column.Width = Math.Max(20, Math.Min(400, - settings.Get("treeView.Columns." + column.Header + ".Width", + settings.GetValue("treeView.Columns." + column.Header + ".Width", column.Width))); treeModel = new TreeModel(); @@ -317,14 +317,14 @@ private void SaveConfiguration() { if (WindowState != FormWindowState.Minimized) { - settings.Set("mainForm.Location.X", Location.X); - settings.Set("mainForm.Location.Y", Location.Y); - settings.Set("mainForm.Width", ClientSize.Width); - settings.Set("mainForm.Height", ClientSize.Height); + settings.SetValue("mainForm.Location.X", Location.X); + settings.SetValue("mainForm.Location.Y", Location.Y); + settings.SetValue("mainForm.Width", ClientSize.Width); + settings.SetValue("mainForm.Height", ClientSize.Height); } foreach (TreeColumn column in treeView.Columns) - settings.Set("treeView.Columns." + column.Header + ".Width", + settings.SetValue("treeView.Columns." + column.Header + ".Width", column.Width); settings.Save(Path.ChangeExtension( diff -r 813d8bc3192f -r fa9dfbfc4145 GUI/SensorNode.cs --- a/GUI/SensorNode.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/GUI/SensorNode.cs Thu Aug 12 20:53:27 2010 +0000 @@ -76,7 +76,7 @@ case SensorType.Control: format = "{0:F1} %"; break; } - bool hidden = settings.Get(new Identifier(sensor.Identifier, + bool hidden = settings.GetValue(new Identifier(sensor.Identifier, "hidden").ToString(), sensor.IsDefaultHidden); base.IsVisible = !hidden; } @@ -90,7 +90,7 @@ get { return base.IsVisible; } set { base.IsVisible = value; - settings.Set(new Identifier(sensor.Identifier, + settings.SetValue(new Identifier(sensor.Identifier, "hidden").ToString(), !value); } } diff -r 813d8bc3192f -r fa9dfbfc4145 GUI/SensorNotifyIcon.cs --- a/GUI/SensorNotifyIcon.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/GUI/SensorNotifyIcon.cs Thu Aug 12 20:53:27 2010 +0000 @@ -71,7 +71,7 @@ if (sensor.SensorType == SensorType.Load) { defaultColor = Color.FromArgb(0xff, 0x70, 0x8c, 0xf1); } - Color = settings.Get(new Identifier(sensor.Identifier, + Color = settings.GetValue(new Identifier(sensor.Identifier, "traycolor").ToString(), defaultColor); this.pen = new Pen(Color.FromArgb(96, Color.Black)); @@ -95,7 +95,7 @@ dialog.Color = Color; if (dialog.ShowDialog() == DialogResult.OK) { Color = dialog.Color; - settings.Set(new Identifier(sensor.Identifier, + settings.SetValue(new Identifier(sensor.Identifier, "traycolor").ToString(), Color); } }; diff -r 813d8bc3192f -r fa9dfbfc4145 GUI/SystemTray.cs --- a/GUI/SystemTray.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/GUI/SystemTray.cs Thu Aug 12 20:53:27 2010 +0000 @@ -97,7 +97,7 @@ } private void SensorAdded(ISensor sensor) { - if (settings.Get(new Identifier(sensor.Identifier, + if (settings.GetValue(new Identifier(sensor.Identifier, "tray").ToString(), false)) Add(sensor, false); } @@ -131,7 +131,7 @@ } else { list.Add(new SensorNotifyIcon(this, sensor, balloonTip, settings)); UpdateMainIconVisibilty(); - settings.Set(new Identifier(sensor.Identifier, "tray").ToString(), true); + settings.SetValue(new Identifier(sensor.Identifier, "tray").ToString(), true); } } diff -r 813d8bc3192f -r fa9dfbfc4145 GUI/UnitManager.cs --- a/GUI/UnitManager.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/GUI/UnitManager.cs Thu Aug 12 20:53:27 2010 +0000 @@ -52,7 +52,7 @@ public UnitManager(PersistentSettings settings) { this.settings = settings; - this.temperatureUnit = (TemperatureUnit)settings.Get("TemperatureUnit", + this.temperatureUnit = (TemperatureUnit)settings.GetValue("TemperatureUnit", (int)TemperatureUnit.Celcius); } @@ -60,7 +60,7 @@ get { return temperatureUnit; } set { this.temperatureUnit = value; - this.settings.Set("TemperatureUnit", (int)temperatureUnit); + this.settings.SetValue("TemperatureUnit", (int)temperatureUnit); } } } diff -r 813d8bc3192f -r fa9dfbfc4145 GUI/UserOption.cs --- a/GUI/UserOption.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/GUI/UserOption.cs Thu Aug 12 20:53:27 2010 +0000 @@ -54,7 +54,7 @@ this.settings = settings; this.name = name; if (name != null) - this.value = settings.Get(name, value); + this.value = settings.GetValue(name, value); else this.value = value; this.menuItem = menuItem; @@ -72,7 +72,7 @@ if (this.value != value) { this.value = value; if (this.name != null) - settings.Set(name, value); + settings.SetValue(name, value); this.menuItem.Checked = value; if (changed != null) changed(this, null); diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/ATI/ATIGPU.cs --- a/Hardware/ATI/ATIGPU.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/ATI/ATIGPU.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,9 +37,10 @@ using System; using System.Collections.Generic; +using System.Globalization; namespace OpenHardwareMonitor.Hardware.ATI { - internal class ATIGPU : Hardware { + internal sealed class ATIGPU : Hardware { private string name; private int adapterIndex; @@ -80,7 +81,10 @@ } public override Identifier Identifier { - get { return new Identifier("atigpu", adapterIndex.ToString()); } + get { + return new Identifier("atigpu", + adapterIndex.ToString(CultureInfo.InvariantCulture)); + } } public override HardwareType HardwareType { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/ATI/ATIGroup.cs --- a/Hardware/ATI/ATIGroup.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/ATI/ATIGroup.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.ATI { @@ -55,7 +56,7 @@ if (status == ADL.ADL_OK) report.AppendLine("OK"); else - report.AppendLine(status.ToString()); + report.AppendLine(status.ToString(CultureInfo.InvariantCulture)); report.AppendLine(); if (status == ADL.ADL_OK) { @@ -63,7 +64,7 @@ ADL.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters); report.Append("Number of adapters: "); - report.AppendLine(numberOfAdapters.ToString()); + report.AppendLine(numberOfAdapters.ToString(CultureInfo.InvariantCulture)); report.AppendLine(); if (numberOfAdapters > 0) { @@ -78,25 +79,30 @@ out adapterID); report.Append("AdapterIndex: "); - report.AppendLine(i.ToString()); + report.AppendLine(i.ToString(CultureInfo.InvariantCulture)); report.Append("isActive: "); - report.AppendLine(isActive.ToString()); + report.AppendLine(isActive.ToString(CultureInfo.InvariantCulture)); report.Append("AdapterName: "); report.AppendLine(adapterInfo[i].AdapterName); report.Append("UDID: "); report.AppendLine(adapterInfo[i].UDID); report.Append("Present: "); - report.AppendLine(adapterInfo[i].Present.ToString()); + report.AppendLine(adapterInfo[i].Present.ToString( + CultureInfo.InvariantCulture)); report.Append("VendorID: "); - report.AppendLine(adapterInfo[i].VendorID.ToString()); + report.AppendLine(adapterInfo[i].VendorID.ToString( + CultureInfo.InvariantCulture)); report.Append("BusNumber: "); - report.AppendLine(adapterInfo[i].BusNumber.ToString()); + report.AppendLine(adapterInfo[i].BusNumber.ToString( + CultureInfo.InvariantCulture)); report.Append("DeviceNumber: "); - report.AppendLine(adapterInfo[i].DeviceNumber.ToString()); + report.AppendLine(adapterInfo[i].DeviceNumber.ToString( + CultureInfo.InvariantCulture)); report.Append("FunctionNumber: "); - report.AppendLine(adapterInfo[i].FunctionNumber.ToString()); + report.AppendLine(adapterInfo[i].FunctionNumber.ToString( + CultureInfo.InvariantCulture)); report.Append("AdapterID: 0x"); - report.AppendLine(adapterID.ToString("X")); + report.AppendLine(adapterID.ToString("X", CultureInfo.InvariantCulture)); if (adapterID != 0 && adapterInfo[i].UDID != "" && (adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID1 || diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/CPU/AMD0FCPU.cs --- a/Hardware/CPU/AMD0FCPU.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/CPU/AMD0FCPU.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,10 +37,11 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.CPU { - internal class AMD0FCPU : Hardware, IHardware { + internal sealed class AMD0FCPU : Hardware, IHardware { private string name; @@ -117,7 +118,10 @@ } public override Identifier Identifier { - get { return new Identifier("amdcpu", processorIndex.ToString()); } + get { + return new Identifier("amdcpu", + processorIndex.ToString(CultureInfo.InvariantCulture)); + } } public override HardwareType HardwareType { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/CPU/AMD10CPU.cs --- a/Hardware/CPU/AMD10CPU.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/CPU/AMD10CPU.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,12 +37,13 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Diagnostics; using System.Text; namespace OpenHardwareMonitor.Hardware.CPU { - internal class AMD10CPU : Hardware, IHardware { + internal sealed class AMD10CPU : Hardware, IHardware { private string name; private int processorIndex; @@ -101,7 +102,10 @@ } public override Identifier Identifier { - get { return new Identifier("amdcpu", processorIndex.ToString()); } + get { + return new Identifier("amdcpu", + processorIndex.ToString(CultureInfo.InvariantCulture)); + } } public override HardwareType HardwareType { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/CPU/CPUGroup.cs --- a/Hardware/CPU/CPUGroup.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/CPU/CPUGroup.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Diagnostics; using System.Text; @@ -153,10 +154,10 @@ private void AppendCpuidData(StringBuilder r, uint[,] data, uint offset) { for (int i = 0; i < data.GetLength(0); i++) { r.Append(" "); - r.Append((i + offset).ToString("X8")); + r.Append((i + offset).ToString("X8", CultureInfo.InvariantCulture)); for (int j = 0; j < 4; j++) { r.Append(" "); - r.Append(data[i, j].ToString("X8")); + r.Append(data[i, j].ToString("X8", CultureInfo.InvariantCulture)); } r.AppendLine(); } @@ -180,11 +181,14 @@ r.AppendFormat("Processor Brand: {0}{1}", threads[i][0][0].BrandString, Environment.NewLine); r.AppendFormat("Family: 0x{0}{1}", - threads[i][0][0].Family.ToString("X"), Environment.NewLine); - r.AppendFormat("Model: 0x{0}{1}", - threads[i][0][0].Model.ToString("X"), Environment.NewLine); - r.AppendFormat("Stepping: 0x{0}{1}", - threads[i][0][0].Stepping.ToString("X"), Environment.NewLine); + threads[i][0][0].Family.ToString("X", CultureInfo.InvariantCulture), + Environment.NewLine); + r.AppendFormat("Model: 0x{0}{1}", + threads[i][0][0].Model.ToString("X", CultureInfo.InvariantCulture), + Environment.NewLine); + r.AppendFormat("Stepping: 0x{0}{1}", + threads[i][0][0].Stepping.ToString("X", CultureInfo.InvariantCulture), + Environment.NewLine); r.AppendLine(); r.AppendLine("CPUID Return Values"); diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/CPU/CPULoad.cs --- a/Hardware/CPU/CPULoad.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/CPU/CPULoad.cs Thu Aug 12 20:53:27 2010 +0000 @@ -127,10 +127,10 @@ if (this.idleTimes == null) return; - long systemTime = DateTime.Now.Ticks; - long[] idleTimes = GetIdleTimes(); + long localSystemTime = DateTime.Now.Ticks; + long[] localIdleTimes = GetIdleTimes(); - if (systemTime - this.systemTime < 10000) + if (localSystemTime - this.systemTime < 10000) return; float total = 0; @@ -139,28 +139,28 @@ float value = 0; for (int j = 0; j < cpuid[i].Length; j++) { long index = cpuid[i][j].Thread; - if (index < idleTimes.Length) { - long delta = idleTimes[index] - this.idleTimes[index]; + if (index < localIdleTimes.Length) { + long delta = localIdleTimes[index] - this.idleTimes[index]; value += delta; total += delta; count++; } } value = 1.0f - value / (cpuid[i].Length * - (systemTime - this.systemTime)); + (localSystemTime - this.systemTime)); value = value < 0 ? 0 : value; coreLoads[i] = value * 100; } if (count > 0) { - total = 1.0f - total / (count * (systemTime - this.systemTime)); + total = 1.0f - total / (count * (localSystemTime - this.systemTime)); total = total < 0 ? 0 : total; } else { total = 0; } this.totalLoad = total * 100; - this.systemTime = systemTime; - this.idleTimes = idleTimes; + this.systemTime = localSystemTime; + this.idleTimes = localIdleTimes; } } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/CPU/IntelCPU.cs --- a/Hardware/CPU/IntelCPU.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/CPU/IntelCPU.cs Thu Aug 12 20:53:27 2010 +0000 @@ -45,7 +45,7 @@ using System.Text; namespace OpenHardwareMonitor.Hardware.CPU { - internal class IntelCPU : Hardware, IHardware { + internal sealed class IntelCPU : Hardware, IHardware { private int processorIndex; private CPUID[][] cpuid; @@ -243,7 +243,10 @@ } public override Identifier Identifier { - get { return new Identifier("intelcpu", processorIndex.ToString()); } + get { + return new Identifier("intelcpu", + processorIndex.ToString(CultureInfo.InvariantCulture)); + } } public override HardwareType HardwareType { @@ -254,11 +257,11 @@ uint eax, edx; if (WinRing0.RdmsrTx(msr, out eax, out edx, (UIntPtr)(1L << thread))) { r.Append(" "); - r.Append((msr).ToString("X8")); + r.Append((msr).ToString("X8", CultureInfo.InvariantCulture)); r.Append(" "); - r.Append((edx).ToString("X8")); + r.Append((edx).ToString("X8", CultureInfo.InvariantCulture)); r.Append(" "); - r.Append((eax).ToString("X8")); + r.Append((eax).ToString("X8", CultureInfo.InvariantCulture)); r.AppendLine(); } } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Computer.cs --- a/Hardware/Computer.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Computer.cs Thu Aug 12 20:53:27 2010 +0000 @@ -196,7 +196,7 @@ public string GetReport() { - using (StringWriter w = new StringWriter()) { + using (StringWriter w = new StringWriter(CultureInfo.InvariantCulture)) { w.WriteLine(); w.WriteLine("Open Hardware Monitor Report"); @@ -266,7 +266,8 @@ public event HardwareEventHandler HardwareRemoved; public void Accept(IVisitor visitor) { - visitor.VisitComputer(this); + if (visitor != null) + visitor.VisitComputer(this); } public void Traverse(IVisitor visitor) { @@ -281,9 +282,9 @@ return false; } - public void Set(string name, string value) { } + public void SetValue(string name, string value) { } - public string Get(string name, string value) { + public string GetValue(string name, string value) { return value; } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/HDD/HDD.cs --- a/Hardware/HDD/HDD.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/HDD/HDD.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; namespace OpenHardwareMonitor.Hardware.HDD { internal class HDD : IHardware { @@ -70,7 +71,10 @@ } public Identifier Identifier { - get { return new Identifier("hdd", drive.ToString()); } + get { + return new Identifier("hdd", + drive.ToString(CultureInfo.InvariantCulture)); + } } public HardwareType HardwareType { @@ -113,7 +117,8 @@ #pragma warning restore 67 public void Accept(IVisitor visitor) { - visitor.VisitHardware(this); + if (visitor != null) + visitor.VisitHardware(this); } public void Traverse(IVisitor visitor) { } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Hardware.cs --- a/Hardware/Hardware.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Hardware.cs Thu Aug 12 20:53:27 2010 +0000 @@ -80,7 +80,8 @@ public abstract void Update(); public void Accept(IVisitor visitor) { - visitor.VisitHardware(this); + if (visitor != null) + visitor.VisitHardware(this); } public void Traverse(IVisitor visitor) { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/ISettings.cs --- a/Hardware/ISettings.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/ISettings.cs Thu Aug 12 20:53:27 2010 +0000 @@ -43,9 +43,9 @@ bool Contains(string name); - void Set(string name, string value); + void SetValue(string name, string value); - string Get(string name, string value); + string GetValue(string name, string value); void Remove(string name); } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/LPC/F718XX.cs --- a/Hardware/LPC/F718XX.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/LPC/F718XX.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.LPC { @@ -84,7 +85,8 @@ r.AppendLine("LPC " + this.GetType().Name); r.AppendLine(); - r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4")); + r.Append("Base Adress: 0x"); + r.AppendLine(address.ToString("X4", CultureInfo.InvariantCulture)); r.AppendLine(); if (!WinRing0.WaitIsaBusMutex(100)) @@ -95,10 +97,13 @@ r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); r.AppendLine(); for (int i = 0; i <= 0xF; i++) { - r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" "); + r.Append(" "); + r.Append((i << 4).ToString("X2", CultureInfo.InvariantCulture)); + r.Append(" "); for (int j = 0; j <= 0xF; j++) { r.Append(" "); - r.Append(ReadByte((byte)((i << 4) | j)).ToString("X2")); + r.Append(ReadByte((byte)((i << 4) | j)).ToString("X2", + CultureInfo.InvariantCulture)); } r.AppendLine(); } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/LPC/IT87XX.cs --- a/Hardware/LPC/IT87XX.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/LPC/IT87XX.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.LPC { @@ -114,8 +115,10 @@ r.AppendLine("LPC " + this.GetType().Name); r.AppendLine(); r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X")); - r.Append("Chip Version: 0x"); r.AppendLine(version.ToString("X")); - r.Append("Base Address: 0x"); r.AppendLine(address.ToString("X4")); + r.Append("Chip Version: 0x"); r.AppendLine( + version.ToString("X", CultureInfo.InvariantCulture)); + r.Append("Base Address: 0x"); r.AppendLine( + address.ToString("X4", CultureInfo.InvariantCulture)); r.AppendLine(); if (!WinRing0.WaitIsaBusMutex(100)) @@ -126,13 +129,15 @@ r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); r.AppendLine(); for (int i = 0; i <= 0xA; i++) { - r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" "); + r.Append(" "); + r.Append((i << 4).ToString("X2", CultureInfo.InvariantCulture)); + r.Append(" "); for (int j = 0; j <= 0xF; j++) { r.Append(" "); bool valid; byte value = ReadByte((byte)((i << 4) | j), out valid); if (valid) - r.Append(value.ToString("X2")); + r.Append(value.ToString("X2", CultureInfo.InvariantCulture)); else r.Append("??"); } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/LPC/LMSensors.cs --- a/Hardware/LPC/LMSensors.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/LPC/LMSensors.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; namespace OpenHardwareMonitor.Hardware.LPC { @@ -151,7 +152,8 @@ voltageReaders[i].BaseStream.Seek(0, SeekOrigin.Begin); string s = voltageReaders[i].ReadLine(); try { - voltages[i] = 0.001f * long.Parse(s); + voltages[i] = 0.001f * + long.Parse(s, CultureInfo.InvariantCulture); } catch { voltages[i] = null; } @@ -161,7 +163,8 @@ temperatureReaders[i].BaseStream.Seek(0, SeekOrigin.Begin); string s = temperatureReaders[i].ReadLine(); try { - temperatures[i] = 0.001f * long.Parse(s); + temperatures[i] = 0.001f * + long.Parse(s, CultureInfo.InvariantCulture); } catch { temperatures[i] = null; } @@ -171,7 +174,7 @@ fanReaders[i].BaseStream.Seek(0, SeekOrigin.Begin); string s = fanReaders[i].ReadLine(); try { - fans[i] = long.Parse(s); + fans[i] = long.Parse(s, CultureInfo.InvariantCulture); } catch { fans[i] = null; } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/LPC/LPCIO.cs --- a/Hardware/LPC/LPCIO.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/LPC/LPCIO.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; using System.Threading; @@ -238,7 +239,8 @@ WinbondFintekExit(); report.Append("Chip ID: Unknown Winbond / Fintek with ID 0x"); - report.AppendLine(((id << 8) | revision).ToString("X")); + report.AppendLine(((id << 8) | revision).ToString("X", + CultureInfo.InvariantCulture)); report.AppendLine(); } } else { @@ -256,7 +258,7 @@ report.Append("Chip ID: 0x"); report.AppendLine(chip.ToString("X")); report.Append("Chip revision: 0x"); - report.AppendLine(revision.ToString("X")); + report.AppendLine(revision.ToString("X", CultureInfo.InvariantCulture)); report.AppendLine("Error: Address verification failed"); report.AppendLine(); return; @@ -270,9 +272,9 @@ report.Append("Chip ID: 0x"); report.AppendLine(chip.ToString("X")); report.Append("Chip revision: 0x"); - report.AppendLine(revision.ToString("X")); + report.AppendLine(revision.ToString("X", CultureInfo.InvariantCulture)); report.Append("Error: Invalid address 0x"); - report.AppendLine(address.ToString("X")); + report.AppendLine(address.ToString("X", CultureInfo.InvariantCulture)); report.AppendLine(); return; } @@ -298,9 +300,9 @@ report.Append("Chip ID: 0x"); report.AppendLine(chip.ToString("X")); report.Append("Chip revision: 0x"); - report.AppendLine(revision.ToString("X")); + report.AppendLine(revision.ToString("X", CultureInfo.InvariantCulture)); report.Append("Error: Invalid vendor ID 0x"); - report.AppendLine(vendorID.ToString("X")); + report.AppendLine(vendorID.ToString("X", CultureInfo.InvariantCulture)); report.AppendLine(); return; } @@ -328,7 +330,7 @@ IT87Exit(); report.Append("Chip ID: Unknown ITE with ID 0x"); - report.AppendLine(chipID.ToString("X")); + report.AppendLine(chipID.ToString("X", CultureInfo.InvariantCulture)); report.AppendLine(); } } else { @@ -345,7 +347,7 @@ report.Append("Chip ID: 0x"); report.AppendLine(chip.ToString("X")); report.Append("Error: Invalid address 0x"); - report.AppendLine(address.ToString("X")); + report.AppendLine(address.ToString("X", CultureInfo.InvariantCulture)); report.AppendLine(); return; } @@ -366,7 +368,7 @@ SMSCExit(); report.Append("Chip ID: Unknown SMSC with ID 0x"); - report.AppendLine(chipID.ToString("X")); + report.AppendLine(chipID.ToString("X", CultureInfo.InvariantCulture)); report.AppendLine(); } } else { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/LPC/W836XX.cs --- a/Hardware/LPC/W836XX.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/LPC/W836XX.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.LPC { @@ -291,8 +292,10 @@ r.AppendLine("LPC " + this.GetType().Name); r.AppendLine(); r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X")); - r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X")); - r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4")); + r.Append("Chip revision: 0x"); + r.AppendLine(revision.ToString("X", CultureInfo.InvariantCulture)); + r.Append("Base Adress: 0x"); + r.AppendLine(address.ToString("X4", CultureInfo.InvariantCulture)); r.AppendLine(); if (!WinRing0.WaitIsaBusMutex(100)) @@ -303,21 +306,26 @@ r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); r.AppendLine(); for (int i = 0; i <= 0x7; i++) { - r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" "); + r.Append(" "); + r.Append((i << 4).ToString("X2", CultureInfo.InvariantCulture)); + r.Append(" "); for (int j = 0; j <= 0xF; j++) { r.Append(" "); - r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2")); + r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString( + "X2", CultureInfo.InvariantCulture)); } r.AppendLine(); } for (int k = 1; k <= 15; k++) { r.AppendLine("Bank " + k); for (int i = 0x5; i < 0x6; i++) { - r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" "); + r.Append(" "); + r.Append((i << 4).ToString("X2", CultureInfo.InvariantCulture)); + r.Append(" "); for (int j = 0; j <= 0xF; j++) { r.Append(" "); - r.Append(ReadByte((byte)(k), - (byte)((i << 4) | j)).ToString("X2")); + r.Append(ReadByte((byte)(k), (byte)((i << 4) | j)).ToString( + "X2", CultureInfo.InvariantCulture)); } r.AppendLine(); } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Mainboard/Mainboard.cs --- a/Hardware/Mainboard/Mainboard.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Mainboard/Mainboard.cs Thu Aug 12 20:53:27 2010 +0000 @@ -131,7 +131,8 @@ #pragma warning restore 67 public void Accept(IVisitor visitor) { - visitor.VisitHardware(this); + if (visitor != null) + visitor.VisitHardware(this); } public void Traverse(IVisitor visitor) { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Mainboard/SuperIOHardware.cs --- a/Hardware/Mainboard/SuperIOHardware.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Mainboard/SuperIOHardware.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using OpenHardwareMonitor.Hardware.LPC; namespace OpenHardwareMonitor.Hardware.Mainboard { @@ -593,7 +594,10 @@ } public override Identifier Identifier { - get { return new Identifier("lpc", superIO.Chip.ToString().ToLower()); } + get { + return new Identifier("lpc", + superIO.Chip.ToString().ToLower(CultureInfo.InvariantCulture)); + } } public override HardwareType HardwareType { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Nvidia/NvidiaGPU.cs --- a/Hardware/Nvidia/NvidiaGPU.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Nvidia/NvidiaGPU.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.Nvidia { @@ -115,7 +116,10 @@ } public override Identifier Identifier { - get { return new Identifier("nvidiagpu", adapterIndex.ToString()); } + get { + return new Identifier("nvidiagpu", + adapterIndex.ToString(CultureInfo.InvariantCulture)); + } } public override HardwareType HardwareType { @@ -136,12 +140,12 @@ } private uint[] GetClocks() { - NvClocks clocks = new NvClocks(); - clocks.Version = NVAPI.GPU_CLOCKS_VER; - clocks.Clock = new uint[NVAPI.MAX_CLOCKS_PER_GPU]; + NvClocks allClocks = new NvClocks(); + allClocks.Version = NVAPI.GPU_CLOCKS_VER; + allClocks.Clock = new uint[NVAPI.MAX_CLOCKS_PER_GPU]; if (NVAPI.NvAPI_GPU_GetAllClocks != null && - NVAPI.NvAPI_GPU_GetAllClocks(handle, ref clocks) == NvStatus.OK) { - return clocks.Clock; + NVAPI.NvAPI_GPU_GetAllClocks(handle, ref allClocks) == NvStatus.OK) { + return allClocks.Clock; } return null; } @@ -235,7 +239,7 @@ r.Append("Driver Version: "); r.Append(driverVersion.DriverVersion / 100); r.Append("."); - r.Append((driverVersion.DriverVersion % 100).ToString("00")); + r.Append((driverVersion.DriverVersion % 100).ToString("00", CultureInfo.InvariantCulture)); r.AppendLine(); r.Append("Driver Branch: "); r.AppendLine(driverVersion.BuildBranch); @@ -275,17 +279,17 @@ } if (NVAPI.NvAPI_GPU_GetAllClocks != null) { - NvClocks clocks = new NvClocks(); - clocks.Version = NVAPI.GPU_CLOCKS_VER; - clocks.Clock = new uint[NVAPI.MAX_CLOCKS_PER_GPU]; - NvStatus status = NVAPI.NvAPI_GPU_GetAllClocks(handle, ref clocks); + NvClocks allClocks = new NvClocks(); + allClocks.Version = NVAPI.GPU_CLOCKS_VER; + allClocks.Clock = new uint[NVAPI.MAX_CLOCKS_PER_GPU]; + NvStatus status = NVAPI.NvAPI_GPU_GetAllClocks(handle, ref allClocks); r.AppendLine("Clocks"); r.AppendLine(); if (status == NvStatus.OK) { - for (int i = 0; i < clocks.Clock.Length; i++) - if (clocks.Clock[i] > 0) { - r.AppendFormat(" Clock[{0}]: {1}{2}", i, clocks.Clock[i], + for (int i = 0; i < allClocks.Clock.Length; i++) + if (allClocks.Clock[i] > 0) { + r.AppendFormat(" Clock[{0}]: {1}{2}", i, allClocks.Clock[i], Environment.NewLine); } } else { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Nvidia/NvidiaGroup.cs --- a/Hardware/Nvidia/NvidiaGroup.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Nvidia/NvidiaGroup.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.Nvidia { @@ -104,7 +105,7 @@ } report.Append("Number of GPUs: "); - report.AppendLine(count.ToString()); + report.AppendLine(count.ToString(CultureInfo.InvariantCulture)); for (int i = 0; i < count; i++) { NvDisplayHandle displayHandle; diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Parameter.cs --- a/Hardware/Parameter.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Parameter.cs Thu Aug 12 20:53:27 2010 +0000 @@ -36,6 +36,7 @@ */ using System; +using System.Globalization; using System.Collections.Generic; namespace OpenHardwareMonitor.Hardware { @@ -75,9 +76,9 @@ this.isDefault = !settings.Contains(Identifier.ToString()); this.value = description.DefaultValue; if (!this.isDefault) { - if (!float.TryParse(settings.Get(Identifier.ToString(), "0"), - System.Globalization.NumberStyles.Float, - System.Globalization.CultureInfo.InvariantCulture, + if (!float.TryParse(settings.GetValue(Identifier.ToString(), "0"), + NumberStyles.Float, + CultureInfo.InvariantCulture, out this.value)) this.value = description.DefaultValue; } @@ -91,8 +92,8 @@ public Identifier Identifier { get { - return new Identifier(sensor.Identifier, "parameter", - Name.Replace(" ", "").ToLower()); + return new Identifier(sensor.Identifier, "parameter", + Name.Replace(" ", "").ToLowerInvariant()); } } @@ -107,8 +108,8 @@ set { this.isDefault = false; this.value = value; - this.settings.Set(Identifier.ToString(), value.ToString( - System.Globalization.CultureInfo.InvariantCulture.NumberFormat)); + this.settings.SetValue(Identifier.ToString(), value.ToString( + CultureInfo.InvariantCulture)); } } @@ -128,7 +129,8 @@ } public void Accept(IVisitor visitor) { - visitor.VisitParameter(this); + if (visitor != null) + visitor.VisitParameter(this); } public void Traverse(IVisitor visitor) { } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/Sensor.cs --- a/Hardware/Sensor.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/Sensor.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using OpenHardwareMonitor.Collections; namespace OpenHardwareMonitor.Hardware { @@ -88,7 +89,7 @@ this.settings = settings; this.defaultName = name; - this.name = settings.Get( + this.name = settings.GetValue( new Identifier(Identifier, "name").ToString(), name); } @@ -102,8 +103,9 @@ public Identifier Identifier { get { - return new Identifier(hardware.Identifier, - sensorType.ToString().ToLower(), index.ToString()); + return new Identifier(hardware.Identifier, + sensorType.ToString().ToLowerInvariant(), + index.ToString(CultureInfo.InvariantCulture)); } } @@ -116,7 +118,7 @@ name = value; else name = defaultName; - settings.Set(new Identifier(Identifier, "name").ToString(), name); + settings.SetValue(new Identifier(Identifier, "name").ToString(), name); } } @@ -175,7 +177,8 @@ } public void Accept(IVisitor visitor) { - visitor.VisitSensor(this); + if (visitor != null) + visitor.VisitSensor(this); } public void Traverse(IVisitor visitor) { diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/TBalancer/TBalancer.cs --- a/Hardware/TBalancer/TBalancer.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/TBalancer/TBalancer.cs Thu Aug 12 20:53:27 2010 +0000 @@ -38,6 +38,7 @@ using System; using System.Collections.Generic; using System.Configuration; +using System.Globalization; using System.Text; namespace OpenHardwareMonitor.Hardware.TBalancer { @@ -276,7 +277,10 @@ } public Identifier Identifier { - get { return new Identifier("bigng", this.portIndex.ToString()); } + get { + return new Identifier("bigng", + this.portIndex.ToString(CultureInfo.InvariantCulture)); + } } public IHardware[] SubHardware { @@ -292,7 +296,8 @@ r.AppendLine("T-Balancer bigNG"); r.AppendLine(); - r.Append("Port Index: "); r.AppendLine(portIndex.ToString()); + r.Append("Port Index: "); + r.AppendLine(portIndex.ToString(CultureInfo.InvariantCulture)); r.AppendLine(); r.AppendLine("Primary System Information Answer"); @@ -300,12 +305,14 @@ r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); r.AppendLine(); for (int i = 0; i <= 0x11; i++) { - r.Append(" "); r.Append((i << 4).ToString("X3")); r.Append(" "); + r.Append(" "); + r.Append((i << 4).ToString("X3", CultureInfo.InvariantCulture)); + r.Append(" "); for (int j = 0; j <= 0xF; j++) { int index = ((i << 4) | j); if (index < primaryData.Length) { r.Append(" "); - r.Append(primaryData[index].ToString("X2")); + r.Append(primaryData[index].ToString("X2", CultureInfo.InvariantCulture)); } } r.AppendLine(); @@ -318,12 +325,14 @@ r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"); r.AppendLine(); for (int i = 0; i <= 0x11; i++) { - r.Append(" "); r.Append((i << 4).ToString("X3")); r.Append(" "); + r.Append(" "); + r.Append((i << 4).ToString("X3", CultureInfo.InvariantCulture)); + r.Append(" "); for (int j = 0; j <= 0xF; j++) { int index = ((i << 4) | j); if (index < alternativeData.Length) { r.Append(" "); - r.Append(alternativeData[index].ToString("X2")); + r.Append(alternativeData[index].ToString("X2", CultureInfo.InvariantCulture)); } } r.AppendLine(); @@ -367,7 +376,8 @@ public event SensorEventHandler SensorRemoved; public void Accept(IVisitor visitor) { - visitor.VisitHardware(this); + if (visitor != null) + visitor.VisitHardware(this); } public void Traverse(IVisitor visitor) { } diff -r 813d8bc3192f -r fa9dfbfc4145 Hardware/TBalancer/TBalancerGroup.cs --- a/Hardware/TBalancer/TBalancerGroup.cs Sun Aug 08 13:57:26 2010 +0000 +++ b/Hardware/TBalancer/TBalancerGroup.cs Thu Aug 12 20:53:27 2010 +0000 @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.IO.Ports; using System.Text; @@ -62,7 +63,8 @@ FTD2XX.FT_GetDeviceInfoList(info, ref numDevices); for (int i = 0; i < numDevices; i++) { - report.Append("Device Index: "); report.AppendLine(i.ToString()); + report.Append("Device Index: "); + report.AppendLine(i.ToString(CultureInfo.InvariantCulture)); FT_HANDLE handle; FT_STATUS status; @@ -112,7 +114,8 @@ protocolVersion = data[274]; if (!isValid) { report.Append("Status: Wrong Protocol Version: 0x"); - report.AppendLine(protocolVersion.ToString("X")); + report.AppendLine( + protocolVersion.ToString("X", CultureInfo.InvariantCulture)); } } else { report.AppendLine("Status: Wrong Message Length: " + length); diff -r 813d8bc3192f -r fa9dfbfc4145 OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Sun Aug 08 13:57:26 2010 +0000 +++ b/OpenHardwareMonitor.csproj Thu Aug 12 20:53:27 2010 +0000 @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -15,6 +15,25 @@ Resources\icon.ico Resources\app.manifest OpenHardwareMonitor.Program + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true true @@ -25,6 +44,7 @@ prompt 4 false + AllRules.ruleset none @@ -34,17 +54,7 @@ prompt 4 false - - - bin\Merge\ - TRACE - true - AnyCPU - false - prompt - Module - none - 4 + AllRules.ruleset @@ -94,6 +104,7 @@ + @@ -169,6 +180,23 @@ OpenHardwareMonitorLib + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + diff -r 813d8bc3192f -r fa9dfbfc4145 OpenHardwareMonitor.sln --- a/OpenHardwareMonitor.sln Sun Aug 08 13:57:26 2010 +0000 +++ b/OpenHardwareMonitor.sln Thu Aug 12 20:53:27 2010 +0000 @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHardwareMonitorLib", "OpenHardwareMonitorLib.csproj", "{B0397530-545A-471D-BB74-027AE456DF1A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenHardwareMonitor", "OpenHardwareMonitor.csproj", "{F5E0C1F7-9E9B-46F2-AC88-8C9C1C923880}" diff -r 813d8bc3192f -r fa9dfbfc4145 OpenHardwareMonitorLib.csproj --- a/OpenHardwareMonitorLib.csproj Sun Aug 08 13:57:26 2010 +0000 +++ b/OpenHardwareMonitorLib.csproj Thu Aug 12 20:53:27 2010 +0000 @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -12,8 +12,25 @@ OpenHardwareMonitorLib v2.0 512 - - + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true true @@ -23,6 +40,7 @@ TRACE;DEBUG prompt 4 + AllRules.ruleset none @@ -31,6 +49,7 @@ TRACE prompt 4 + AllRules.ruleset @@ -83,12 +102,30 @@ - + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true +