Esempio n. 1
0
        /// <summary>
        /// Creates motherboard instance by retrieving information from <see cref="LibreHardwareMonitor.Hardware.SMBios"/> and creates a new <see cref="SubHardware"/> based on data from <see cref="LpcIO"/> and <see cref="EmbeddedController"/>.
        /// </summary>
        /// <param name="smBios"><see cref="LibreHardwareMonitor.Hardware.SMBios"/> table containing motherboard data.</param>
        /// <param name="settings">Additional settings passed by <see cref="IComputer"/>.</param>
        public Motherboard(SMBios smBios, ISettings settings)
        {
            IReadOnlyList <ISuperIO> superIO;

            _settings = settings;
            SMBios    = smBios;

            Manufacturer manufacturer = smBios.Board == null ? Manufacturer.Unknown : Identification.GetManufacturer(smBios.Board.ManufacturerName);
            Model        model        = smBios.Board == null ? Model.Unknown : Identification.GetModel(smBios.Board.ProductName);

            if (smBios.Board != null)
            {
                if (!string.IsNullOrEmpty(smBios.Board.ProductName))
                {
                    if (manufacturer == Manufacturer.Unknown)
                    {
                        _name = smBios.Board.ProductName;
                    }
                    else
                    {
                        _name = manufacturer + " " + smBios.Board.ProductName;
                    }
                }
                else
                {
                    _name = manufacturer.ToString();
                }
            }
            else
            {
                _name = Manufacturer.Unknown.ToString();
            }

            _customName = settings.GetValue(new Identifier(Identifier, "name").ToString(), _name);

            if (OperatingSystem.IsUnix)
            {
                _lmSensors = new LMSensors();
                superIO    = _lmSensors.SuperIO;
            }
            else
            {
                _lpcIO  = new LpcIO();
                superIO = _lpcIO.SuperIO;
            }

            EmbeddedController embeddedController = EmbeddedController.Create(model, settings);

            SubHardware = new IHardware[superIO.Count + (embeddedController != null ? 1 : 0)];
            for (int i = 0; i < superIO.Count; i++)
            {
                SubHardware[i] = new SuperIOHardware(this, superIO[i], manufacturer, model, settings);
            }

            if (embeddedController != null)
            {
                SubHardware[superIO.Count] = embeddedController;
            }
        }
Esempio n. 2
0
 /// <summary>
 ///     Creates and initializes a new MachineInformation object
 /// </summary>
 public MachineInformation()
 {
     Cpu       = new CPU();
     RAMSticks = new List <RAM>();
     SmBios    = new SMBios();
     Platform  = Platforms.Unknown;
     Disks     = new List <Disk>();
     Gpus      = new List <GPU>();
     Displays  = new List <Display>();
 }
        public string GetReport()
        {
            StringBuilder r = new StringBuilder();

            r.AppendLine("Motherboard");
            r.AppendLine();
            r.Append(SMBios.GetReport());

            if (_lpcIO != null)
            {
                r.Append(_lpcIO.GetReport());
            }

            return(r.ToString());
        }
Esempio n. 4
0
 public MotherboardGroup(SMBios smbios, ISettings settings)
 {
     _motherboards    = new Motherboard[1];
     _motherboards[0] = new Motherboard(smbios, settings);
 }
Esempio n. 5
0
 /// <summary>
 ///     Creates and initializes a new MachineInformation object
 /// </summary>
 internal MachineInformation()
 {
     Cpu      = new CPU();
     SmBios   = new SMBios();
     Platform = Platforms.Unknown;
 }