Hardware/Mainboard/SMBIOS.cs
changeset 167 b7cc9d09aefe
parent 165 813d8bc3192f
child 168 7f90baeb96b0
     1.1 --- a/Hardware/Mainboard/SMBIOS.cs	Thu Aug 12 20:53:27 2010 +0000
     1.2 +++ b/Hardware/Mainboard/SMBIOS.cs	Sun Aug 15 14:46:58 2010 +0000
     1.3 @@ -51,7 +51,7 @@
     1.4      private BIOSInformation biosInformation = null;
     1.5      private BaseBoardInformation baseBoardInformation = null;
     1.6  
     1.7 -    private string ReadSysFS(string path) {
     1.8 +    private static string ReadSysFS(string path) {
     1.9        try {
    1.10          if (File.Exists(path)) {
    1.11            using (StreamReader reader = new StreamReader(path)) 
    1.12 @@ -85,9 +85,12 @@
    1.13  
    1.14          raw = null;
    1.15          try {
    1.16 -          ManagementObjectCollection collection = 
    1.17 +          ManagementObjectCollection collection;
    1.18 +          using (ManagementObjectSearcher searcher = 
    1.19              new ManagementObjectSearcher("root\\WMI", 
    1.20 -              "SELECT SMBiosData FROM MSSMBios_RawSMBiosTables").Get();
    1.21 +              "SELECT SMBiosData FROM MSSMBios_RawSMBiosTables")) {
    1.22 +            collection = searcher.Get();
    1.23 +          }
    1.24           
    1.25            foreach (ManagementObject mo in collection) {
    1.26              raw = (byte[])mo["SMBiosData"];
    1.27 @@ -144,17 +147,19 @@
    1.28      public string GetReport() {
    1.29        StringBuilder r = new StringBuilder();
    1.30  
    1.31 -      if (biosInformation != null) {
    1.32 -        r.Append("BIOS Vendor: "); r.AppendLine(biosInformation.Vendor);
    1.33 -        r.Append("BIOS Version: "); r.AppendLine(biosInformation.Version);
    1.34 +      if (BIOS != null) {
    1.35 +        r.Append("BIOS Vendor: "); r.AppendLine(BIOS.Vendor);
    1.36 +        r.Append("BIOS Version: "); r.AppendLine(BIOS.Version);
    1.37          r.AppendLine();
    1.38        }
    1.39  
    1.40 -      if (baseBoardInformation != null) {
    1.41 +      if (Board != null) {
    1.42          r.Append("Mainboard Manufacturer: ");
    1.43 -        r.AppendLine(baseBoardInformation.ManufacturerName);
    1.44 +        r.AppendLine(Board.ManufacturerName);
    1.45          r.Append("Mainboard Name: ");
    1.46 -        r.AppendLine(baseBoardInformation.ProductName);
    1.47 +        r.AppendLine(Board.ProductName);
    1.48 +        r.Append("Mainboard Version: ");
    1.49 +        r.AppendLine(Board.Version);
    1.50          r.AppendLine();
    1.51        }
    1.52  
    1.53 @@ -249,10 +254,10 @@
    1.54        private Manufacturer manufacturer;
    1.55        private Model model;
    1.56  
    1.57 -      private void SetManufacturerName(string manufacturerName) {
    1.58 -        this.manufacturerName = manufacturerName;
    1.59 +      private void SetManufacturerName(string name) {
    1.60 +        this.manufacturerName = name;
    1.61          
    1.62 -        switch (manufacturerName) {
    1.63 +        switch (name) {
    1.64            case "ASRock":
    1.65              manufacturer = Manufacturer.ASRock; break;
    1.66            case "ASUSTeK Computer INC.":
    1.67 @@ -286,10 +291,10 @@
    1.68          }
    1.69        }
    1.70        
    1.71 -      private void SetProductName(string productName) {
    1.72 -        this.productName = productName;
    1.73 +      private void SetProductName(string name) {
    1.74 +        this.productName = name;
    1.75          
    1.76 -        switch (productName) {
    1.77 +        switch (name) {
    1.78            case "880GMH/USB3":
    1.79              model = Model._880GMH_USB3; break;
    1.80            case "Crosshair III Formula":