Beispiel #1
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");
            this.lpcGroup = new LPCIO(
                smbios.Board != null ? smbios.Board.Manufacturer : Manufacturer.Unknown,
                smbios.Board != null ? smbios.Board.Model : Model.Unknown);
        }
        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);
            }
        }
        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);
            }
        }
        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);
            }
        }
        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();
            }
        }