ayy lmao
This commit is contained in:
parent
abbe94a72c
commit
3b1afdf2c0
92 changed files with 23248 additions and 0 deletions
32
ImageCatalogCS/Temperature.cs
Normal file
32
ImageCatalogCS/Temperature.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Management;
|
||||
|
||||
|
||||
|
||||
namespace ImageCatalogCS
|
||||
{
|
||||
public class Temperature
|
||||
{
|
||||
public double CurrentValue { get; set; }
|
||||
public string InstanceName { get; set; }
|
||||
public static List<Temperature> Temperatures
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Temperature> result = new List<Temperature>();
|
||||
ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature");
|
||||
foreach (ManagementObject obj in searcher.Get())
|
||||
{
|
||||
Double temp = Convert.ToDouble(obj["CurrentTemperature"].ToString());
|
||||
temp = (temp - 2732) / 10.0;
|
||||
result.Add(new Temperature { CurrentValue = temp, InstanceName = obj["InstanceName"].ToString() });
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue