From dd0dfc5cf5e5b6d2fc0b8632158a0de3025592c5 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 10 Jun 2018 16:05:25 -0700 Subject: [PATCH] Move drive scanning to Utilities --- Utilities.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Utilities.cs b/Utilities.cs index f93219b8..e158ba91 100644 --- a/Utilities.cs +++ b/Utilities.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.IO; +using System.Linq; namespace DICUI { @@ -521,7 +523,7 @@ namespace DICUI /// /// Create a list of systems matched to their respective enums /// - /// + /// Systems matched to enums, if possible /// /// This returns a List of Tuples whose structure is as follows: /// Item 1: Printable name @@ -579,5 +581,22 @@ namespace DICUI return mapping; } + + /// + /// Create a list of active optical drives matched to their volume labels + /// + /// Active drives, matched to labels, if possible + /// + /// This returns a List of Tuples whose structure is as follows: + /// Item 1: Drive letter + /// Item 2: Volume label + /// + public static List> CreateListOfDrives() + { + return DriveInfo.GetDrives() + .Where(d => d.DriveType == DriveType.CDRom && d.IsReady) + .Select(d => new Tuple(d.Name[0], d.VolumeLabel)) + .ToList(); + } } }