public Mainboard(SMBIOS smbios, ISettings settings)
        {
            this.settings = settings;
            this.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)
                    {
                        this.name = smbios.Board.ProductName;
                    }
                    else
                    {
                        this.name = manufacturer + " " +
                                    smbios.Board.ProductName;
                    }
                }
                else
                {
                    this.name = manufacturer.ToString();
                }
            }
            else
            {
                this.name = Manufacturer.Unknown.ToString();
            }

            this.customName = settings.GetValue(
                new Identifier(Identifier, "name").ToString(), name);

            ISuperIO[] superIO;
            int        p = (int)Environment.OSVersion.Platform;

            if ((p == 4) || (p == 128))
            {
                this.lmSensors = new LMSensors();
                superIO        = lmSensors.SuperIO;
            }
            else
            {
                this.lpcio = new LPCIO();
                superIO    = lpcio.SuperIO;
            }

            superIOHardware = new Hardware[superIO.Length];
            for (int i = 0; i < superIO.Length; i++)
            {
                superIOHardware[i] = new SuperIOHardware(this, superIO[i],
                                                         manufacturer, model, settings);
            }
        }
Пример #2
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;
            }
        }
Пример #3
0
        public Mainboard()
        {
            this.smbios = new SMBIOS();

            if (smbios.Board != null)
            {
                if (smbios.Board.ProductName != null &&
                    smbios.Board.ProductName != "")
                {
                    if (smbios.Board.Manufacturer == Manufacturer.Unknown)
                    {
                        this.name = smbios.Board.ProductName;
                    }
                    else
                    {
                        this.name = smbios.Board.Manufacturer + " " +
                                    smbios.Board.ProductName;
                    }
                }
                else
                {
                    this.name = smbios.Board.Manufacturer.ToString();
                }
            }
            else
            {
                this.name = Manufacturer.Unknown.ToString();
            }

            this.icon = Utilities.EmbeddedResources.GetImage("mainboard.png");
            ISuperIO[] superIO;
            int        p = (int)System.Environment.OSVersion.Platform;

            if ((p == 4) || (p == 128))
            {
                this.lmSensors = new LMSensors();
                superIO        = lmSensors.SuperIO;
            }
            else
            {
                this.lpcio = new LPCIO();
                superIO    = lpcio.SuperIO;
            }

            superIOHardware = new IHardware[superIO.Length];
            for (int i = 0; i < superIO.Length; i++)
            {
                superIOHardware[i] = new SuperIOHardware(superIO[i],
                                                         smbios.Board != null ? smbios.Board.Manufacturer :
                                                         Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model :
                                                         Model.Unknown);
            }
        }
Пример #4
0
        public Mainboard(ISettings settings)
        {
            this.smbios = new SMBIOS();

            if (smbios.Board != null)
            {
                if (!string.IsNullOrEmpty(smbios.Board.ProductName))
                {
                    if (smbios.Board.Manufacturer == Manufacturer.Unknown)
                    {
                        this.name = smbios.Board.ProductName;
                    }
                    else
                    {
                        this.name = smbios.Board.Manufacturer + " " +
                                    smbios.Board.ProductName;
                    }
                }
                else
                {
                    this.name = smbios.Board.Manufacturer.ToString();
                }
            }
            else
            {
                this.name = Manufacturer.Unknown.ToString();
            }

            ISuperIO[] superIO;
            int        p = (int)Environment.OSVersion.Platform;

            if ((p == 4) || (p == 128))
            {
                this.lmSensors = new LMSensors();
                superIO        = lmSensors.SuperIO;
            }
            else
            {
                this.lpcio = new LPCIO();
                superIO    = lpcio.SuperIO;
            }

            superIOHardware = new IHardware[superIO.Length];
            for (int i = 0; i < superIO.Length; i++)
            {
                superIOHardware[i] = new SuperIOHardware(this, superIO[i],
                                                         smbios.Board != null ? smbios.Board.Manufacturer :
                                                         Manufacturer.Unknown, smbios.Board != null ? smbios.Board.Model :
                                                         Model.Unknown, settings);
            }
        }
Пример #5
0
        public Mainboard() : base("mainboard")
        {
            Smbios = new Smbios();

            Manufacturer = Smbios.Board == null
                ? Manufacturer.Unknown
                : GetManufacturer(Smbios.Board.ManufacturerName);

            Model = Smbios.Board == null ? Model.Unknown : GetModel(Smbios.Board.ProductName);

            if (Smbios.Board != null)
            {
                if (!string.IsNullOrEmpty(Smbios.Board.ProductName))
                {
                    Name = Manufacturer == Manufacturer.Unknown
                        ? Smbios.Board.ProductName
                        : $"{Manufacturer} {Smbios.Board.ProductName}";
                }
                else
                {
                    Name = Manufacturer.ToString();
                }
            }
            else
            {
                Name = Manufacturer.Unknown.ToString();
            }

            Identifier = $"mainboard/{Manufacturer}/{Model}";

            if (OperatingSystem.IsLinux)
            {
                LmSensors = new LMSensors();
            }
            else
            {
                Lpcio = new LPCIO();
            }
        }
Пример #6
0
        public Mainboard(SMBIOS smbios, ISettings settings)
        {
            this.settings = settings;
            this.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))
                {
                    this.model = smbios.Board.ProductName;

                    if (manufacturer == Manufacturer.Unknown)
                    {
                        this.manufacturer = String.Empty;
                    }
                    else
                    {
                        this.manufacturer = manufacturer.ToString();
                    }
                }
                else
                {
                    this.manufacturer = manufacturer.ToString();
                    this.model        = String.Empty;
                }
            }
            else
            {
                this.manufacturer = String.Empty;
                this.model        = String.Empty;
            }

            String name;

            if (this.manufacturer == String.Empty)
            {
                name = Manufacturer.Unknown.ToString();
            }
            else
            {
                name = this.manufacturer;
            }

            if (this.model != String.Empty)
            {
                name += " " + this.model;
            }

            this.name = name;

            this.customName = settings.GetValue(
                new Identifier(Identifier, "name").ToString(), name);

            ISuperIO[] superIO;
            int        p = (int)Environment.OSVersion.Platform;

            if ((p == 4) || (p == 128))
            {
                this.lmSensors = new LMSensors();
                superIO        = lmSensors.SuperIO;
            }
            else
            {
            }
        }