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(); + } } }