Example #1
0
        public void createGPUFan(ref List <BaseSensor> fanList)
        {
            bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;

            int gpuFanNum     = 1;
            var hardwareArray = mComputer.Hardware;

            for (int i = 0; i < hardwareArray.Length; i++)
            {
                if ((hardwareArray[i].HardwareType == HardwareType.GpuNvidia && isNvAPIWrapper == false) ||
                    (hardwareArray[i].HardwareType == HardwareType.GpuAmd))
                {
                    var sensorArray = hardwareArray[i].Sensors;
                    for (int j = 0; j < sensorArray.Length; j++)
                    {
                        if (sensorArray[j].SensorType == LibreHardwareMonitor.Hardware.SensorType.Fan)
                        {
                            var name = "GPU Fan #" + gpuFanNum++;
                            while (this.isExistFan(ref fanList, name) == true)
                            {
                                name = "GPU Fan #" + gpuFanNum++;
                            }

                            var fan = new HardwareFanSpeed(sensorArray[j], name);
                            fanList.Add(fan);
                        }
                    }

                    var subHardwareArray = hardwareArray[i].SubHardware;
                    for (int j = 0; j < subHardwareArray.Length; j++)
                    {
                        var subSensorList = subHardwareArray[j].Sensors;
                        for (int k = 0; k < subSensorList.Length; k++)
                        {
                            if (subSensorList[k].SensorType == LibreHardwareMonitor.Hardware.SensorType.Fan)
                            {
                                var name = "GPU Fan #" + gpuFanNum++;
                                while (this.isExistFan(ref fanList, name) == true)
                                {
                                    name = "GPU Fan #" + gpuFanNum++;
                                }

                                var fan = new HardwareFanSpeed(subSensorList[k], name);
                                fanList.Add(fan);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public void createFan(ref List <BaseSensor> fanList)
        {
            int fanNum        = 1;
            var hardwareArray = mComputer.Hardware;

            for (int i = 0; i < hardwareArray.Length; i++)
            {
                if (hardwareArray[i].HardwareType == HardwareType.GpuNvidia ||
                    hardwareArray[i].HardwareType == HardwareType.GpuAmd)
                {
                    continue;
                }

                var sensorArray = hardwareArray[i].Sensors;
                for (int j = 0; j < sensorArray.Length; j++)
                {
                    if (sensorArray[j].SensorType != LibreHardwareMonitor.Hardware.SensorType.Fan)
                    {
                        continue;
                    }

                    var fan = new HardwareFanSpeed(sensorArray[j], "Fan #" + fanNum++);
                    fanList.Add(fan);
                }

                var subHardwareArray = hardwareArray[i].SubHardware;
                for (int j = 0; j < subHardwareArray.Length; j++)
                {
                    var subSensorArray = subHardwareArray[j].Sensors;
                    for (int k = 0; k < subSensorArray.Length; k++)
                    {
                        if (subSensorArray[k].SensorType != LibreHardwareMonitor.Hardware.SensorType.Fan)
                        {
                            continue;
                        }

                        var fan = new HardwareFanSpeed(subSensorArray[k], "Fan #" + fanNum++);
                        fanList.Add(fan);
                    }
                }
            }
        }