OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 31 Jan 2010 14:28:23 +0000 (14:28 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 31 Jan 2010 14:28:23 +0000 (14:28 +0000)
- Refacotring Code.

git-svn-id: svn://localhost/HandBrake/trunk@3091 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Changelog.html [deleted file]
win/C#/Controls/AudioPanel.cs
win/C#/Functions/Main.cs
win/C#/Functions/PresetLoader.cs
win/C#/HandBrakeCS.csproj
win/C#/Model/DriveInformation.cs [new file with mode: 0644]
win/C#/Model/SourceType.cs [new file with mode: 0644]
win/C#/frmMain.cs

diff --git a/win/C#/Changelog.html b/win/C#/Changelog.html
deleted file mode 100644 (file)
index 000b945..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml">\r
-<head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
-<title>ChangeLog</title>\r
-</head>\r
-\r
-<body>\r
-Windows Platform Specific Changlog.<br />\r
-\r
-    <h2>Changes Since Snapshot 2 - SVN2773</h2> <!-- Snapshot 3 (upcoming) -->\r
-    \r
-    <h4>New Features</h4>\r
-    None <br />\r
-    \r
-    <h4>Minor Improvements / Changes</h4>\r
-    - Updated Growl to 2.0.0.20 from 2.0.0.19<br />\r
-    - Added 2 new options. "Growl when queue completes" and "Growl when encode completes"<br />\r
-    - Added 1 new option. "Disable Resolution Calculation for "None" and "Custom" modes."<br />\r
-    - Removed "Enable DVD drive detection..." and "Load my default preset" preferences<br />\r
-    - Set m4v as default enabled.<br />\r
-\r
-    <h4>Fixed</h4>\r
-    - Several issues with Picture Settings panel related to aspect ration and resolution calculation. <br />\r
-    - Issue where file extension could be mp4 when chapters is enabled. Problem in the autoname function.<br />\r
-    - A regex error in the appcast reader and make it more robust to errors.<br />\r
-    - Issue with the destination File box double appending the file extension<br />\r
-    - Issue changing file format causing the audio encoder dropdown to be set to ""<br />\r
-    - An issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT<br />\r
-    - A culture issue with the Video Quality slider. Should now work correctly for systems which represent floats as 1,25 instead of 1.25<br />\r
-    - Issue with SRT filepaths not being quoted.<br />\r
-    - An issue with 8x8dct not saving correctly in presets<br />\r
-    - Activity log window would sometimes not display the CLI query used <br />\r
-    - Couple issues in the Picutre Settings code <br />\r
-\r
-    \r
-    <h4>Backend / Not important changes</h4>\r
-    - Filters dropdowns re-arranged and updated for consistancy (Off, Custom ...)\r
\r
-    <h2>Changes since Snapshot 1 - SVN2592</h2> <!-- Snapshot 2 -->\r
-    \r
-    <h4>New Features</h4>\r
-    - Added support for Growl for Windows.<br />\r
-    - Import MacGUI presets.<br />\r
-    - External SRT supported added.<br />\r
-    - Added new options: preferred language, "Dub Foreign language audio" and "Use Foreign language audio and Subtitles"<br />\r
-    - Import Chapter Markers from csv file <br />\r
-    \r
-    <h4>Minor Improvements / Changes</h4>\r
-    - Some UI layout changes / improvements<br />\r
-    - Remove M4v from format dropdown and add new option "Use iPod/iTunes friendly (.m4v) file extension for MP4<br />\r
-    \r
-    <h4>Fixed</h4>\r
-    - Picture Settings now works correctly (including Custom Anamorphic).<br />\r
-    - Error message when cancelling an encode within 2 seconds of it starting.<br />\r
-    - Quality slider resetting to 0 and other settings lost when a title change occurs.<br />\r
-    - Fixes some scaling / quality issues with QuickTime preview. \r
-    - Possible fix for QT not working on 64bit systems.<br />\r
-    - Chaning the x264 Quality granularity no longer requires a restart to work correctly <br />\r
-    - Chapter Markers tab now resets far less often. It should retain chapter names after being disabled / re-enabled <br />\r
-    \r
-    <h2>Changes since 0.9.3</h2> <!-- Snapshot 1 -->\r
-    \r
-    <h4>Major Changes</h4>\r
-\r
-    - Video Preview window using QuickTime or VLC. (5 to 60 second preview clips) <br />\r
-    - Re-designed audio tab. Now uses a List and allows for >4 audio channels.<br />\r
-    - Improved Picture Settings tab (Uses Numeric Controls and includes Modulus based increments and resolution calculation)<br />\r
-    - Minimise to system tray is now optional with the ability to turn off balloon tip notifications.<br />\r
-    - Picture settings can now be stored in presets. (Optional setting)<br />\r
-    - Built-in Presets now automatically update when a change is detected.<br />\r
-    - Preset XML data files are now stored in the users application data folder which allows for each system account user can have their own presets.<br />\r
-    - Users can "update" their own presets. (Rather than delete & re-create)<br />\r
-    - Improved control over how logs are stored. Logs are now kept in the Application data folder for each user. <br />\r
-    - The Main window and the Queue "Start/Stop" buttons are now linked. Start on the main window starts the Queue. They are no longer separate.<br />\r
-\r
-    <h4>Minor Improvements / Changes</h4>\r
-    - Resizable queue Window<br />\r
-    - Scanning a source no longer uses a separate popup window. Scanning simply disables the main window, and displays the status much like the MacGUI<br />\r
-    - Queue recovery now uses an XML file.<br />\r
-    - Improvements in the Main Window.<br />\r
-       <p style="padding-left:20px; margin:0px;">\r
-               * Source text box no longer editable. Prevents users changing the source without a rescan.<br />\r
-           * Minor changes in the Destination Browse dialog to improve usability.<br />\r
-           * Design improvements. Removed smaller fonts where possible. Fixed a few design inconsistencies.<br />\r
-           * Warn before stopping a job. Cleanly exits the CLI.<br />\r
-           * Selecting a preset which is already selected, will reset all settings to that preset.<br />\r
-           * Option to hide query editor tab.<br />\r
-           * File overwrite alert for destination files<br />\r
-        </p>\r
-    - "Open Individual log file directory" option added to right click menu for Activity log window.<br />\r
-    - Faster reloading of the activity log window log files.<br />\r
-    - Ability to "Re-Add" the currently encoding job back onto the end of the queue (Allows cancellation of job for future encoding)<br />\r
-    - Removed RAM limitation on start-up. Seems next to no-one is trying to run this on Windows 95 anymore.<br />\r
-    - CLI status can now be displayed in-GUI instead of the CLI readout. (Experimental)<br />\r
-    - Misc Typo's<br />\r
-\r
-    <h4>Fixed</h4>\r
-    - Source and Destination fields unpopulated on queue in certain conditions.<br />\r
-    - Several bugs in the way x264 widgets are handled with custom x264 strings.<br />\r
-    - Fixed a null pointer exception after scan if all presets had been deleted.<br />\r
-    - Fixed a few issues with the Chapter Markers tab<br />\r
-    - Fixed HandBrake GUI would Hang if the CLI stopped responding during start-up. Automatically recovers after 10 second time limit.<br />\r
-    - Universal input. (AAC Decoding in Mp4 files, Some WMV files)<br />\r
-    - Many other fixes<br />\r
-</body>\r
-</html>\r
index 73b28f3..a56daa3 100644 (file)
@@ -5,15 +5,23 @@
           It may be used under the terms of the GNU General Public License. */\r
 \r
 using System;\r
+using System.Collections;\r
 using System.Linq;\r
 using System.Windows.Forms;\r
+using Handbrake.Model;\r
 \r
 namespace Handbrake.Controls\r
 {\r
     public partial class AudioPanel : UserControl\r
     {\r
+        /// <summary>\r
+        /// The audio list has changed\r
+        /// </summary>\r
         public event EventHandler AudioListChanged;\r
 \r
+        /// <summary>\r
+        /// Create a new instance of the Audio Panel\r
+        /// </summary>\r
         public AudioPanel()\r
         {\r
             InitializeComponent();\r
@@ -21,6 +29,89 @@ namespace Handbrake.Controls
             drp_audioSample.SelectedIndex = 1;\r
         }\r
 \r
+        /// <summary>\r
+        /// Get the audio panel\r
+        /// </summary>\r
+        /// <returns>A listview containing the audio tracks</returns>\r
+        public ListView GetAudioPanel()\r
+        {\r
+            return lv_audioList;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Set the File Container. This funciton is used to limit the available options for each file container.\r
+        /// </summary>\r
+        /// <param name="path"></param>\r
+        public void SetContainer(String path)\r
+        {\r
+            string oldval = drp_audioEncoder.Text;\r
+            if ((path.Contains("MP4")) || (path.Contains("M4V")))\r
+            {\r
+                drp_audioEncoder.Items.Clear();\r
+                drp_audioEncoder.Items.Add("AAC (faac)");\r
+                drp_audioEncoder.Items.Add("AC3 Passthru");\r
+                if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru"))\r
+                    drp_audioEncoder.SelectedIndex = 0;\r
+                else\r
+                    drp_audioEncoder.SelectedItem = oldval;\r
+\r
+            }\r
+            else if (path.Contains("MKV"))\r
+            {\r
+                drp_audioEncoder.Items.Clear();\r
+                drp_audioEncoder.Items.Add("AAC (faac)");\r
+                drp_audioEncoder.Items.Add("MP3 (lame)");\r
+                drp_audioEncoder.Items.Add("AC3 Passthru");\r
+                drp_audioEncoder.Items.Add("DTS Passthru");\r
+                drp_audioEncoder.Items.Add("Vorbis (vorbis)");\r
+                drp_audioEncoder.SelectedItem = oldval;\r
+\r
+                if (drp_audioEncoder.Text == string.Empty)\r
+                    drp_audioEncoder.SelectedIndex = 0;\r
+            }\r
+\r
+            // Make sure the table is updated with new audio codecs\r
+            foreach (ListViewItem row in lv_audioList.Items)\r
+            {\r
+                if (!drp_audioEncoder.Items.Contains(row.SubItems[2].Text))\r
+                    row.SubItems[2].Text = drp_audioEncoder.Items[0].ToString();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Checks if the settings used required the .m4v (rather than .mp4) extension\r
+        /// </summary>\r
+        /// <returns></returns>\r
+        public Boolean RequiresM4V()\r
+        {\r
+            return lv_audioList.Items.Cast<ListViewItem>().Any(item => item.SubItems[2].Text.Contains("AC3"));\r
+        }\r
+\r
+        /// <summary>\r
+        /// Load an arraylist of AudioTrack items into the list.\r
+        /// </summary>\r
+        /// <param name="audioTracks"></param>\r
+        public void LoadTracks(ArrayList audioTracks)\r
+        {\r
+            ClearAudioList();\r
+\r
+            if (audioTracks == null)\r
+                return;\r
+\r
+            foreach (AudioTrack track in audioTracks)\r
+            {\r
+                ListViewItem newTrack = new ListViewItem(GetNewID().ToString());\r
+\r
+                newTrack.SubItems.Add("Automatic");\r
+                newTrack.SubItems.Add(track.Encoder);\r
+                newTrack.SubItems.Add(track.MixDown);\r
+                newTrack.SubItems.Add(track.SampleRate);\r
+                newTrack.SubItems.Add(track.Encoder.Contains("AC3") ? "Auto" : track.Bitrate);\r
+                newTrack.SubItems.Add(track.DRC);\r
+                AddTrackForPreset(newTrack);\r
+            }\r
+        }\r
+\r
         // Control and ListView\r
         private void controlChanged(object sender, EventArgs e)\r
         {\r
@@ -197,67 +288,22 @@ namespace Handbrake.Controls
             }\r
             drp_audioMix.SelectedIndex = 0;\r
         }\r
-        public ListView GetAudioPanel()\r
-        {\r
-            return lv_audioList;\r
-        }\r
-        public void SetContainer(String path)\r
-        {\r
-            string oldval = drp_audioEncoder.Text;\r
-            if ((path.Contains("MP4")) || (path.Contains("M4V")))\r
-            {\r
-                drp_audioEncoder.Items.Clear();\r
-                drp_audioEncoder.Items.Add("AAC (faac)");\r
-                drp_audioEncoder.Items.Add("AC3 Passthru");\r
-                if ((oldval != "AAC (faac)") && (oldval != "AC3 Passthru"))\r
-                    drp_audioEncoder.SelectedIndex = 0;\r
-                else\r
-                    drp_audioEncoder.SelectedItem = oldval;\r
-\r
-            }\r
-            else if (path.Contains("MKV"))\r
-            {\r
-                drp_audioEncoder.Items.Clear();\r
-                drp_audioEncoder.Items.Add("AAC (faac)");\r
-                drp_audioEncoder.Items.Add("MP3 (lame)");\r
-                drp_audioEncoder.Items.Add("AC3 Passthru");\r
-                drp_audioEncoder.Items.Add("DTS Passthru");\r
-                drp_audioEncoder.Items.Add("Vorbis (vorbis)");\r
-                drp_audioEncoder.SelectedItem = oldval;\r
-\r
-                if (drp_audioEncoder.Text == string.Empty)\r
-                    drp_audioEncoder.SelectedIndex = 0;\r
-            }\r
-\r
-            // Make sure the table is updated with new audio codecs\r
-            foreach (ListViewItem row in lv_audioList.Items)\r
-            {\r
-                if (!drp_audioEncoder.Items.Contains(row.SubItems[2].Text))\r
-                    row.SubItems[2].Text = drp_audioEncoder.Items[0].ToString();\r
-            }\r
-        }\r
-        public void AddTrackForPreset(ListViewItem item)\r
+        private void AddTrackForPreset(ListViewItem item)\r
         {\r
             lv_audioList.Items.Add(item);\r
             if (this.AudioListChanged != null)\r
                 this.AudioListChanged(this, new EventArgs());\r
         }\r
-        public void ClearAudioList()\r
+        private void ClearAudioList()\r
         {\r
             lv_audioList.Items.Clear();\r
             if (this.AudioListChanged != null)\r
                 this.AudioListChanged(this, new EventArgs());\r
         }\r
-        public int GetNewID()\r
+        private int GetNewID()\r
         {\r
             return lv_audioList.Items.Count + 1;\r
         }\r
-        public Boolean RequiresM4V()\r
-        {\r
-            return lv_audioList.Items.Cast<ListViewItem>().Any(item => item.SubItems[2].Text.Contains("AC3"));\r
-        }\r
-\r
-        // Helper Functions \r
         private void RemoveTrack()\r
         {\r
             // Remove the Item and reselect the control if the following conditions are met.\r
@@ -303,7 +349,6 @@ namespace Handbrake.Controls
                 lv_audioList.Focus();\r
             }\r
         }\r
-\r
         private void ReGenerateListIDs()\r
         {\r
             int i = 1;\r
index 6e66f49..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
@@ -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
index f42e734..a653f96 100644 (file)
@@ -213,22 +213,7 @@ namespace Handbrake.Functions
             #endregion\r
 \r
             #region Audio\r
-            // Clear the audio listing\r
-            mainWindow.AudioSettings.ClearAudioList();\r
-\r
-            if (presetQuery.AudioInformation != null)\r
-                foreach (AudioTrack track in presetQuery.AudioInformation)\r
-                {\r
-                    ListViewItem newTrack = new ListViewItem(mainWindow.AudioSettings.GetNewID().ToString());\r
-\r
-                    newTrack.SubItems.Add("Automatic");\r
-                    newTrack.SubItems.Add(track.Encoder);\r
-                    newTrack.SubItems.Add(track.MixDown);\r
-                    newTrack.SubItems.Add(track.SampleRate);\r
-                    newTrack.SubItems.Add(track.Encoder.Contains("AC3") ? "Auto" : track.Bitrate);\r
-                    newTrack.SubItems.Add(track.DRC);\r
-                    mainWindow.AudioSettings.AddTrackForPreset(newTrack);\r
-                }\r
+            mainWindow.AudioSettings.LoadTracks(presetQuery.AudioInformation);\r
             #endregion\r
 \r
             #region Other\r
index f322236..70aaa81 100644 (file)
       <DependentUpon>frmActivityWindow.cs</DependentUpon>\r
     </Compile>\r
     <Compile Include="Model\AudioTrack.cs" />\r
-    <Compile Include="Presets\Export.cs" />\r
+    <Compile Include="Model\DriveInformation.cs" />\r
     <Compile Include="Presets\PlistPresetHandler.cs" />\r
-    <Compile Include="Presets\preset.cs" />\r
+    <Compile Include="Presets\Preset.cs" />\r
     <Compile Include="Presets\PresetsHandler.cs" />\r
     <Compile Include="EncodeQueue\Queue.cs" />\r
     <Compile Include="Functions\AppcastReader.cs" />\r
     <Compile Include="EncodeQueue\Job.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <Content Include="Changelog.html" />\r
     <Content Include="handbrakepineapple.ico" />\r
     <None Include="Resources\logo64.png" />\r
     <None Include="Resources\logo128.png" />\r
diff --git a/win/C#/Model/DriveInformation.cs b/win/C#/Model/DriveInformation.cs
new file mode 100644 (file)
index 0000000..9367e7e
--- /dev/null
@@ -0,0 +1,21 @@
+/*  DriveInformation.cs $\r
+       \r
+          This file is part of the HandBrake source code.\r
+          Homepage: <http://handbrake.fr>.\r
+          It may be used under the terms of the GNU General Public License. */\r
+\r
+namespace Handbrake.Model\r
+{\r
+    public class DriveInformation\r
+    {\r
+        /// <summary>\r
+        /// The Drive Volume Name\r
+        /// </summary>\r
+        public string VolumeLabel { get; set; }\r
+\r
+        /// <summary>\r
+        /// The Root Directory\r
+        /// </summary>\r
+        public string RootDirectory { get; set; }\r
+    }\r
+}\r
diff --git a/win/C#/Model/SourceType.cs b/win/C#/Model/SourceType.cs
new file mode 100644 (file)
index 0000000..c5a1bf4
--- /dev/null
@@ -0,0 +1,31 @@
+/*  SourceType.cs $\r
+       \r
+          This file is part of the HandBrake source code.\r
+          Homepage: <http://handbrake.fr>.\r
+          It may be used under the terms of the GNU General Public License. */\r
+\r
+namespace Handbrake.Model\r
+{\r
+    public enum SourceType\r
+    {\r
+        /// <summary>\r
+        /// No Source Selected\r
+        /// </summary>\r
+        None = 0,\r
+\r
+        /// <summary>\r
+        /// The soruce selected is a folder\r
+        /// </summary>\r
+        Folder,\r
+\r
+        /// <summary>\r
+        /// The source selected is a DVD drive\r
+        /// </summary>\r
+        DvdDrive,\r
+\r
+        /// <summary>\r
+        /// The source selected is a Video File\r
+        /// </summary>\r
+        VideoFile\r
+    }\r
+}\r
index 103c28e..4b2ddb7 100644 (file)
@@ -14,6 +14,7 @@ using System.Diagnostics;
 using System.Threading;\r
 using Handbrake.EncodeQueue;\r
 using Handbrake.Functions;\r
+using Handbrake.Model;\r
 using Handbrake.Presets;\r
 using Handbrake.Parsing;\r
 \r
@@ -92,7 +93,7 @@ namespace Handbrake
             // Setup the GUI components\r
             lblStatus.Text = "Setting up the GUI ...";\r
             Application.DoEvents();\r
-            loadPresetPanel();                       // Load the Preset Panel\r
+            LoadPresetPanel();                       // Load the Preset Panel\r
             treeView_presets.ExpandAll();\r
             lbl_encode.Text = "";\r
             drop_mode.SelectedIndex = 0;\r
@@ -221,7 +222,7 @@ namespace Handbrake
                 this.Resize += new EventHandler(frmMain_Resize);\r
 \r
             // Handle Encode Start / Finish / Pause\r
-            \r
+\r
             encodeQueue.QueuePauseRequested += new EventHandler(encodePaused);\r
             encodeQueue.EncodeStarted += new EventHandler(encodeStarted);\r
             encodeQueue.EncodeEnded += new EventHandler(encodeEnded);\r
@@ -320,22 +321,22 @@ namespace Handbrake
         private void encodeStarted(object sender, EventArgs e)\r
         {\r
             lastAction = "encode";\r
-            setEncodeStarted();\r
+            SetEncodeStarted();\r
 \r
             // Experimental HBProc Process Monitoring.\r
             if (Properties.Settings.Default.enocdeStatusInGui)\r
             {\r
-                Thread encodeMon = new Thread(encodeMonitorThread);\r
+                Thread encodeMon = new Thread(EncodeMonitorThread);\r
                 encodeMon.Start();\r
             }\r
         }\r
         private void encodeEnded(object sender, EventArgs e)\r
         {\r
-            setEncodeFinished();\r
+            SetEncodeFinished();\r
         }\r
         private void encodePaused(object sender, EventArgs e)\r
         {\r
-            setEncodeFinished();\r
+            SetEncodeFinished();\r
         }\r
         #endregion\r
 \r
@@ -373,7 +374,7 @@ namespace Handbrake
         private void mnu_presetReset_Click(object sender, EventArgs e)\r
         {\r
             presetHandler.UpdateBuiltInPresets();\r
-            loadPresetPanel();\r
+            LoadPresetPanel();\r
             if (treeView_presets.Nodes.Count == 0)\r
                 MessageBox.Show("Unable to load the presets.xml file. Please select \"Update Built-in Presets\" from the Presets Menu. \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             else\r
@@ -384,7 +385,7 @@ namespace Handbrake
         private void mnu_delete_preset_Click(object sender, EventArgs e)\r
         {\r
             presetHandler.RemoveBuiltInPresets();\r
-            loadPresetPanel(); // Reload the preset panel\r
+            LoadPresetPanel(); // Reload the preset panel\r
         }\r
         private void mnu_SelectDefault_Click(object sender, EventArgs e)\r
         {\r
@@ -567,7 +568,7 @@ namespace Handbrake
                         nodeStatus.Add(node.IsExpanded);\r
 \r
                     // Now reload the preset panel\r
-                    loadPresetPanel();\r
+                    LoadPresetPanel();\r
 \r
                     // And finally, re-expand any of the nodes if required\r
                     int i = 0;\r
@@ -661,7 +662,7 @@ namespace Handbrake
         private void btn_source_Click(object sender, EventArgs e)\r
         {\r
             mnu_dvd_drive.Visible = true;\r
-            Thread driveInfoThread = new Thread(getDriveInfoThread);\r
+            Thread driveInfoThread = new Thread(SetDriveSelectionMenuItem);\r
             driveInfoThread.Start();\r
         }\r
         private void btn_start_Click(object sender, EventArgs e)\r
@@ -698,7 +699,7 @@ namespace Handbrake
                     }\r
 \r
                     // Update the GUI\r
-                    setEncodeFinished();\r
+                    SetEncodeFinished();\r
                 }\r
             }\r
             else\r
@@ -756,7 +757,7 @@ namespace Handbrake
                         if (encodeQueue.Count > 1)\r
                             queueWindow.Show(false);\r
 \r
-                        setEncodeStarted(); // Encode is running, so setup the GUI appropriately\r
+                        SetEncodeStarted(); // Encode is running, so setup the GUI appropriately\r
                         encodeQueue.Start(); // Start The Queue Encoding Process\r
                         lastAction = "encode";   // Set the last action to encode - Used for activity window.\r
                     }\r
@@ -1698,17 +1699,17 @@ namespace Handbrake
         }\r
         #endregion\r
 \r
-        #region GUI\r
+        #region GUI Functions and Actions\r
         /// <summary>\r
         /// Set the GUI to it's finished encoding state.\r
         /// </summary>\r
-        private void setEncodeFinished()\r
+        private void SetEncodeFinished()\r
         {\r
             try\r
             {\r
                 if (InvokeRequired)\r
                 {\r
-                    BeginInvoke(new UpdateWindowHandler(setEncodeFinished));\r
+                    BeginInvoke(new UpdateWindowHandler(SetEncodeFinished));\r
                     return;\r
                 }\r
 \r
@@ -1734,13 +1735,13 @@ namespace Handbrake
         /// <summary>\r
         /// Set the GUI to it's started encoding state.\r
         /// </summary>\r
-        private void setEncodeStarted()\r
+        private void SetEncodeStarted()\r
         {\r
             try\r
             {\r
                 if (InvokeRequired)\r
                 {\r
-                    BeginInvoke(new UpdateWindowHandler(setEncodeStarted));\r
+                    BeginInvoke(new UpdateWindowHandler(SetEncodeStarted));\r
                     return;\r
                 }\r
 \r
@@ -1755,51 +1756,42 @@ namespace Handbrake
                 MessageBox.Show(exc.ToString());\r
             }\r
         }\r
-        #endregion\r
 \r
-        #region DVD Drive Detection\r
-        private void getDriveInfoThread()\r
+        /// <summary>\r
+        /// Set the DVD Drive selection in the "Source" Menu\r
+        /// </summary>\r
+        private void SetDriveSelectionMenuItem()\r
         {\r
             try\r
             {\r
                 if (InvokeRequired)\r
                 {\r
-                    BeginInvoke(new UpdateWindowHandler(getDriveInfoThread));\r
+                    BeginInvoke(new UpdateWindowHandler(SetDriveSelectionMenuItem));\r
                     return;\r
                 }\r
 \r
-                Boolean foundDrive = false;\r
-                DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();\r
-                foreach (DriveInfo curDrive in theCollectionOfDrives)\r
+                List<DriveInformation> drives = Main.GetDrives();\r
+\r
+                if (drives.Count == 0)\r
                 {\r
-                    if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady)\r
-                    {\r
-                        if (File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))\r
-                        {\r
-                            this.dvdDrivePath = curDrive.RootDirectory + "VIDEO_TS";\r
-                            this.dvdDriveLabel = curDrive.VolumeLabel;\r
-                            mnu_dvd_drive.Text = this.dvdDrivePath + " (" + this.dvdDriveLabel + ")";\r
-                            foundDrive = true;\r
-                            break;\r
-                        }\r
-                    }\r
+                    mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
+                    return;\r
                 }\r
 \r
-                if (foundDrive == false)\r
-                    mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
+                this.dvdDrivePath = drives[0].RootDirectory + "VIDEO_TS";\r
+                this.dvdDriveLabel = drives[0].VolumeLabel;\r
+                mnu_dvd_drive.Text = this.dvdDrivePath + " (" + this.dvdDriveLabel + ")";\r
             }\r
             catch (Exception)\r
             {\r
                 mnu_dvd_drive.Text = "[No DVD Drive Ready / Found]";\r
             }\r
         }\r
-        #endregion\r
 \r
-        #region Public Methods\r
         /// <summary>\r
         /// Access the preset Handler and setup the preset panel.\r
         /// </summary>\r
-        public void loadPresetPanel()\r
+        private void LoadPresetPanel()\r
         {\r
             if (presetHandler.CheckIfPresetsAreOutOfDate())\r
                 if (!Properties.Settings.Default.presetNotification)\r
@@ -1855,12 +1847,15 @@ namespace Handbrake
         #endregion\r
 \r
         #region In-GUI Encode Status (Experimental)\r
-        private void encodeMonitorThread()\r
+        /// <summary>\r
+        /// Starts a new thread to monitor and process the CLI encode status\r
+        /// </summary>\r
+        private void EncodeMonitorThread()\r
         {\r
             try\r
             {\r
                 Parser encode = new Parser(encodeQueue.HbProcess.StandardOutput.BaseStream);\r
-                encode.OnEncodeProgress += encodeOnEncodeProgress;\r
+                encode.OnEncodeProgress += EncodeOnEncodeProgress;\r
                 while (!encode.EndOfStream)\r
                     encode.readEncodeStatus();\r
             }\r
@@ -1869,11 +1864,22 @@ namespace Handbrake
                 MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             }\r
         }\r
-        private void encodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r
+        \r
+        /// <summary>\r
+        /// Displays the Encode status in the GUI\r
+        /// </summary>\r
+        /// <param name="Sender"></param>\r
+        /// <param name="CurrentTask"></param>\r
+        /// <param name="TaskCount"></param>\r
+        /// <param name="PercentComplete"></param>\r
+        /// <param name="CurrentFps"></param>\r
+        /// <param name="AverageFps"></param>\r
+        /// <param name="TimeRemaining"></param>\r
+        private void EncodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r
         {\r
             if (this.InvokeRequired)\r
             {\r
-                this.BeginInvoke(new EncodeProgressEventHandler(encodeOnEncodeProgress),\r
+                this.BeginInvoke(new EncodeProgressEventHandler(EncodeOnEncodeProgress),\r
                     new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });\r
                 return;\r
             }\r
@@ -1881,16 +1887,6 @@ namespace Handbrake
         }\r
         #endregion\r
 \r
-        #region enum\r
-        private enum SourceType\r
-        {\r
-            None = 0,\r
-            Folder,\r
-            DvdDrive,\r
-            VideoFile\r
-        }\r
-        #endregion\r
-\r
         // This is the END of the road ****************************************\r
     }\r
 }
\ No newline at end of file