author | moel.mich |
Tue, 18 May 2010 19:16:55 +0000 | |
changeset 121 | f7e492b43690 |
parent 109 | 70d0c3102424 |
child 126 | 2354fdb91ac4 |
permissions | -rw-r--r-- |
moel@64 | 1 |
/* |
moel@64 | 2 |
|
moel@64 | 3 |
Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
moel@64 | 4 |
|
moel@64 | 5 |
The contents of this file are subject to the Mozilla Public License Version |
moel@64 | 6 |
1.1 (the "License"); you may not use this file except in compliance with |
moel@64 | 7 |
the License. You may obtain a copy of the License at |
moel@64 | 8 |
|
moel@64 | 9 |
http://www.mozilla.org/MPL/ |
moel@64 | 10 |
|
moel@64 | 11 |
Software distributed under the License is distributed on an "AS IS" basis, |
moel@64 | 12 |
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
moel@64 | 13 |
for the specific language governing rights and limitations under the License. |
moel@64 | 14 |
|
moel@64 | 15 |
The Original Code is the Open Hardware Monitor code. |
moel@64 | 16 |
|
moel@64 | 17 |
The Initial Developer of the Original Code is |
moel@64 | 18 |
Michael Möller <m.moeller@gmx.ch>. |
moel@64 | 19 |
Portions created by the Initial Developer are Copyright (C) 2009-2010 |
moel@64 | 20 |
the Initial Developer. All Rights Reserved. |
moel@64 | 21 |
|
moel@64 | 22 |
Contributor(s): |
moel@64 | 23 |
|
moel@64 | 24 |
Alternatively, the contents of this file may be used under the terms of |
moel@64 | 25 |
either the GNU General Public License Version 2 or later (the "GPL"), or |
moel@64 | 26 |
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
moel@64 | 27 |
in which case the provisions of the GPL or the LGPL are applicable instead |
moel@64 | 28 |
of those above. If you wish to allow use of your version of this file only |
moel@64 | 29 |
under the terms of either the GPL or the LGPL, and not to allow others to |
moel@64 | 30 |
use your version of this file under the terms of the MPL, indicate your |
moel@64 | 31 |
decision by deleting the provisions above and replace them with the notice |
moel@64 | 32 |
and other provisions required by the GPL or the LGPL. If you do not delete |
moel@64 | 33 |
the provisions above, a recipient may use your version of this file under |
moel@64 | 34 |
the terms of any one of the MPL, the GPL or the LGPL. |
moel@64 | 35 |
|
moel@64 | 36 |
*/ |
moel@64 | 37 |
|
moel@64 | 38 |
using System; |
moel@64 | 39 |
using System.Collections.Generic; |
moel@64 | 40 |
using System.Drawing; |
moel@64 | 41 |
using System.Text; |
moel@64 | 42 |
using OpenHardwareMonitor.Hardware.LPC; |
moel@64 | 43 |
|
moel@64 | 44 |
namespace OpenHardwareMonitor.Hardware.Mainboard { |
moel@64 | 45 |
public class Mainboard : IHardware { |
moel@64 | 46 |
private SMBIOS smbios; |
moel@64 | 47 |
private string name; |
moel@64 | 48 |
private Image icon; |
moel@64 | 49 |
|
moel@110 | 50 |
private LPCIO lpcGroup; |
moel@64 | 51 |
|
moel@64 | 52 |
public Mainboard() { |
moel@64 | 53 |
this.smbios = new SMBIOS(); |
moel@76 | 54 |
|
moel@76 | 55 |
if (smbios.Board != null) { |
moel@76 | 56 |
if (smbios.Board.ProductName != null |
moel@76 | 57 |
&& smbios.Board.ProductName != "") { |
moel@76 | 58 |
if (smbios.Board.Manufacturer == Manufacturer.Unkown) |
moel@76 | 59 |
this.name = smbios.Board.ProductName; |
moel@76 | 60 |
else |
moel@76 | 61 |
this.name = smbios.Board.Manufacturer + " " + |
moel@76 | 62 |
smbios.Board.ProductName; |
moel@76 | 63 |
} else { |
moel@76 | 64 |
this.name = smbios.Board.Manufacturer.ToString(); |
moel@76 | 65 |
} |
moel@64 | 66 |
} else { |
moel@76 | 67 |
this.name = Manufacturer.Unkown.ToString(); |
moel@64 | 68 |
} |
moel@76 | 69 |
|
moel@64 | 70 |
this.icon = Utilities.EmbeddedResources.GetImage("mainboard.png"); |
moel@110 | 71 |
this.lpcGroup = new LPCIO(); |
moel@64 | 72 |
} |
moel@64 | 73 |
|
moel@64 | 74 |
public string Name { |
moel@64 | 75 |
get { return name; } |
moel@64 | 76 |
} |
moel@64 | 77 |
|
moel@109 | 78 |
public Identifier Identifier { |
moel@109 | 79 |
get { return new Identifier("mainboard"); } |
moel@64 | 80 |
} |
moel@64 | 81 |
|
moel@64 | 82 |
public Image Icon { |
moel@64 | 83 |
get { return icon; } |
moel@64 | 84 |
} |
moel@64 | 85 |
|
moel@64 | 86 |
public string GetReport() { |
moel@64 | 87 |
StringBuilder r = new StringBuilder(); |
moel@64 | 88 |
|
moel@64 | 89 |
r.AppendLine("Mainboard"); |
moel@64 | 90 |
r.AppendLine(); |
moel@64 | 91 |
r.Append(smbios.GetReport()); |
moel@64 | 92 |
|
moel@67 | 93 |
r.Append(lpcGroup.GetReport()); |
moel@67 | 94 |
|
moel@64 | 95 |
return r.ToString(); |
moel@64 | 96 |
} |
moel@64 | 97 |
|
moel@64 | 98 |
public void Update() { } |
moel@64 | 99 |
|
moel@110 | 100 |
public void Close() { } |
moel@64 | 101 |
|
moel@64 | 102 |
public IHardware[] SubHardware { |
moel@64 | 103 |
get { return lpcGroup.Hardware; } |
moel@64 | 104 |
} |
moel@64 | 105 |
|
moel@64 | 106 |
public ISensor[] Sensors { |
moel@64 | 107 |
get { return new ISensor[0]; } |
moel@64 | 108 |
} |
moel@64 | 109 |
|
moel@64 | 110 |
#pragma warning disable 67 |
moel@64 | 111 |
public event SensorEventHandler SensorAdded; |
moel@64 | 112 |
public event SensorEventHandler SensorRemoved; |
moel@64 | 113 |
#pragma warning restore 67 |
moel@110 | 114 |
|
moel@110 | 115 |
public void Accept(IVisitor visitor) { |
moel@110 | 116 |
visitor.VisitHardware(this); |
moel@110 | 117 |
} |
moel@110 | 118 |
|
moel@110 | 119 |
public void Traverse(IVisitor visitor) { |
moel@110 | 120 |
foreach (IHardware hardware in lpcGroup.Hardware) |
moel@110 | 121 |
hardware.Accept(visitor); |
moel@110 | 122 |
} |
moel@64 | 123 |
} |
moel@64 | 124 |
} |