/// <summary>
        /// Scan for hardware using Open Harware Monitor
        /// Write GPU Settings to API
        /// </summary>
        /// <param name="param"></param>
        private void ScanHardware(object param)
        {
            // Scan for hardware using Open Harware Monitor
            Utils.OpenHardwareMonitor.OpenHardwareMonitor openHardwareMonitor = new Utils.OpenHardwareMonitor.OpenHardwareMonitor();
            //WMI wmi = new WMI();
            GPUSettingsList = openHardwareMonitor.ScanHardware();

            // Push GPU settings to the API
            PersistWorkerHardware(null);

            // Notify success
            ShowSuccess(string.Format("Hardware scanned successfully"));
        }
Exemple #2
0
        /// <summary>
        /// Use OpenHardwareMonitor to add any missing data if needed
        /// </summary>
        /// <param name="stats"></param>
        private MinerMonitorStat SupplementMinerMonitorStatData(MinerMonitorStat stats)
        {
            // Check if any data is missing from stats
            if (CheckMinerMonitorStatDataMissing(stats) == true)
            {
                try
                {
                    // Retrive GPU data from OpenHardwareMonitor
                    Utils.OpenHardwareMonitor.OpenHardwareMonitor openHardwareMonitor = new Utils.OpenHardwareMonitor.OpenHardwareMonitor();
                    ObservableCollection <GPUSettings>            gpuSettingsList     = openHardwareMonitor.ScanHardware();

                    // Iterate through each GPUMonitorStat and add missing data
                    foreach (GPUMonitorStat gpuMonitorStat in stats.GPUMonitorStatList)
                    {
                        if (gpuMonitorStat.FanSpeed == 0)
                        {
                            gpuMonitorStat.FanSpeed = gpuSettingsList.Where(x => x.GPUID == gpuMonitorStat.GPUID).FirstOrDefault().Fanspeed;
                        }

                        if (gpuMonitorStat.Temp == 0)
                        {
                            gpuMonitorStat.Temp = gpuSettingsList.Where(x => x.GPUID == gpuMonitorStat.GPUID).FirstOrDefault().Temp;
                        }
                    }
                }
                catch (Exception)
                {
                    // Ignore this for now.
                }
            }

            return(stats);
        }