Esempio n. 1
0
        public static MotherboardInfo ReadMotherboardInfo()
        {
            MotherboardInfo mb = new MotherboardInfo();

            try
            {
                ManagementObjectSearcher    searcher = new ManagementObjectSearcher("SELECT Name, Vendor FROM Win32_ComputerSystemProduct");
                Dictionary <string, string> data     = new Dictionary <string, string>();

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    if (queryObj["Name"] != null)
                    {
                        mb.Name = queryObj["Name"] as string;
                    }

                    if (queryObj["Vendor"] != null)
                    {
                        mb.Vendor = queryObj["Vendor"] as string;
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                mb.Name = "Error getting Motherboard info: " + e.Message;
            }
            finally
            { }

            return(mb);
        }
Esempio n. 2
0
        public static MotherboardInfo ReadMotherboardInfo()
        {
            MotherboardInfo mb = new MotherboardInfo();

            try
            {
                ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Name, Vendor FROM Win32_ComputerSystemProduct");
                Dictionary<string, string> data = new Dictionary<string, string>();

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    if (queryObj["Name"] != null)
                    {
                        mb.Name = queryObj["Name"] as string;
                    }

                    if (queryObj["Vendor"] != null)
                    {
                        mb.Vendor = queryObj["Vendor"] as string;
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                mb.Name = "Error getting Motherboard info: " + e.Message;
            }
            finally
            { }

            return mb;
        }