# HG changeset patch # User moel.mich # Date 1372609492 0 # Node ID 2ce8da367490d54a0eca6d970594fcb4cc32a310 # Parent bbeb9004c491fcda514a1bf9af8ae19467473181 Changed the HDD enumeration code to drop drives without smart support and without any non-zero-sized logical drives. diff -r bbeb9004c491 -r 2ce8da367490 Hardware/HDD/AbstractHarddrive.cs --- a/Hardware/HDD/AbstractHarddrive.cs Sun Jun 30 11:41:36 2013 +0000 +++ b/Hardware/HDD/AbstractHarddrive.cs Sun Jun 30 16:24:52 2013 +0000 @@ -69,9 +69,12 @@ foreach (string logicalDrive in logicalDrives) { try { DriveInfo di = new DriveInfo(logicalDrive); - if (di.TotalSize > 0) + if (di.TotalSize > 0) driveInfoList.Add(new DriveInfo(logicalDrive)); - } catch (ArgumentException) { } catch (IOException) { } + } catch (ArgumentException) { + } catch (IOException) { + } catch (UnauthorizedAccessException) { + } } driveInfos = driveInfoList.ToArray(); @@ -105,6 +108,23 @@ string[] logicalDrives = smart.GetLogicalDrives(driveIndex); if (logicalDrives == null || logicalDrives.Length == 0) return null; + + bool hasNonZeroSizeDrive = false; + foreach (string logicalDrive in logicalDrives) { + try { + DriveInfo di = new DriveInfo(logicalDrive); + if (di.TotalSize > 0) { + hasNonZeroSizeDrive = true; + break; + } + } catch (ArgumentException) { + } catch (IOException) { + } catch (UnauthorizedAccessException) { + } + } + + if (!hasNonZeroSizeDrive) + return null; } if (string.IsNullOrEmpty(name))