public HarddriveGroup(ISettings settings) { if (OperatingSystem.IsUnix) { return; } // A bit of a hack to make sure we get a 1:1 relationship between physical drives and SCSI Disks (as which NVME drives are recognized, see // NVMeGeneric.GetDeviceInfo for further details NVMeGeneric previousNvmeDisk = null; for (int drive = 0; drive < MAX_DRIVES; drive++) { AbstractStorage instance = AbstractStorage.CreateInstance(drive, previousNvmeDisk, settings); if (instance != null) { this.hardware.Add(instance); } if (instance is NVMeGeneric nvme) { previousNvmeDisk = nvme; } } }
public static AbstractStorage CreateInstance(int driveNumber, ISettings settings) { StorageInfo info = WindowsStorage.GetStorageInfo(driveNumber); if (info == null || info.Removable) { return(null); } if (info.BusType == StorageBusType.BusTypeAta || info.BusType == StorageBusType.BusTypeSata) { return(ATAStorage.CreateInstance(info, settings)); } if (info.BusType == StorageBusType.BusTypeNvme) { return(NVMeGeneric.CreateInstance(info, settings)); } return(StorageGeneric.CreateInstance(info, settings)); }
public static AbstractStorage CreateInstance(StorageInfo storageInfo, NVMeGeneric previousNvme, ISettings settings) { NVMeInfo nvmeInfo = GetDeviceInfo(storageInfo, previousNvme != null ? previousNvme.info.LogicalDeviceNumber : -1); if (nvmeInfo == null) { Logging.LogInfo($"Device {storageInfo.Index} ({storageInfo.Name}) identifies as NVMe device, but does not support all requires features."); } IEnumerable <string> logicalDrives = WindowsStorage.GetLogicalDrives(storageInfo.Index); string name = nvmeInfo.Model; if (logicalDrives.Any()) { logicalDrives = logicalDrives.Select(x => $"{x}:"); name += " (" + string.Join(", ", logicalDrives) + ")"; } return(new NVMeGeneric(name, nvmeInfo, storageInfo.Index, settings)); }