Hardware/RAM/RAMGroup.cs
author moel.mich
Sun, 09 Jun 2013 17:50:45 +0000
changeset 401 c37f2b5ee55b
parent 372 2de3a3e5f0b5
child 410 3e69541ad89a
permissions -rw-r--r--
Fixed an issue in the ram group implementation (sensor values did not get stored to the settings instance).
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@401
     7
  Copyright (C) 2012-2013 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@401
    16
    private Hardware[] 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@401
    23
        hardware = new Hardware[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@401
    35
      hardware = new Hardware[] { 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@401
    49
      foreach (Hardware ram in hardware)
moel@401
    50
        ram.Close();
moel@370
    51
    }
moel@370
    52
  }
moel@370
    53
}