// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The drive utilities. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Utilities { using System.Collections.Generic; using System.IO; using HandBrakeWPF.Model; /// /// The drive utilities. /// public class DriveUtilities { /// /// Get a list of available DVD drives which are ready and contain DVD content. /// /// A List of Drives with their details public static List GetDrives() { var drives = new List(); DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives(); int id = 0; foreach (DriveInfo curDrive in theCollectionOfDrives) { if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady) { if (Directory.Exists(curDrive.RootDirectory + "VIDEO_TS") || Directory.Exists(curDrive.RootDirectory + "BDMV")) { drives.Add( new DriveInformation { Id = id, VolumeLabel = curDrive.VolumeLabel, RootDirectory = curDrive.RootDirectory.ToString() }); id++; } } } return drives; } } }