-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathHWInfoRegistryUpdateResult.cs
30 lines (23 loc) · 1.08 KB
/
HWInfoRegistryUpdateResult.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Collections.Generic;
using System.Linq;
namespace FanControl.HWInfo
{
internal class HWInfoRegistryUpdateResult
{
private static HWInfoRegistryUpdateResult SuccessSingleton = new HWInfoRegistryUpdateResult();
public static HWInfoRegistryUpdateResult Success() => SuccessSingleton;
public static HWInfoRegistryUpdateResult Failure(FailedSensor sensor) => new HWInfoRegistryUpdateResult(sensor);
public static HWInfoRegistryUpdateResult Failure(IEnumerable<FailedSensor> sensors) => new HWInfoRegistryUpdateResult(sensors);
private HWInfoRegistryUpdateResult(IEnumerable<FailedSensor> sensors)
{
(MissingSensors as List<FailedSensor>).AddRange(sensors);
}
private HWInfoRegistryUpdateResult(FailedSensor? sensor = null)
{
if (sensor != null)
(MissingSensors as List<FailedSensor>).Add(sensor.Value);
}
public bool IsSuccess => !MissingSensors.Any();
public IEnumerable<FailedSensor> MissingSensors { get; } = new List<FailedSensor>();
}
}