Skip to content

Commit 1c65a13

Browse files
committed
Update DeviceTemp.cs
use better descriptive string instead of type.ToString()
1 parent 420a50c commit 1c65a13

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

DeviceTemp.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public DeviceTemp(SWIGTYPE_p__ctl_temp_handle_t handle)
1414
using (var properties = new ctl_temp_properties_t())
1515
{
1616
CtlLibrary.ctlTemperatureGetProperties(handle, properties);
17-
Name = properties.type.ToString();
17+
Name = TypeToString(properties.type);
1818
}
1919

2020
_handle = handle;
@@ -33,5 +33,20 @@ public void Dispose()
3333
{
3434
CtlLibrary.delete_double_Ptr(doublePtr);
3535
}
36+
37+
private static string TypeToString(ctl_temp_sensors_t type)
38+
{
39+
return type switch
40+
{
41+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_GLOBAL => "Global",
42+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_GPU => "GPU",
43+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_MEMORY => "Memory",
44+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_GLOBAL_MIN => "Global Min",
45+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_GPU_MIN => "GPU Min",
46+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_MEMORY_MIN => "Memory Min",
47+
ctl_temp_sensors_t.CTL_TEMP_SENSORS_MAX => "Max",
48+
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
49+
};
50+
}
3651
}
3752
}

0 commit comments

Comments
 (0)