Esempio n. 1
0
        public static string GetGpuName()
        {
            try
            {
                string gpuName = string.Empty;
                string query   = "SELECT * FROM Win32_DisplayConfiguration";

                using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
                {
                    foreach (ManagementObject mObject in searcher.Get())
                    {
                        gpuName += mObject["Description"].ToString() + "; ";
                    }
                }
                gpuName = FormatHelper.RemoveEnd(gpuName);

                return((!string.IsNullOrEmpty(gpuName)) ? gpuName : "N/A");
            }
            catch
            {
                return("Unknown");
            }
        }
Esempio n. 2
0
        public static string GetCpuName()
        {
            try
            {
                string cpuName = string.Empty;
                string query   = "SELECT * FROM Win32_Processor";

                using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
                {
                    foreach (ManagementObject mObject in searcher.Get())
                    {
                        cpuName += mObject["Name"].ToString() + "; ";
                    }
                }
                cpuName = FormatHelper.RemoveEnd(cpuName);

                return((!string.IsNullOrEmpty(cpuName)) ? cpuName : "N/A");
            }
            catch
            {
            }

            return("Unknown");
        }