private void Build_CPU_Section() { if (LocalHardwareMonitor.motherBoardInfo.Count == 0) { label_CPU_Motherboard_Name.Text = "No motherboards found."; return; } LocalHardwareItem motherBoard = LocalHardwareMonitor.motherBoardInfo[0]; label_CPU_Motherboard_Name.Text = motherBoard.Name; label_CPU_Motherboard_SensorCount.Text = motherBoard.NumberOfSensors.ToString(); if (LocalHardwareMonitor.cpuInfo.Count == 0) { label_CPU_CPU_Name.Text = "No CPUs found."; return; } LocalHardwareItem cpu = LocalHardwareMonitor.cpuInfo[0]; label_CPU_CPU_Name.Text = cpu.Name; label_CPU_CPU_SensorCount.Text = cpu.NumberOfSensors.ToString(); foreach (LocalSensor currSensor in cpu.SensorList) { comboBox_CPU_Load.Items.Add(currSensor.Id); if (currSensor.Id.Contains("load/0")) { comboBox_CPU_Load.SelectedItem = currSensor.Id; } comboBox_CPU_Temp.Items.Add(currSensor.Id); if (currSensor.Id.Contains("temperature")) { comboBox_CPU_Temp.SelectedItem = currSensor.Id; } comboBox_CPU_Power.Items.Add(currSensor.Id); if (currSensor.Id.Contains("power/0")) { comboBox_CPU_Power.SelectedItem = currSensor.Id; } comboBox_CPU_Clock.Items.Add(currSensor.Id); if (currSensor.Id.Contains("clock/1")) { comboBox_CPU_Clock.SelectedItem = currSensor.Id; } } }
void BuildSensorNodeList(LocalHardwareItem currHardwareItem, TreeNode parentTreeNode) { TreeNode currNode = new TreeNode(); currNode.Text = currHardwareItem.Name + " (" + currHardwareItem.Id + ")"; TreeNode voltageNode = new TreeNode(); voltageNode.Text = "Voltages"; TreeNode clockNode = new TreeNode(); clockNode.Text = "Clock"; TreeNode tempNode = new TreeNode(); tempNode.Text = "Temperature"; TreeNode loadNode = new TreeNode(); loadNode.Text = "Load"; TreeNode fanNode = new TreeNode(); fanNode.Text = "Fan"; TreeNode flowNode = new TreeNode(); flowNode.Text = "Flow"; TreeNode controlNode = new TreeNode(); controlNode.Text = "Control"; TreeNode levelNode = new TreeNode(); levelNode.Text = "Level"; TreeNode factorNode = new TreeNode(); factorNode.Text = "Factor"; TreeNode powerNode = new TreeNode(); powerNode.Text = "Power"; TreeNode dataNode = new TreeNode(); dataNode.Text = "Data"; TreeNode smallDataNode = new TreeNode(); smallDataNode.Text = "Small Data"; TreeNode speedNode = new TreeNode(); speedNode.Text = "Speed (KBps)"; TreeNode fpsNode = new TreeNode(); fpsNode.Text = "FPS"; foreach (LocalSensor currSensor in currHardwareItem.SensorList) { switch (currSensor.Type) { case OpenHardwareMonitor.Hardware.SensorType.Voltage: BuildSensorNode(currSensor, voltageNode); break; case OpenHardwareMonitor.Hardware.SensorType.Clock: BuildSensorNode(currSensor, clockNode); break; case OpenHardwareMonitor.Hardware.SensorType.Temperature: BuildSensorNode(currSensor, tempNode); break; case OpenHardwareMonitor.Hardware.SensorType.Load: BuildSensorNode(currSensor, loadNode); break; case OpenHardwareMonitor.Hardware.SensorType.Fan: BuildSensorNode(currSensor, fanNode); break; case OpenHardwareMonitor.Hardware.SensorType.Flow: BuildSensorNode(currSensor, flowNode); break; case OpenHardwareMonitor.Hardware.SensorType.Control: BuildSensorNode(currSensor, controlNode); break; case OpenHardwareMonitor.Hardware.SensorType.Level: BuildSensorNode(currSensor, levelNode); break; case OpenHardwareMonitor.Hardware.SensorType.Factor: BuildSensorNode(currSensor, factorNode); break; case OpenHardwareMonitor.Hardware.SensorType.Power: BuildSensorNode(currSensor, powerNode); break; case OpenHardwareMonitor.Hardware.SensorType.Data: BuildSensorNode(currSensor, dataNode); break; case OpenHardwareMonitor.Hardware.SensorType.SmallData: BuildSensorNode(currSensor, smallDataNode); break; case OpenHardwareMonitor.Hardware.SensorType.KBPS: BuildSensorNode(currSensor, speedNode); break; case OpenHardwareMonitor.Hardware.SensorType.FPS: BuildSensorNode(currSensor, fpsNode); break; default: break; } } if (fpsNode.Nodes.Count > 0) { currNode.Nodes.Add(fpsNode); } if (speedNode.Nodes.Count > 0) { currNode.Nodes.Add(speedNode); } if (smallDataNode.Nodes.Count > 0) { currNode.Nodes.Add(smallDataNode); } if (dataNode.Nodes.Count > 0) { currNode.Nodes.Add(dataNode); } if (powerNode.Nodes.Count > 0) { currNode.Nodes.Add(powerNode); } if (factorNode.Nodes.Count > 0) { currNode.Nodes.Add(factorNode); } if (levelNode.Nodes.Count > 0) { currNode.Nodes.Add(levelNode); } if (controlNode.Nodes.Count > 0) { currNode.Nodes.Add(controlNode); } if (flowNode.Nodes.Count > 0) { currNode.Nodes.Add(flowNode); } if (fanNode.Nodes.Count > 0) { currNode.Nodes.Add(fanNode); } if (loadNode.Nodes.Count > 0) { currNode.Nodes.Add(loadNode); } if (tempNode.Nodes.Count > 0) { currNode.Nodes.Add(tempNode); } if (voltageNode.Nodes.Count > 0) { currNode.Nodes.Add(voltageNode); } if (clockNode.Nodes.Count > 0) { currNode.Nodes.Add(clockNode); } if (currNode.Nodes.Count > 0) { parentTreeNode.Nodes.Add(currNode); } }