From c8e25b9e67daf7c6902428a442ac19bf4306d5c3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 1 Mar 2015 18:10:34 +0000 Subject: WinGui: Dropping more legacy code and moving some more UI only code up to the UI level. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6960 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs (limited to 'win/CS/HandBrakeWPF/Utilities') diff --git a/win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs b/win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs new file mode 100644 index 000000000..d07056ef8 --- /dev/null +++ b/win/CS/HandBrakeWPF/Utilities/DriveUtilities.cs @@ -0,0 +1,53 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// 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; + } + } +} -- cgit v1.2.3