public void createGPUFanControl(ref List <BaseControl> controlList) { 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.Control) { var name = "GPU Fan Control #" + gpuFanNum++; while (this.isExistControl(ref controlList, name) == true) { name = "GPU Fan Control #" + gpuFanNum++; } var control = new HardwareControl(sensorArray[j], name); controlList.Add(control); } } 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.Control) { var name = "GPU Fan Control #" + gpuFanNum++; while (this.isExistControl(ref controlList, name) == true) { name = "GPU Fan Control #" + gpuFanNum++; } var control = new HardwareControl(subSensorList[k], name); controlList.Add(control); } } } } } }
public void createControl(ref List <BaseControl> controlList) { 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.Control) { continue; } var control = new HardwareControl(sensorArray[j], "Fan Control #" + fanNum++); controlList.Add(control); } 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.Control) { continue; } var control = new HardwareControl(subSensorList[k], "Fan Control #" + fanNum++); controlList.Add(control); } } } }