Hardware/Mainboard/Mainboard.cs
changeset 370 8e4dedc41924
parent 344 3145aadca3d2
     1.1 --- a/Hardware/Mainboard/Mainboard.cs	Sun Jul 22 18:07:11 2012 +0000
     1.2 +++ b/Hardware/Mainboard/Mainboard.cs	Mon Jul 23 21:54:35 2012 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4    License, v. 2.0. If a copy of the MPL was not distributed with this
     1.5    file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.6   
     1.7 -  Copyright (C) 2009-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
     1.8 +  Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     1.9  	
    1.10  */
    1.11  
    1.12 @@ -22,19 +22,25 @@
    1.13      private readonly LMSensors lmSensors;
    1.14      private readonly Hardware[] superIOHardware;
    1.15  
    1.16 -    public Mainboard(ISettings settings) {
    1.17 +    public Mainboard(SMBIOS smbios, ISettings settings) {
    1.18        this.settings = settings;
    1.19 -      this.smbios = new SMBIOS();
    1.20 -     
    1.21 +      this.smbios = smbios;
    1.22 +
    1.23 +      Manufacturer manufacturer = smbios.Board == null ? Manufacturer.Unknown :
    1.24 +        Identification.GetManufacturer(smbios.Board.ManufacturerName);
    1.25 +
    1.26 +      Model model = smbios.Board == null ? Model.Unknown : 
    1.27 +        Identification.GetModel(smbios.Board.ProductName);
    1.28 +
    1.29        if (smbios.Board != null) {
    1.30          if (!string.IsNullOrEmpty(smbios.Board.ProductName)) {
    1.31 -          if (smbios.Board.Manufacturer == Manufacturer.Unknown)
    1.32 +          if (manufacturer == Manufacturer.Unknown)
    1.33              this.name = smbios.Board.ProductName;
    1.34            else
    1.35 -            this.name = smbios.Board.Manufacturer + " " +
    1.36 +            this.name = manufacturer + " " +
    1.37                smbios.Board.ProductName;
    1.38          } else {
    1.39 -          this.name = smbios.Board.Manufacturer.ToString();
    1.40 +          this.name = manufacturer.ToString();
    1.41          }
    1.42        } else {
    1.43          this.name = Manufacturer.Unknown.ToString();
    1.44 @@ -55,10 +61,8 @@
    1.45        
    1.46        superIOHardware = new Hardware[superIO.Length];
    1.47        for (int i = 0; i < superIO.Length; i++)
    1.48 -        superIOHardware[i] = new SuperIOHardware(this, superIO[i], 
    1.49 -          smbios.Board != null ? smbios.Board.Manufacturer : 
    1.50 -          Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model :
    1.51 -          Model.Unknown, settings);
    1.52 +        superIOHardware[i] = new SuperIOHardware(this, superIO[i],
    1.53 +          manufacturer, model, settings);
    1.54      }
    1.55  
    1.56      public string Name {