Files
ReLibreHardwareMonitor/Hardware/HDD/HarddriveGroup.cs
T
Michal 5d89cdc43d Cleanup around base collection types. (#59)
* Hardware in IGroup is now IEnumerable. No point to call ToArray each time.

* Use ValueTuple insead of custom pair.

* ListSet -> HashSet

* Ring Collection -> List

* ReadOnlyArray -> ReadOnlyList
2018-10-30 14:44:41 +01:00

53 lines
1.3 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) 2009-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010 Paul Werelds
Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware.HDD {
internal class HarddriveGroup : IGroup {
private const int MAX_DRIVES = 32;
private readonly List<AbstractHarddrive> hardware =
new List<AbstractHarddrive>();
public HarddriveGroup(ISettings settings) {
if (Software.OperatingSystem.IsLinux) return;
ISmart smart = new WindowsSmart();
for (int drive = 0; drive < MAX_DRIVES; drive++) {
AbstractHarddrive instance =
AbstractHarddrive.CreateInstance(smart, drive, settings);
if (instance != null) {
this.hardware.Add(instance);
}
}
}
public IEnumerable<IHardware> Hardware => hardware;
public string GetReport() {
return null;
}
public void Close() {
foreach (AbstractHarddrive hdd in hardware)
hdd.Close();
}
}
}