Esempio n. 1
0
 private void InitHardware()
 {
     computer            = new OpenHardwareMonitor.Hardware.Computer();
     computer.CPUEnabled = true;
     computer.Open();
     return;
 }
Esempio n. 2
0
        private void Thread_HardwareMonitor()
        {
            try
            {
                while (true)
                {
                    System.Threading.Thread.Sleep(500);

                    OpenHardwareMonitor.Hardware.Computer lComputerHardware = new OpenHardwareMonitor.Hardware.Computer();
                    lComputerHardware.MainboardEnabled     = false;
                    lComputerHardware.FanControllerEnabled = false;
                    lComputerHardware.CPUEnabled           = false;
                    lComputerHardware.GPUEnabled           = true;
                    lComputerHardware.RAMEnabled           = false;
                    lComputerHardware.HDDEnabled           = false;
                    lComputerHardware.Open();

                    this.UpdateSensor(lComputerHardware);

                    lComputerHardware.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message.ToString(), "Error : Thread_HardwareMonitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }
Esempio n. 3
0
        private void GatherOSInfo(Context context)
        {
            var ohw = new OpenHardwareMonitor.Hardware.Computer();

            ohw.CPUEnabled = ohw.GPUEnabled = ohw.HDDEnabled = ohw.MainboardEnabled = ohw.RAMEnabled = true;
            ohw.Open();
            context.Response.Content["info.system"] = new SystemInfo()
            {
                OS = Environment.OSVersion.VersionString,
                HW = ohw.Hardware.Select(x => new HardwareInfo()
                {
                    Type = x.HardwareType.ToString(),
                    Name = x.Name
                }).ToArray()
            };
        }
Esempio n. 4
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            Control.CheckForIllegalCrossThreadCalls = false;
            this.pal_Monitor.Controls.Clear();

            try
            {
                string ltype      = string.Empty;
                int    lGPU_Count = 0;

                OpenHardwareMonitor.Hardware.Computer lComputerHardware = new OpenHardwareMonitor.Hardware.Computer();
                lComputerHardware.MainboardEnabled     = false;
                lComputerHardware.FanControllerEnabled = false;
                lComputerHardware.CPUEnabled           = false;
                lComputerHardware.GPUEnabled           = true;
                lComputerHardware.RAMEnabled           = false;
                lComputerHardware.HDDEnabled           = false;
                lComputerHardware.Open();

                for (int bInxHardWare = 0; bInxHardWare < lComputerHardware.Hardware.Count(); bInxHardWare++)
                {
                    ltype = lComputerHardware.Hardware[bInxHardWare].HardwareType.ToString();

                    if ((!string.IsNullOrEmpty(ltype)) && (ltype.ToUpper().Substring(0, 3) == "GPU"))
                    {
                        lGPU_Count++;
                    }
                }

                this.ReSize_Monitor(lGPU_Count);
                this.BuildLabel(lGPU_Count);
                this.UpdateSensor(lComputerHardware);
                this.UpdateMinMax(0);

                lComputerHardware.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message.ToString(), "Error : FrmMain_Load", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }
Esempio n. 5
0
        private void UpdateSensor(OpenHardwareMonitor.Hardware.Computer pComputerHardware)
        {
            try
            {
                int lGPU_Index = 0;

                for (int bInxHardWare = 0; bInxHardWare < pComputerHardware.Hardware.Count(); bInxHardWare++)
                {
                    string lType = pComputerHardware.Hardware[bInxHardWare].HardwareType.ToString();

                    if ((!string.IsNullOrEmpty(lType)) && (lType.ToUpper().Substring(0, 3) == "GPU"))
                    {
                        this._lbl_Sensor[lGPU_Index, 0].Text = pComputerHardware.Hardware[bInxHardWare].Name.Replace("NVIDIA GeForce ", null);

                        for (int bInxSensor = 0; bInxSensor < pComputerHardware.Hardware[bInxHardWare].Sensors.Count(); bInxSensor++)
                        {
                            string bName       = pComputerHardware.Hardware[bInxHardWare].Sensors[bInxSensor].Name.ToUpper().Replace(" ", null);
                            string bValue      = pComputerHardware.Hardware[bInxHardWare].Sensors[bInxSensor].Value.ToString().ToUpper().Replace(" ", null);
                            string bSensorType = pComputerHardware.Hardware[bInxHardWare].Sensors[bInxSensor].SensorType.ToString().ToUpper().Replace(" ", null);

                            //this._str += "Name : " + bName + " | Value : " + bValue + " | SensorType : " + bSensorType + Environment.NewLine;

                            if ((bName == "GPUCORE") && (bSensorType == "TEMPERATURE"))
                            {
                                this._Sensor[0, lGPU_Index, 1] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 1], 100))
                                {
                                    this._Sensor[1, lGPU_Index, 1] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 1], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 1] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 1].Text = this._Sensor[this._Mode, lGPU_Index, 1] + " C";
                            }
                            else if ((bName == "GPUCORE") && (bSensorType == "CLOCK"))
                            {
                                this._Sensor[0, lGPU_Index, 2] = bValue;
                                if (_Util_Class.Str2Double(bValue) <= _Util_Class.Str2Double(this._Sensor[1, lGPU_Index, 2], 9999.0))
                                {
                                    this._Sensor[1, lGPU_Index, 2] = bValue;
                                }
                                if (_Util_Class.Str2Double(bValue) >= _Util_Class.Str2Double(this._Sensor[2, lGPU_Index, 2], 0.0))
                                {
                                    this._Sensor[2, lGPU_Index, 2] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 2].Text = Convert.ToDouble(this._Sensor[this._Mode, lGPU_Index, 2]).ToString("F2") + " Mhz";
                            }
                            else if ((bName == "GPUMEMORY") && (bSensorType == "CLOCK"))
                            {
                                this._Sensor[0, lGPU_Index, 3] = bValue;
                                if (_Util_Class.Str2Double(bValue) <= _Util_Class.Str2Double(this._Sensor[1, lGPU_Index, 3], 9999.0))
                                {
                                    this._Sensor[1, lGPU_Index, 3] = bValue;
                                }
                                if (_Util_Class.Str2Double(bValue) >= _Util_Class.Str2Double(this._Sensor[2, lGPU_Index, 3], 0.0))
                                {
                                    this._Sensor[2, lGPU_Index, 3] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 3].Text = Convert.ToDouble(this._Sensor[this._Mode, lGPU_Index, 3]).ToString("F2") + " Mhz";
                            }
                            else if ((bName == "GPUSHADER") && (bSensorType == "CLOCK"))
                            {
                                this._Sensor[0, lGPU_Index, 4] = bValue;
                                if (_Util_Class.Str2Double(bValue) <= _Util_Class.Str2Double(this._Sensor[1, lGPU_Index, 4], 9999.0))
                                {
                                    this._Sensor[1, lGPU_Index, 4] = bValue;
                                }
                                if (_Util_Class.Str2Double(bValue) >= _Util_Class.Str2Double(this._Sensor[2, lGPU_Index, 4], 0.0))
                                {
                                    this._Sensor[2, lGPU_Index, 4] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 4].Text = Convert.ToDouble(this._Sensor[this._Mode, lGPU_Index, 4]).ToString("F2") + " Mhz";
                            }
                            else if ((bName == "GPUCORE") && (bSensorType == "LOAD"))
                            {
                                this._Sensor[0, lGPU_Index, 5] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 5], 100))
                                {
                                    this._Sensor[1, lGPU_Index, 5] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 5], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 5] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 5].Text = this._Sensor[this._Mode, lGPU_Index, 5] + " %";
                            }
                            else if ((bName == "GPUMEMORYCONTROLLER") && (bSensorType == "LOAD"))
                            {
                                this._Sensor[0, lGPU_Index, 6] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 6], 100))
                                {
                                    this._Sensor[1, lGPU_Index, 6] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 6], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 6] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 6].Text = this._Sensor[this._Mode, lGPU_Index, 6] + " %";
                            }
                            else if ((bName == "GPUVIDEOENGINE") && (bSensorType == "LOAD"))
                            {
                                this._Sensor[0, lGPU_Index, 7] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 7], 100))
                                {
                                    this._Sensor[1, lGPU_Index, 7] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 7], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 7] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 7].Text = this._Sensor[this._Mode, lGPU_Index, 7] + " %";
                            }
                            else if ((bName == "GPUMEMORY") && (bSensorType == "LOAD"))
                            {
                                this._Sensor[0, lGPU_Index, 8] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 8], 100))
                                {
                                    this._Sensor[1, lGPU_Index, 8] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 8], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 8] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 8].Text = this._Sensor[this._Mode, lGPU_Index, 8] + " %";
                            }
                            else if ((bName == "GPU") && (bSensorType == "FAN"))
                            {
                                this._Sensor[0, lGPU_Index, 9] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 9], 10000))
                                {
                                    this._Sensor[1, lGPU_Index, 9] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 9], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 9] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 9].Text = this._Sensor[this._Mode, lGPU_Index, 9] + " RPM";
                            }
                            else if ((bName == "GPUFAN") && (bSensorType == "CONTROL"))
                            {
                                this._Sensor[0, lGPU_Index, 10] = bValue;
                                if (_Util_Class.Str2Int(bValue) <= _Util_Class.Str2Int(this._Sensor[1, lGPU_Index, 10], 100))
                                {
                                    this._Sensor[1, lGPU_Index, 10] = bValue;
                                }
                                if (_Util_Class.Str2Int(bValue) >= _Util_Class.Str2Int(this._Sensor[2, lGPU_Index, 10], 0))
                                {
                                    this._Sensor[2, lGPU_Index, 10] = bValue;
                                }
                                this._lbl_Sensor[lGPU_Index, 10].Text = this._Sensor[this._Mode, lGPU_Index, 10] + " %";
                            }

                            //if ((bName == "GPUCORE") && (bSensorType == "TEMPERATURE")) { this._lbl_Sensor[lGPU_Index, 1].Text = bValue + " C"; }
                            //else if ((bName == "GPUCORE") && (bSensorType == "CLOCK")) { this._lbl_Sensor[lGPU_Index, 2].Text = Convert.ToDouble(bValue).ToString("F2") + " Mhz"; }
                            //else if ((bName == "GPUMEMORY") && (bSensorType == "CLOCK")) { this._lbl_Sensor[lGPU_Index, 3].Text = Convert.ToDouble(bValue).ToString("F2") + " Mhz"; }
                            //else if ((bName == "GPUSHADER") && (bSensorType == "CLOCK")) { this._lbl_Sensor[lGPU_Index, 4].Text = Convert.ToDouble(bValue).ToString("F2") + " Mhz"; }
                            //else if ((bName == "GPUCORE") && (bSensorType == "LOAD")) { this._lbl_Sensor[lGPU_Index, 5].Text = bValue + " %"; }
                            //else if ((bName == "GPUMEMORYCONTROLLER") && (bSensorType == "LOAD")) { this._lbl_Sensor[lGPU_Index, 6].Text = bValue + " %"; }
                            //else if ((bName == "GPUVIDEOENGINE") && (bSensorType == "LOAD")) { this._lbl_Sensor[lGPU_Index, 7].Text = bValue + " %"; }
                            //else if ((bName == "GPUMEMORY") && (bSensorType == "LOAD")) { this._lbl_Sensor[lGPU_Index, 8].Text = bValue + " %"; }
                            //else if ((bName == "GPU") && (bSensorType == "FAN")) { this._lbl_Sensor[lGPU_Index, 9].Text = bValue + " RPM"; }
                            //else if ((bName == "GPUFAN") && (bSensorType == "CONTROL")) { this._lbl_Sensor[lGPU_Index, 10].Text = bValue + " %"; }
                        }

                        lGPU_Index++;
                    }
                }

                //string teststr = this._str;
            }
            catch //(Exception ex)
            {
                //MessageBox.Show(this, ex.Message.ToString(), "Error : UpdateLabel", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Environment.Exit(0);
            }
        }
Esempio n. 6
0
        private void BindHardwareSensors()
        {
            OpenHardwareMonitor.Hardware.Computer computer = new OpenHardwareMonitor.Hardware.Computer();
            computer.CPUEnabled           = true;
            computer.RAMEnabled           = true;
            computer.MainboardEnabled     = true;
            computer.FanControllerEnabled = true;
            computer.HDDEnabled           = true;
            computer.Open();

            Table table = new Table();

            table.CellPadding = 0;
            table.CellSpacing = 0;

            TableRow tableRowHeadline = new TableRow();

            tableRowHeadline.CssClass = "HardwareSensorsHeadline";

            TableCell tableCellTitleHeadline = new TableCell();

            tableCellTitleHeadline.Text = "Sensor";

            TableCell tableCellLoadHeadline = new TableCell();

            tableCellLoadHeadline.Text = "Load";

            TableCell tableCellTempHeadline = new TableCell();

            tableCellTempHeadline.Text = "Temp";

            tableRowHeadline.Cells.Add(tableCellTitleHeadline);
            tableRowHeadline.Cells.Add(tableCellLoadHeadline);
            tableRowHeadline.Cells.Add(tableCellTempHeadline);

            table.Rows.Add(tableRowHeadline);

            foreach (OpenHardwareMonitor.Hardware.IHardware hardware in computer.Hardware)
            {
                if (hardware.HardwareType != OpenHardwareMonitor.Hardware.HardwareType.CPU)
                {
                    continue;
                }

                Dictionary <string, int[]> cores = new Dictionary <string, int[]>();

                foreach (OpenHardwareMonitor.Hardware.ISensor sensor in hardware.Sensors)
                {
                    if (!cores.ContainsKey(sensor.Name))
                    {
                        cores.Add(sensor.Name, new int[2]);
                    }

                    if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Load)
                    {
                        try
                        {
                            cores[sensor.Name][0] = (int)sensor.Value.Value;
                        }
                        catch { }
                    }
                    else if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                    {
                        try
                        {
                            cores[sensor.Name][1] = (int)sensor.Value.Value;

                            foreach (OpenHardwareMonitor.Hardware.SensorValue v in sensor.Values)
                            {
                                cores[sensor.Name][1] = (int)v.Value;
                            }
                        }
                        catch { }
                    }
                }

                foreach (string core in cores.Keys)
                {
                    TableRow tableRow = new TableRow();

                    TableCell tableCellTitle = new TableCell();
                    tableCellTitle.Text = core;

                    TableCell tableCellLoad = new TableCell();
                    tableCellLoad.Text = cores[core][0].ToString() + "%";

                    TableCell tableCellTemp = new TableCell();
                    tableCellTemp.Text = cores[core][1] != 0 ? cores[core][1].ToString() + "°" : "N/A";

                    tableRow.Cells.Add(tableCellTitle);
                    tableRow.Cells.Add(tableCellLoad);
                    tableRow.Cells.Add(tableCellTemp);

                    table.Rows.Add(tableRow);
                }
            }

            foreach (OpenHardwareMonitor.Hardware.IHardware hardware in computer.Hardware)
            {
                if (hardware.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.CPU)
                {
                    continue;
                }

                Dictionary <string, int[]> cores = new Dictionary <string, int[]>();

                foreach (OpenHardwareMonitor.Hardware.ISensor sensor in hardware.Sensors)
                {
                    TableRow tableRow = new TableRow();

                    TableCell tableCellTitle = new TableCell();
                    tableCellTitle.Text = hardware.Name + " - " + sensor.Name;

                    TableCell tableCellLoad = new TableCell();
                    tableCellLoad.Text = sensor.Value != null?sensor.Value.ToString() : "N/A";

                    tableRow.Cells.Add(tableCellTitle);
                    tableRow.Cells.Add(tableCellLoad);

                    table.Rows.Add(tableRow);
                }
            }

            pnlHardwareSensors.Controls.Add(table);

            computer.Close();
        }
Esempio n. 7
0
        private static void RefreshTemps()
        {
            //- Variables
            warn  = false;
            temps = new Dictionary <string, double>();

            //- Load Open Hardware Monitor library
            try
            {
                pcHW = new OpenHardwareMonitor.Hardware.Computer()
                {
                    CPUEnabled = true,
                    GPUEnabled = true,
                    HDDEnabled = true,
                };
                pcHW.Open();
            }
            catch { }

            try
            {
                for (int h = 0; h < pcHW.Hardware.Length; h++)
                {
                    var hw = pcHW.Hardware[h];
                    if (hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.CPU)
                    {
                        hw.Update();
                        Thread.Sleep(1000);
                        hw.Update();
                        Thread.Sleep(1000);
                        hw.Update();

                        for (int s = 0; s < hw.Sensors.Length; s++)
                        {
                            var sensor = hw.Sensors[s];
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                if (sensor.Value != null)
                                {
                                    //- Get temperature value and convert that to F
                                    double val = (double)sensor.Value;
                                    val = Math.Round((val * 1.8) + 32, 0);

                                    temps.Add("CPU", val);
                                }
                            }
                        }
                    }
                    else if (hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.GpuAti ||
                             hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.GpuNvidia)
                    {
                        hw.Update();
                        for (int s = 0; s < hw.Sensors.Length; s++)
                        {
                            var sensor = hw.Sensors[s];
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                if (sensor.Value != null)
                                {
                                    //- Get temperature value and convert that to F
                                    double val = (double)sensor.Value;
                                    val = Math.Round((val * 1.8) + 32, 0);

                                    temps.Add("GPU", val);
                                }
                            }
                        }
                    }
                    else if (hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.HDD)
                    {
                        hw.Update();

                        for (int s = 0; s < hw.Sensors.Length; s++)
                        {
                            var sensor = hw.Sensors[s];
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                if (sensor.Value != null)
                                {
                                    //- Get temperature value and convert that to F
                                    double val = (double)sensor.Value;
                                    val = Math.Round((val * 1.8) + 32, 0);

                                    temps.Add("HDD", val);
                                }
                            }
                        }
                    }
                    else if (hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.Mainboard)
                    {
                        hw.Update();

                        for (int s = 0; s < hw.Sensors.Length; s++)
                        {
                            var sensor = hw.Sensors[s];
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                if (sensor.Value != null)
                                {
                                    //- Get temperature value and convert that to F
                                    double val = (double)sensor.Value;
                                    val = Math.Round((val * 1.8) + 32, 0);

                                    temps.Add("Mobo", val);
                                }
                            }
                        }
                    }
                    else if (hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.RAM)
                    {
                        hw.Update();

                        for (int s = 0; s < hw.Sensors.Length; s++)
                        {
                            var sensor = hw.Sensors[s];
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                if (sensor.Value != null)
                                {
                                    //- Get temperature value and convert that to F
                                    double val = (double)sensor.Value;
                                    val = Math.Round((val * 1.8) + 32, 0);

                                    temps.Add("RAM", val);
                                }
                            }
                        }
                    }
                    else if (hw.HardwareType == OpenHardwareMonitor.Hardware.HardwareType.Heatmaster)
                    {
                        hw.Update();

                        for (int s = 0; s < hw.Sensors.Length; s++)
                        {
                            var sensor = hw.Sensors[s];
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                if (sensor.Value != null)
                                {
                                    //- Get temperature value and convert that to F
                                    double val = (double)sensor.Value;
                                    val = Math.Round((val * 1.8) + 32, 0);

                                    temps.Add("Heatsink", val);
                                }
                            }
                        }
                    }
                }
            }
            catch { failed = true; }
        }
Esempio n. 8
0
File: OHW.cs Progetto: mkahvi/sysmon
        public OHW()
        {
            OpenHardwareMonitor.Hardware.Computer computer;

            computer = new OpenHardwareMonitor.Hardware.Computer()
            {
                GPUEnabled = true,
                CPUEnabled = true,
                //MainboardEnabled = true, // doesn't seem to have anything
                FanControllerEnabled = true,
            };

            computer.Open();
            if (computer.Hardware.Length == 0)
            {
                computer.Close();
                throw new Exception("OHM failed to initialize.");
            }

            try
            {
                foreach (var hw in computer.Hardware)
                {
                    hw.Update();

                    /*
                     * foreach (var shw in hw.SubHardware)
                     *      shw.Update();
                     */

                    /*
                     *
                     * CPU Core #1 : Load = 60.00
                     * CPU Core #2 : Load = 40.00
                     * CPU Total : Load = 50.00
                     * CPU Core #1 : Clock = 3,411.70
                     * CPU Core #2 : Clock = 3,411.70
                     *
                     * GPU Core : Temperature = 42.00
                     * GPU : Fan = 1,110.00
                     * GPU Core : Clock = 796.94
                     * GPU Memory : Clock = 3,004.68
                     * GPU Shader : Clock = 1,593.87
                     * GPU Core : Load = 3.00
                     * GPU Memory Controller : Load = 2.00
                     * GPU Video Engine : Load = 0.00 // this is "always" zero, useless stat
                     * GPU Fan : Control = 32.00
                     * GPU Memory Total : SmallData = 2,048.00
                     * GPU Memory Used : SmallData = 1,301.16
                     * GPU Memory Free : SmallData = 746.84
                     * GPU Memory : Load = 63.53
                     */

                    Console.WriteLine("Hardware: " + hw.Name + $" ({hw.HardwareType.ToString()})");

                    switch (hw.HardwareType)
                    {
                    case OpenHardwareMonitor.Hardware.HardwareType.CPU:
                        // only load and clock sensors normally
                        // temperature sensor requires admin rights
                        foreach (var sensor in hw.Sensors)
                        {
                            if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Temperature)
                            {
                                cpuTemp = sensor;
                            }
                        }
                        break;

                    case OpenHardwareMonitor.Hardware.HardwareType.GpuAti:
                    case OpenHardwareMonitor.Hardware.HardwareType.GpuNvidia:
                        GPUName = hw.Name;
                        gpu     = hw;
                        foreach (var sensor in hw.Sensors)
                        {
                            switch (sensor.Name)
                            {
                            default: break;                                             // ignore

                            case "GPU":
                                if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Fan)
                                {
                                    gpuFan = sensor;
                                }
                                break;

                            case "GPU Core":
                                switch (sensor.SensorType)
                                {
                                case OpenHardwareMonitor.Hardware.SensorType.Temperature:
                                    gpuTmp = sensor;
                                    break;

                                case OpenHardwareMonitor.Hardware.SensorType.Load:
                                    gpuLoad = sensor;
                                    break;

                                case OpenHardwareMonitor.Hardware.SensorType.Clock:
                                    gpuClock = sensor;
                                    break;
                                }
                                break;

                            case "GPU Fan":
                                if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Control)
                                {
                                    gpuFanControl = sensor;
                                }
                                break;

                            case "GPU Memory":
                                if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Load)
                                {
                                    gpuMemLoad = sensor;
                                }
                                break;

                            case "GPU Memory Total":
                                if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.SmallData)
                                {
                                    GPUTotalMemory = sensor.Value ?? float.NaN;
                                }
                                break;

                            case "GPU Memory Controller":
                                if (sensor.SensorType == OpenHardwareMonitor.Hardware.SensorType.Load)
                                {
                                    gpuMemCtrl = sensor;
                                }
                                break;
                            }
                        }
                        break;
                    }
                }

                Initialized = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                computer?.Close();                 // not needed?
            }
        }