OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / Main.cs
index 8c92d76..3071cf5 100644 (file)
@@ -14,6 +14,7 @@ using System.Xml.Serialization;
 using System.Threading;\r
 using Handbrake.EncodeQueue;\r
 using System.Net;\r
+using Handbrake.Model;\r
 \r
 namespace Handbrake.Functions\r
 {\r
@@ -125,7 +126,7 @@ namespace Handbrake.Functions
         /// Function which generates the filename and path automatically based on \r
         /// the Source Name, DVD title and DVD Chapters\r
         /// </summary>\r
-        public static string AutoName(frmMain mainWindow) //ComboBox drpDvdtitle, string chapter_start, string chatper_end, string source, string dest, int format, Boolean chapters)\r
+        public static string AutoName(frmMain mainWindow)\r
         {\r
             string AutoNamePath = string.Empty;\r
             if (mainWindow.drp_dvdtitle.Text != "Automatic")\r
@@ -633,5 +634,27 @@ namespace Handbrake.Functions
                                                           };\r
             return languageMap;\r
         }\r
+\r
+        /// <summary>\r
+        /// Get a list of available DVD drives which are ready and contain DVD content.\r
+        /// </summary>\r
+        /// <returns></returns>\r
+        public static List<DriveInformation> GetDrives()\r
+        {\r
+            List<DriveInformation> drives = new List<DriveInformation>();\r
+            DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();\r
+            foreach (DriveInfo curDrive in theCollectionOfDrives)\r
+            {\r
+                if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady && File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))\r
+                {\r
+                    drives.Add(new DriveInformation\r
+                                             {\r
+                                                 VolumeLabel = curDrive.VolumeLabel,\r
+                                                 RootDirectory = curDrive.RootDirectory + "VIDEO_TS"\r
+                                             });\r
+                }\r
+            }\r
+            return drives;\r
+        }\r
     }\r
 }
\ No newline at end of file