1.1 --- a/Hardware/Nvidia/NvidiaGPU.cs Sat Apr 23 14:18:02 2011 +0000
1.2 +++ b/Hardware/Nvidia/NvidiaGPU.cs Sat Apr 30 16:03:58 2011 +0000
1.3 @@ -16,7 +16,7 @@
1.4
1.5 The Initial Developer of the Original Code is
1.6 Michael Möller <m.moeller@gmx.ch>.
1.7 - Portions created by the Initial Developer are Copyright (C) 2009-2010
1.8 + Portions created by the Initial Developer are Copyright (C) 2009-2011
1.9 the Initial Developer. All Rights Reserved.
1.10
1.11 Contributor(s):
1.12 @@ -42,7 +42,6 @@
1.13 namespace OpenHardwareMonitor.Hardware.Nvidia {
1.14 internal class NvidiaGPU : Hardware {
1.15
1.16 - private readonly string name;
1.17 private readonly int adapterIndex;
1.18 private readonly NvPhysicalGpuHandle handle;
1.19 private readonly NvDisplayHandle? displayHandle;
1.20 @@ -56,13 +55,9 @@
1.21
1.22 public NvidiaGPU(int adapterIndex, NvPhysicalGpuHandle handle,
1.23 NvDisplayHandle? displayHandle, ISettings settings)
1.24 + : base(GetName(handle), new Identifier("nvidiagpu",
1.25 + adapterIndex.ToString(CultureInfo.InvariantCulture)), settings)
1.26 {
1.27 - string gpuName;
1.28 - if (NVAPI.NvAPI_GPU_GetFullName(handle, out gpuName) == NvStatus.OK) {
1.29 - this.name = "NVIDIA " + gpuName.Trim();
1.30 - } else {
1.31 - this.name = "NVIDIA";
1.32 - }
1.33 this.adapterIndex = adapterIndex;
1.34 this.handle = handle;
1.35 this.displayHandle = displayHandle;
1.36 @@ -110,14 +105,12 @@
1.37 control = new Sensor("GPU Fan", 0, SensorType.Control, this, settings);
1.38 }
1.39
1.40 - public override string Name {
1.41 - get { return name; }
1.42 - }
1.43 -
1.44 - public override Identifier Identifier {
1.45 - get {
1.46 - return new Identifier("nvidiagpu",
1.47 - adapterIndex.ToString(CultureInfo.InvariantCulture));
1.48 + private static string GetName(NvPhysicalGpuHandle handle) {
1.49 + string gpuName;
1.50 + if (NVAPI.NvAPI_GPU_GetFullName(handle, out gpuName) == NvStatus.OK) {
1.51 + return "NVIDIA " + gpuName.Trim();
1.52 + } else {
1.53 + return "NVIDIA";
1.54 }
1.55 }
1.56