Hardware/RAM/RAMGroup.cs
author moel.mich
Tue, 30 Dec 2014 22:47:39 +0000
changeset 431 0e46e3ca812a
parent 401 c37f2b5ee55b
permissions -rw-r--r--
Fixed the following issue (present only on 32-bit systems):

Version: 0.7.0.0

System.NullReferenceException: Object reference not set to an instance of an object.
at OpenHardwareMonitor.GUI.MainForm.timer_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Common Language Runtime: 4.0.30319.18444
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
Process Type: 32-Bit
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@410
    27
      hardware = new Hardware[] { new GenericRAM("Generic Memory", settings) };
moel@370
    28
    }
moel@370
    29
moel@370
    30
    public string GetReport() {
moel@370
    31
      return null;
moel@370
    32
    }
moel@370
    33
moel@370
    34
    public IHardware[] Hardware {
moel@370
    35
      get {
moel@370
    36
        return hardware;
moel@370
    37
      }
moel@370
    38
    }
moel@370
    39
moel@370
    40
    public void Close() {
moel@401
    41
      foreach (Hardware ram in hardware)
moel@401
    42
        ram.Close();
moel@370
    43
    }
moel@370
    44
  }
moel@370
    45
}