Hardware/RAM/RAMGroup.cs
author moel.mich
Sun, 23 Sep 2012 18:37:43 +0000
changeset 380 573f1fff48b2
parent 370 8e4dedc41924
child 401 c37f2b5ee55b
permissions -rw-r--r--
Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
moel@370
     1
/*
moel@370
     2
 
moel@370
     3
  This Source Code Form is subject to the terms of the Mozilla Public
moel@370
     4
  License, v. 2.0. If a copy of the MPL was not distributed with this
moel@370
     5
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@370
     6
 
moel@370
     7
  Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@370
     8
	
moel@370
     9
*/
moel@370
    10
moel@372
    11
using System;
moel@372
    12
moel@370
    13
namespace OpenHardwareMonitor.Hardware.RAM {
moel@370
    14
  internal class RAMGroup : IGroup {
moel@370
    15
moel@370
    16
    private IHardware[] hardware;
moel@370
    17
moel@370
    18
    public RAMGroup(SMBIOS smbios, ISettings settings) {
moel@372
    19
moel@372
    20
      // No implementation for RAM on Unix systems
moel@372
    21
      int p = (int)Environment.OSVersion.Platform;
moel@372
    22
      if ((p == 4) || (p == 128)) {
moel@372
    23
        hardware = new IHardware[0];
moel@372
    24
        return;
moel@372
    25
      }
moel@372
    26
moel@370
    27
      string name;
moel@370
    28
      if (smbios.MemoryDevices.Length > 0) {
moel@370
    29
        name = smbios.MemoryDevices[0].ManufacturerName + " " + 
moel@370
    30
          smbios.MemoryDevices[0].PartNumber;
moel@370
    31
      } else {
moel@370
    32
        name = "Generic Memory";
moel@370
    33
      }
moel@370
    34
moel@370
    35
      hardware = new IHardware[] { new GenericRAM(name, settings) };
moel@370
    36
    }
moel@370
    37
moel@370
    38
    public string GetReport() {
moel@370
    39
      return null;
moel@370
    40
    }
moel@370
    41
moel@370
    42
    public IHardware[] Hardware {
moel@370
    43
      get {
moel@370
    44
        return hardware;
moel@370
    45
      }
moel@370
    46
    }
moel@370
    47
moel@370
    48
    public void Close() {
moel@370
    49
moel@370
    50
    }
moel@370
    51
  }
moel@370
    52
}