Hardware/Mainboard/SMBIOS.cs
author moel.mich
Tue, 17 Jul 2012 16:12:07 +0000
changeset 365 a8a8ff22d959
parent 357 fb8dc26f65a4
permissions -rw-r--r--
Improved the data compression for storing the recorded sensor values in the config file.
moel@64
     1
/*
moel@64
     2
 
moel@344
     3
  This Source Code Form is subject to the terms of the Mozilla Public
moel@344
     4
  License, v. 2.0. If a copy of the MPL was not distributed with this
moel@344
     5
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@64
     6
 
moel@344
     7
  Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@344
     8
	
moel@64
     9
*/
moel@64
    10
moel@64
    11
using System;
moel@64
    12
using System.Collections.Generic;
moel@136
    13
using System.IO;
moel@64
    14
using System.Management;
moel@64
    15
using System.Text;
moel@64
    16
moel@64
    17
namespace OpenHardwareMonitor.Hardware.Mainboard {
moel@64
    18
moel@165
    19
  internal class SMBIOS {
moel@64
    20
moel@195
    21
    private readonly byte[] raw;
moel@195
    22
    private readonly Structure[] table;
moel@64
    23
moel@242
    24
    private readonly Version version;
moel@195
    25
    private readonly BIOSInformation biosInformation;
moel@320
    26
    private readonly SystemInformation systemInformation;
moel@195
    27
    private readonly BaseBoardInformation baseBoardInformation;
moel@64
    28
moel@167
    29
    private static string ReadSysFS(string path) {
moel@136
    30
      try {
moel@136
    31
        if (File.Exists(path)) {
moel@136
    32
          using (StreamReader reader = new StreamReader(path)) 
moel@136
    33
            return reader.ReadLine();
moel@136
    34
        } else {
moel@136
    35
          return null;
moel@136
    36
        }
moel@136
    37
      } catch {
moel@136
    38
        return null;
moel@136
    39
      }
moel@136
    40
    }
moel@136
    41
    
moel@64
    42
    public SMBIOS() {
moel@195
    43
      int p = (int)Environment.OSVersion.Platform;
moel@136
    44
      if ((p == 4) || (p == 128)) {
moel@136
    45
        this.raw = null;
moel@136
    46
        this.table = null;
moel@136
    47
        
moel@136
    48
        string boardVendor = ReadSysFS("/sys/class/dmi/id/board_vendor");
moel@136
    49
        string boardName = ReadSysFS("/sys/class/dmi/id/board_name");        
moel@136
    50
        string boardVersion = ReadSysFS("/sys/class/dmi/id/board_version");        
moel@136
    51
        this.baseBoardInformation = new BaseBoardInformation(
moel@136
    52
          boardVendor, boardName, boardVersion, null);
moel@320
    53
moel@320
    54
        string systemVendor = ReadSysFS("/sys/class/dmi/id/sys_vendor");
moel@320
    55
        string productName = ReadSysFS("/sys/class/dmi/id/product_name");
moel@320
    56
        string productVersion = ReadSysFS("/sys/class/dmi/id/product_version");    
moel@320
    57
        this.systemInformation = new SystemInformation(systemVendor, 
moel@320
    58
          productName, productVersion, null, null);
moel@320
    59
moel@136
    60
        string biosVendor = ReadSysFS("/sys/class/dmi/id/bios_vendor");
moel@136
    61
        string biosVersion = ReadSysFS("/sys/class/dmi/id/bios_version");
moel@136
    62
        this.biosInformation = new BIOSInformation(biosVendor, biosVersion);
moel@136
    63
        
moel@136
    64
      } else {              
moel@136
    65
        List<Structure> structureList = new List<Structure>();
moel@64
    66
moel@136
    67
        raw = null;
moel@242
    68
        byte majorVersion = 0;
moel@242
    69
        byte minorVersion = 0;
moel@136
    70
        try {
moel@167
    71
          ManagementObjectCollection collection;
moel@167
    72
          using (ManagementObjectSearcher searcher = 
moel@136
    73
            new ManagementObjectSearcher("root\\WMI", 
moel@242
    74
              "SELECT * FROM MSSMBios_RawSMBiosTables")) {
moel@167
    75
            collection = searcher.Get();
moel@167
    76
          }
moel@136
    77
         
moel@136
    78
          foreach (ManagementObject mo in collection) {
moel@136
    79
            raw = (byte[])mo["SMBiosData"];
moel@242
    80
            majorVersion = (byte)mo["SmbiosMajorVersion"];
moel@242
    81
            minorVersion = (byte)mo["SmbiosMinorVersion"];            
moel@89
    82
            break;
moel@136
    83
          }
moel@136
    84
        } catch { }
moel@242
    85
moel@242
    86
        if (majorVersion > 0 || minorVersion > 0)
moel@242
    87
          version = new Version(majorVersion, minorVersion);
moel@136
    88
  
moel@136
    89
        if (raw != null && raw.Length > 0) {
moel@136
    90
          int offset = 0;
moel@136
    91
          byte type = raw[offset];
moel@136
    92
          while (offset + 4 < raw.Length && type != 127) {
moel@136
    93
  
moel@136
    94
            type = raw[offset];
moel@136
    95
            int length = raw[offset + 1];
moel@136
    96
            ushort handle = (ushort)((raw[offset + 2] << 8) | raw[offset + 3]);
moel@136
    97
  
moel@136
    98
            if (offset + length > raw.Length)
moel@136
    99
              break;
moel@136
   100
            byte[] data = new byte[length];
moel@136
   101
            Array.Copy(raw, offset, data, 0, length);
moel@136
   102
            offset += length;
moel@136
   103
  
moel@136
   104
            List<string> stringsList = new List<string>();
moel@136
   105
            if (offset < raw.Length && raw[offset] == 0)
moel@136
   106
              offset++;
moel@136
   107
  
moel@89
   108
            while (offset < raw.Length && raw[offset] != 0) {
moel@136
   109
              StringBuilder sb = new StringBuilder();
moel@136
   110
              while (offset < raw.Length && raw[offset] != 0) {
moel@136
   111
                sb.Append((char)raw[offset]); offset++;
moel@136
   112
              }
moel@136
   113
              offset++;
moel@136
   114
              stringsList.Add(sb.ToString());
moel@64
   115
            }
moel@64
   116
            offset++;
moel@136
   117
            switch (type) {
moel@136
   118
              case 0x00:
moel@136
   119
                this.biosInformation = new BIOSInformation(
moel@136
   120
                  type, handle, data, stringsList.ToArray());
moel@136
   121
                structureList.Add(this.biosInformation); break;
moel@320
   122
              case 0x01:
moel@320
   123
                this.systemInformation = new SystemInformation(
moel@320
   124
                  type, handle, data, stringsList.ToArray());
moel@320
   125
                structureList.Add(this.systemInformation); break;
moel@136
   126
              case 0x02: this.baseBoardInformation = new BaseBoardInformation(
moel@136
   127
                  type, handle, data, stringsList.ToArray());
moel@136
   128
                structureList.Add(this.baseBoardInformation); break;
moel@136
   129
              default: structureList.Add(new Structure(
moel@136
   130
                type, handle, data, stringsList.ToArray())); break;
moel@136
   131
            }
moel@64
   132
          }
moel@64
   133
        }
moel@136
   134
              
moel@136
   135
        table = structureList.ToArray();
moel@89
   136
      }
moel@64
   137
    }
moel@64
   138
moel@64
   139
    public string GetReport() {
moel@136
   140
      StringBuilder r = new StringBuilder();
moel@64
   141
moel@242
   142
      if (version != null) {
moel@242
   143
        r.Append("SMBIOS Version: "); r.AppendLine(version.ToString(2));
moel@242
   144
        r.AppendLine();
moel@242
   145
      }
moel@242
   146
moel@167
   147
      if (BIOS != null) {
moel@167
   148
        r.Append("BIOS Vendor: "); r.AppendLine(BIOS.Vendor);
moel@167
   149
        r.Append("BIOS Version: "); r.AppendLine(BIOS.Version);
moel@64
   150
        r.AppendLine();
moel@64
   151
      }
moel@64
   152
moel@320
   153
      if (System != null) {
moel@320
   154
        r.Append("System Manufacturer: ");
moel@320
   155
        r.AppendLine(System.ManufacturerName);
moel@320
   156
        r.Append("System Name: ");
moel@320
   157
        r.AppendLine(System.ProductName);
moel@320
   158
        r.Append("System Version: ");
moel@320
   159
        r.AppendLine(System.Version);
moel@320
   160
        r.AppendLine();
moel@320
   161
      }
moel@320
   162
moel@167
   163
      if (Board != null) {
moel@136
   164
        r.Append("Mainboard Manufacturer: ");
moel@167
   165
        r.AppendLine(Board.ManufacturerName);
moel@136
   166
        r.Append("Mainboard Name: ");
moel@167
   167
        r.AppendLine(Board.ProductName);
moel@167
   168
        r.Append("Mainboard Version: ");
moel@167
   169
        r.AppendLine(Board.Version);
moel@64
   170
        r.AppendLine();
moel@64
   171
      }
moel@136
   172
moel@136
   173
      if (raw != null) {
moel@136
   174
        string base64 = Convert.ToBase64String(raw);
moel@136
   175
        r.AppendLine("SMBIOS Table");
moel@136
   176
        r.AppendLine();
moel@136
   177
moel@136
   178
        for (int i = 0; i < Math.Ceiling(base64.Length / 64.0); i++) {
moel@136
   179
          r.Append(" ");
moel@136
   180
          for (int j = 0; j < 0x40; j++) {
moel@136
   181
            int index = (i << 6) | j;
moel@136
   182
            if (index < base64.Length) {              
moel@136
   183
              r.Append(base64[index]);
moel@136
   184
            }
moel@136
   185
          }
moel@136
   186
          r.AppendLine();
moel@136
   187
        }
moel@136
   188
        r.AppendLine();
moel@136
   189
      }
moel@136
   190
moel@64
   191
      return r.ToString();
moel@64
   192
    }
moel@64
   193
moel@64
   194
    public BIOSInformation BIOS {
moel@64
   195
      get { return biosInformation; }
moel@64
   196
    }
moel@64
   197
moel@320
   198
    public SystemInformation System {
moel@320
   199
      get { return systemInformation; }
moel@320
   200
    }
moel@320
   201
moel@64
   202
    public BaseBoardInformation Board {
moel@64
   203
      get { return baseBoardInformation; }
moel@64
   204
    }
moel@64
   205
moel@64
   206
    public class Structure {
moel@195
   207
      private readonly byte type;
moel@195
   208
      private readonly ushort handle;
moel@64
   209
moel@195
   210
      private readonly byte[] data;
moel@195
   211
      private readonly string[] strings;
moel@64
   212
moel@64
   213
      protected string GetString(int offset) {
moel@64
   214
        if (offset < data.Length && data[offset] > 0 &&
moel@64
   215
         data[offset] <= strings.Length)
moel@64
   216
          return strings[data[offset] - 1];
moel@64
   217
        else
moel@64
   218
          return "";
moel@64
   219
      }
moel@64
   220
moel@64
   221
      public Structure(byte type, ushort handle, byte[] data, string[] strings) 
moel@64
   222
      {
moel@64
   223
        this.type = type;
moel@64
   224
        this.handle = handle;
moel@64
   225
        this.data = data;
moel@64
   226
        this.strings = strings;
moel@64
   227
      }
moel@64
   228
moel@64
   229
      public byte Type { get { return type; } }
moel@64
   230
moel@64
   231
      public ushort Handle { get { return handle; } }
moel@64
   232
    }
moel@136
   233
      
moel@64
   234
    public class BIOSInformation : Structure {
moel@64
   235
moel@195
   236
      private readonly string vendor;
moel@195
   237
      private readonly string version;
moel@136
   238
      
moel@136
   239
      public BIOSInformation(string vendor, string version) 
moel@136
   240
        : base (0x00, 0, null, null) 
moel@136
   241
      {
moel@136
   242
        this.vendor = vendor;
moel@136
   243
        this.version = version;
moel@136
   244
      }
moel@136
   245
      
moel@64
   246
      public BIOSInformation(byte type, ushort handle, byte[] data,
moel@64
   247
        string[] strings)
moel@136
   248
        : base(type, handle, data, strings) 
moel@136
   249
      {
moel@64
   250
        this.vendor = GetString(0x04);
moel@64
   251
        this.version = GetString(0x05);
moel@64
   252
      }
moel@64
   253
moel@64
   254
      public string Vendor { get { return vendor; } }
moel@64
   255
moel@64
   256
      public string Version { get { return version; } }
moel@64
   257
    }
moel@64
   258
moel@320
   259
    public class SystemInformation : Structure {
moel@320
   260
moel@320
   261
      private readonly string manufacturerName;
moel@320
   262
      private readonly string productName;
moel@320
   263
      private readonly string version;
moel@320
   264
      private readonly string serialNumber;
moel@320
   265
      private readonly string family;
moel@320
   266
moel@320
   267
      public SystemInformation(string manufacturerName, string productName, 
moel@320
   268
        string version, string serialNumber, string family) 
moel@320
   269
        : base (0x01, 0, null, null) 
moel@320
   270
      {
moel@320
   271
        this.manufacturerName = manufacturerName;
moel@320
   272
        this.productName = productName;
moel@320
   273
        this.version = version;
moel@320
   274
        this.serialNumber = serialNumber;
moel@320
   275
        this.family = family;
moel@320
   276
      }
moel@320
   277
moel@320
   278
      public SystemInformation(byte type, ushort handle, byte[] data,
moel@320
   279
        string[] strings)
moel@320
   280
        : base(type, handle, data, strings) 
moel@320
   281
      {
moel@320
   282
        this.manufacturerName = GetString(0x04);
moel@320
   283
        this.productName = GetString(0x05);
moel@320
   284
        this.version = GetString(0x06);
moel@320
   285
        this.serialNumber = GetString(0x07);
moel@320
   286
        this.family = GetString(0x1A);
moel@320
   287
      }
moel@320
   288
moel@320
   289
      public string ManufacturerName { get { return manufacturerName; } }
moel@320
   290
moel@320
   291
      public string ProductName { get { return productName; } }
moel@320
   292
moel@320
   293
      public string Version { get { return version; } }
moel@320
   294
moel@320
   295
      public string SerialNumber { get { return serialNumber; } }
moel@320
   296
moel@320
   297
      public string Family { get { return family; } }
moel@320
   298
moel@320
   299
    }
moel@320
   300
moel@64
   301
    public class BaseBoardInformation : Structure {
moel@64
   302
moel@195
   303
      private readonly string manufacturerName;
moel@195
   304
      private readonly string productName;
moel@195
   305
      private readonly string version;
moel@195
   306
      private readonly string serialNumber;
moel@195
   307
      private readonly Manufacturer manufacturer;
moel@195
   308
      private readonly Model model;
moel@64
   309
moel@195
   310
      private static Manufacturer GetManufacturer(string name) {               
moel@167
   311
        switch (name) {
moel@296
   312
          case "Alienware":
moel@296
   313
            return Manufacturer.Alienware;
moel@296
   314
          case "Apple Inc.":
moel@296
   315
            return Manufacturer.Apple;
moel@153
   316
          case "ASRock":
moel@195
   317
            return Manufacturer.ASRock;
moel@64
   318
          case "ASUSTeK Computer INC.":
moel@332
   319
          case "ASUSTeK COMPUTER INC.":
moel@195
   320
            return Manufacturer.ASUS;
moel@152
   321
          case "Dell Inc.":
moel@195
   322
            return Manufacturer.Dell;
moel@64
   323
          case "DFI":
moel@72
   324
          case "DFI Inc.":            
moel@195
   325
            return Manufacturer.DFI;
moel@177
   326
          case "ECS":
moel@195
   327
            return Manufacturer.ECS;
moel@64
   328
          case "EPoX COMPUTER CO., LTD":
moel@195
   329
            return Manufacturer.EPoX;
moel@132
   330
          case "EVGA":
moel@357
   331
            return Manufacturer.EVGA;
moel@152
   332
          case "First International Computer, Inc.":
moel@195
   333
            return Manufacturer.FIC;
moel@296
   334
          case "FUJITSU":
moel@296
   335
          case "FUJITSU SIEMENS":
moel@296
   336
            return Manufacturer.Fujitsu;
moel@64
   337
          case "Gigabyte Technology Co., Ltd.":
moel@357
   338
            return Manufacturer.Gigabyte;
moel@152
   339
          case "Hewlett-Packard":
moel@357
   340
            return Manufacturer.HP;
moel@72
   341
          case "IBM":
moel@357
   342
            return Manufacturer.IBM;
moel@296
   343
          case "Intel":
moel@296
   344
          case "Intel Corp.":
moel@296
   345
          case "Intel Corporation":
moel@296
   346
          case "INTEL Corporation":
moel@296
   347
            return Manufacturer.Intel;   
moel@296
   348
          case "Lenovo":
moel@296
   349
          case "LENOVO":
moel@296
   350
            return Manufacturer.Lenovo;
moel@296
   351
          case "Micro-Star International":
moel@64
   352
          case "MICRO-STAR INTERNATIONAL CO., LTD":
moel@72
   353
          case "MICRO-STAR INTERNATIONAL CO.,LTD":
moel@296
   354
          case "MSI":
moel@319
   355
            return Manufacturer.MSI;
moel@319
   356
          case "Shuttle":
moel@319
   357
            return Manufacturer.Shuttle;
moel@296
   358
          case "Supermicro":
moel@296
   359
            return Manufacturer.Supermicro;
moel@296
   360
          case "TOSHIBA":
moel@296
   361
            return Manufacturer.Toshiba;
moel@152
   362
          case "XFX":
moel@195
   363
            return  Manufacturer.XFX;
moel@152
   364
          case "To be filled by O.E.M.":
moel@195
   365
            return  Manufacturer.Unknown;
moel@64
   366
          default:
moel@195
   367
            return  Manufacturer.Unknown;
moel@126
   368
        }
moel@136
   369
      }
moel@195
   370
moel@195
   371
      private static Model GetModel(string name) {
moel@167
   372
        switch (name) {
moel@153
   373
          case "880GMH/USB3":
moel@195
   374
            return Model._880GMH_USB3;
moel@220
   375
          case "ASRock AOD790GX/128M":
moel@220
   376
            return Model.AOD790GX_128M;
moel@221
   377
          case "P55 Deluxe":
moel@221
   378
            return Model.P55_Deluxe;
moel@133
   379
          case "Crosshair III Formula":
moel@195
   380
            return Model.Crosshair_III_Formula;
moel@133
   381
          case "M2N-SLI DELUXE":
moel@195
   382
            return Model.M2N_SLI_DELUXE;
moel@144
   383
          case "M4A79XTD EVO":
moel@195
   384
            return Model.M4A79XTD_EVO;
moel@130
   385
          case "P5W DH Deluxe":
moel@195
   386
            return Model.P5W_DH_Deluxe;
moel@336
   387
          case "P6T":
moel@336
   388
            return Model.P6T;
moel@152
   389
          case "P6X58D-E":
moel@195
   390
            return Model.P6X58D_E;
moel@312
   391
          case "P8P67":
moel@312
   392
            return Model.P8P67;
moel@311
   393
          case "P8P67 EVO":
moel@311
   394
            return Model.P8P67_EVO;
moel@265
   395
          case "P8P67 PRO":
moel@265
   396
            return Model.P8P67_PRO;
moel@276
   397
          case "P8P67-M PRO":
moel@276
   398
            return Model.P8P67_M_PRO;
moel@359
   399
          case "P8Z77-V":
moel@359
   400
            return Model.P8Z77_V;
moel@332
   401
          case "P9X79":
moel@332
   402
            return Model.P9X79;
moel@174
   403
          case "Rampage Extreme":
moel@195
   404
            return Model.Rampage_Extreme;
moel@174
   405
          case "Rampage II GENE":
moel@195
   406
            return Model.Rampage_II_GENE;
moel@126
   407
          case "LP BI P45-T2RS Elite":
moel@195
   408
            return Model.LP_BI_P45_T2RS_Elite;
moel@126
   409
          case "LP DK P55-T3eH9":
moel@195
   410
            return Model.LP_DK_P55_T3eH9;
moel@177
   411
          case "A890GXM-A":
moel@195
   412
            return Model.A890GXM_A;
moel@132
   413
          case "X58 SLI Classified":
moel@195
   414
            return Model.X58_SLI_Classified;
moel@130
   415
          case "965P-S3":
moel@195
   416
            return Model._965P_S3;
moel@126
   417
          case "EP45-DS3R":
moel@195
   418
            return Model.EP45_DS3R;
moel@130
   419
          case "EP45-UD3R":
moel@195
   420
            return Model.EP45_UD3R;
moel@133
   421
          case "EX58-EXTREME":
moel@195
   422
            return Model.EX58_EXTREME;
moel@357
   423
          case "EX58-UD3R":
moel@357
   424
            return Model.EX58_UD3R;
moel@357
   425
          case "G41M-Combo":
moel@357
   426
            return Model.G41M_Combo;
moel@357
   427
          case "G41MT-S2":
moel@357
   428
            return Model.G41MT_S2;
moel@357
   429
          case "G41MT-S2P":
moel@357
   430
            return Model.G41MT_S2P;
moel@154
   431
          case "GA-MA770T-UD3":
moel@195
   432
            return Model.GA_MA770T_UD3;
moel@357
   433
          case "GA-MA770T-UD3P":
moel@357
   434
            return Model.GA_MA770T_UD3P;
moel@357
   435
          case "GA-MA785GM-US2H":
moel@357
   436
            return Model.GA_MA785GM_US2H;
moel@126
   437
          case "GA-MA785GMT-UD2H":
moel@195
   438
            return Model.GA_MA785GMT_UD2H;
moel@357
   439
          case "GA-MA78LM-S2H":
moel@357
   440
            return Model.GA_MA78LM_S2H;
moel@357
   441
          case "GA-MA790X-UD3P":
moel@357
   442
            return Model.GA_MA790X_UD3P;
moel@357
   443
          case "H55-USB3":
moel@357
   444
            return Model.H55_USB3;
moel@357
   445
          case "H55N-USB3":
moel@357
   446
            return Model.H55N_USB3;
moel@357
   447
          case "H61M-DS2 REV 1.2":
moel@357
   448
            return Model.H61M_DS2_REV_1_2;
moel@357
   449
          case "H61M-USB3-B3 REV 2.0":
moel@357
   450
            return Model.H61M_USB3_B3_REV_2_0;
moel@290
   451
          case "H67A-UD3H-B3":
moel@290
   452
            return Model.H67A_UD3H_B3;
moel@357
   453
          case "H67A-USB3-B3":
moel@357
   454
            return Model.H67A_USB3_B3;
moel@126
   455
          case "P35-DS3":
moel@195
   456
            return Model.P35_DS3;
moel@133
   457
          case "P35-DS3L":
moel@195
   458
            return Model.P35_DS3L;
moel@148
   459
          case "P55-UD4":
moel@195
   460
            return Model.P55_UD4;
moel@357
   461
          case "P55A-UD3":
moel@357
   462
            return Model.P55A_UD3;
moel@168
   463
          case "P55M-UD4":
moel@195
   464
            return Model.P55M_UD4;
moel@357
   465
          case "P67A-UD3-B3":
moel@357
   466
            return Model.P67A_UD3_B3;
moel@357
   467
          case "P67A-UD3R-B3":
moel@357
   468
            return Model.P67A_UD3R_B3;
moel@278
   469
          case "P67A-UD4-B3":
moel@278
   470
            return Model.P67A_UD4_B3;
moel@337
   471
          case "P8Z68-V PRO":
moel@337
   472
            return Model.P8Z68_V_PRO;
moel@130
   473
          case "X38-DS5":
moel@195
   474
            return Model.X38_DS5;
moel@138
   475
          case "X58A-UD3R":
moel@195
   476
            return Model.X58A_UD3R;
moel@357
   477
          case "Z68A-D3H-B3":
moel@357
   478
            return Model.Z68A_D3H_B3;
moel@357
   479
          case "Z68AP-D3":
moel@357
   480
            return Model.Z68AP_D3;
moel@357
   481
          case "Z68X-UD3H-B3":
moel@357
   482
            return Model.Z68X_UD3H_B3;
moel@305
   483
          case "Z68X-UD7-B3":
moel@305
   484
            return Model.Z68X_UD7_B3;
moel@320
   485
          case "FH67":
moel@359
   486
            return Model.FH67;		  
moel@296
   487
          case "Base Board Product Name":
moel@152
   488
          case "To be filled by O.E.M.":
moel@195
   489
            return Model.Unknown;
moel@126
   490
          default:
moel@195
   491
            return Model.Unknown;
moel@64
   492
        }
moel@64
   493
      }
moel@136
   494
      
moel@136
   495
      public BaseBoardInformation(string manufacturerName, string productName, 
moel@136
   496
        string version, string serialNumber) 
moel@136
   497
        : base(0x02, 0, null, null) 
moel@195
   498
      {
moel@195
   499
        this.manufacturerName = manufacturerName;
moel@195
   500
        this.manufacturer = GetManufacturer(manufacturerName);
moel@195
   501
        this.productName = productName;
moel@195
   502
        this.model = GetModel(productName);
moel@136
   503
        this.version = version;
moel@136
   504
        this.serialNumber = serialNumber;
moel@136
   505
      }
moel@136
   506
      
moel@136
   507
      public BaseBoardInformation(byte type, ushort handle, byte[] data,
moel@136
   508
        string[] strings)
moel@136
   509
        : base(type, handle, data, strings) {
moel@64
   510
moel@195
   511
        this.manufacturerName = GetString(0x04).Trim();
moel@195
   512
        this.manufacturer = GetManufacturer(this.manufacturerName);
moel@195
   513
        this.productName = GetString(0x05).Trim();
moel@195
   514
        this.model = GetModel(this.productName);
moel@136
   515
        this.version = GetString(0x06).Trim();
moel@136
   516
        this.serialNumber = GetString(0x07).Trim();               
moel@136
   517
      }
moel@136
   518
      
moel@64
   519
      public string ManufacturerName { get { return manufacturerName; } }
moel@64
   520
moel@64
   521
      public string ProductName { get { return productName; } }
moel@64
   522
moel@89
   523
      public string Version { get { return version; } }
moel@89
   524
moel@89
   525
      public string SerialNumber { get { return serialNumber; } }
moel@89
   526
moel@64
   527
      public Manufacturer Manufacturer { get { return manufacturer; } }
moel@89
   528
moel@126
   529
      public Model Model { get { return model; } }
moel@126
   530
moel@64
   531
    }
moel@64
   532
  }
moel@64
   533
}