public String getTempHardware() { String formato = "["; foreach (IHardware HW in computador.Hardware) { HW.Update(); if (HW.HardwareType.Equals(HardwareType.CPU)) { formato += "\n{"; foreach (ISensor Sensor in HW.Sensors) { if (Sensor.SensorType.Equals(SensorType.Temperature)) { if (Sensor.Name.Equals("CPU Package")) { formato += "\n\"Tipo\":\"" + HW.HardwareType.ToString() + "\","; formato += "\n\"Nome\":\"" + HW.Name.ToString() + "\","; formato += "\n\"Temp\":\"" + Sensor.Value.ToString() + "\""; } } } formato += "\n}"; } if (HW.HardwareType.Equals(HardwareType.GpuAti)) { formato += "\n,"; formato += "\n{"; foreach (ISensor Sensor in HW.Sensors) { if (Sensor.SensorType.Equals(SensorType.Temperature)) { formato += "\n\"Tipo\":\"" + HW.HardwareType.ToString() + "\","; formato += "\n\"Nome\":\"" + HW.Name.ToString() + "\","; formato += "\n\"Temp\":\"" + Sensor.Value.ToString() + "\""; } } formato += "\n}"; } if (HW.HardwareType.Equals(HardwareType.GpuNvidia)) { formato += "\n,"; formato += "\n{"; foreach (ISensor Sensor in HW.Sensors) { if (Sensor.SensorType.Equals(SensorType.Temperature)) { formato += "\n\"Tipo\":\"" + HW.HardwareType.ToString() + "\","; formato += "\n\"Nome\":\"" + HW.Name.ToString() + "\","; formato += "\n\"Temp\":\"" + Sensor.Value.ToString() + "\""; } } formato += "\n}"; } } formato += "\n]"; return(formato); }