Changed the project files to Visual Studio 2010. Fixed some Code Analysis warnings.

This commit is contained in:
Michael Möller
2010-08-12 20:53:27 +00:00
parent a2650ba983
commit 2ec18bf862
37 changed files with 401 additions and 179 deletions
+6 -2
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.ATI {
}
public override Identifier Identifier {
get { return new Identifier("atigpu", adapterIndex.ToString()); }
get {
return new Identifier("atigpu",
adapterIndex.ToString(CultureInfo.InvariantCulture));
}
}
public override HardwareType HardwareType {
+16 -10
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.ATI {
@@ -55,7 +56,7 @@ namespace OpenHardwareMonitor.Hardware.ATI {
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 @@ namespace OpenHardwareMonitor.Hardware.ATI {
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 @@ namespace OpenHardwareMonitor.Hardware.ATI {
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 ||
+6 -2
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.CPU {
}
public override Identifier Identifier {
get { return new Identifier("amdcpu", processorIndex.ToString()); }
get {
return new Identifier("amdcpu",
processorIndex.ToString(CultureInfo.InvariantCulture));
}
}
public override HardwareType HardwareType {
+6 -2
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.CPU {
}
public override Identifier Identifier {
get { return new Identifier("amdcpu", processorIndex.ToString()); }
get {
return new Identifier("amdcpu",
processorIndex.ToString(CultureInfo.InvariantCulture));
}
}
public override HardwareType HardwareType {
+11 -7
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Diagnostics;
using System.Text;
@@ -153,10 +154,10 @@ namespace OpenHardwareMonitor.Hardware.CPU {
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 @@ namespace OpenHardwareMonitor.Hardware.CPU {
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");
+9 -9
View File
@@ -127,10 +127,10 @@ namespace OpenHardwareMonitor.Hardware.CPU {
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 @@ namespace OpenHardwareMonitor.Hardware.CPU {
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;
}
}
+8 -5
View File
@@ -45,7 +45,7 @@ using System.Threading;
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 @@ namespace OpenHardwareMonitor.Hardware.CPU {
}
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 @@ namespace OpenHardwareMonitor.Hardware.CPU {
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();
}
}
+5 -4
View File
@@ -196,7 +196,7 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
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;
}
+7 -2
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.HDD {
}
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 @@ namespace OpenHardwareMonitor.Hardware.HDD {
#pragma warning restore 67
public void Accept(IVisitor visitor) {
visitor.VisitHardware(this);
if (visitor != null)
visitor.VisitHardware(this);
}
public void Traverse(IVisitor visitor) { }
+2 -1
View File
@@ -80,7 +80,8 @@ namespace OpenHardwareMonitor.Hardware {
public abstract void Update();
public void Accept(IVisitor visitor) {
visitor.VisitHardware(this);
if (visitor != null)
visitor.VisitHardware(this);
}
public void Traverse(IVisitor visitor) {
+2 -2
View File
@@ -43,9 +43,9 @@ namespace OpenHardwareMonitor.Hardware {
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);
}
+8 -3
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.LPC {
@@ -84,7 +85,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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();
}
+9 -4
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.LPC {
@@ -114,8 +115,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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("??");
}
+6 -3
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace OpenHardwareMonitor.Hardware.LPC {
@@ -151,7 +152,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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;
}
+11 -9
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Threading;
@@ -238,7 +239,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 {
+15 -7
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.LPC {
@@ -291,8 +292,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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 @@ namespace OpenHardwareMonitor.Hardware.LPC {
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();
}
+2 -1
View File
@@ -131,7 +131,8 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
#pragma warning restore 67
public void Accept(IVisitor visitor) {
visitor.VisitHardware(this);
if (visitor != null)
visitor.VisitHardware(this);
}
public void Traverse(IVisitor visitor) {
+5 -1
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
}
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 {
+18 -14
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.Nvidia {
@@ -115,7 +116,10 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
}
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 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
}
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 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
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 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
}
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 {
+2 -1
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.Nvidia {
@@ -104,7 +105,7 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
}
report.Append("Number of GPUs: ");
report.AppendLine(count.ToString());
report.AppendLine(count.ToString(CultureInfo.InvariantCulture));
for (int i = 0; i < count; i++) {
NvDisplayHandle displayHandle;
+10 -8
View File
@@ -36,6 +36,7 @@
*/
using System;
using System.Globalization;
using System.Collections.Generic;
namespace OpenHardwareMonitor.Hardware {
@@ -75,9 +76,9 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
}
public void Accept(IVisitor visitor) {
visitor.VisitParameter(this);
if (visitor != null)
visitor.VisitParameter(this);
}
public void Traverse(IVisitor visitor) { }
+8 -5
View File
@@ -37,6 +37,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using OpenHardwareMonitor.Collections;
namespace OpenHardwareMonitor.Hardware {
@@ -88,7 +89,7 @@ namespace OpenHardwareMonitor.Hardware {
this.settings = settings;
this.defaultName = name;
this.name = settings.Get(
this.name = settings.GetValue(
new Identifier(Identifier, "name").ToString(), name);
}
@@ -102,8 +103,9 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
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 @@ namespace OpenHardwareMonitor.Hardware {
}
public void Accept(IVisitor visitor) {
visitor.VisitSensor(this);
if (visitor != null)
visitor.VisitSensor(this);
}
public void Traverse(IVisitor visitor) {
+17 -7
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
}
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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
public event SensorEventHandler SensorRemoved;
public void Accept(IVisitor visitor) {
visitor.VisitHardware(this);
if (visitor != null)
visitor.VisitHardware(this);
}
public void Traverse(IVisitor visitor) { }
+5 -2
View File
@@ -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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
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 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
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);