Files
ReLibreHardwareMonitor/LibreHardwareMonitorLib/Hardware/Storage/StorageDeviceSensor.cs
T
Blacktempel c542e856d4 Replace Storage implementation with CrystalDiskInfo based implementation (#2015)
* Replace Storage implementation with CrystalDiskInfo based implementation.

* Formatting.

* Code review.

* Code review.

* Increase space for attribute name in report.

* Implement dynamic disk handling for usage sensor.

Disable unused warnings.

* Further cleanup in NativeMethods.txt and referenced.
2025-11-08 10:53:43 +01:00

28 lines
1.0 KiB
C#

// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Copyright (C) LibreHardwareMonitor and Contributors.
// Partial Copyright (C) Michael Möller <mmoeller@openhardwaremonitor.org> and Contributors.
// All Rights Reserved.
namespace LibreHardwareMonitor.Hardware.Storage;
internal delegate float GetStorageDeviceSensorValue(DiskInfoToolkit.Storage storage);
internal class StorageDeviceSensor : Sensor
{
private readonly GetStorageDeviceSensorValue _getValue;
public StorageDeviceSensor(string name, int index, bool defaultHidden, SensorType sensorType, Hardware hardware, ISettings settings, GetStorageDeviceSensorValue getValue)
: base(name, index, defaultHidden, sensorType, hardware, null, settings)
{
_getValue = getValue;
}
public void Update(DiskInfoToolkit.Storage storage)
{
var value = _getValue(storage);
Value = value;
}
}