OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 23 Jul 2009 20:10:29 +0000 (20:10 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 23 Jul 2009 20:10:29 +0000 (20:10 +0000)
- getCliProcess(): This is now massively faster at returning the process ID of HandBrakeCLI. This means that the GUI updates it's elements far faster instead of the noticeable few seconds pause when an encode starts. This also fixes an error message that would appear if the CLI process quit before the GUI was setup.
- Code re factoring in Main.cs. Reduced the amount of code needed for a few functions.
- Combined the Encode and Queue handler. This just makes things a bit easier when other parts of the GUI need the encode process info. The new CLI handling code is not in yet.
- Added the CLI build environment to the About window

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

13 files changed:
win/C#/EncodeQueue/Encode.cs [deleted file]
win/C#/EncodeQueue/EncodeAndQueueHandler.cs [moved from win/C#/EncodeQueue/QueueHandler.cs with 54% similarity]
win/C#/Functions/Main.cs
win/C#/HandBrakeCS.csproj
win/C#/Properties/Settings.Designer.cs
win/C#/Properties/Settings.settings
win/C#/app.config
win/C#/frmAbout.Designer.cs
win/C#/frmAbout.cs
win/C#/frmActivityWindow.cs
win/C#/frmMain.cs
win/C#/frmPreview.cs
win/C#/frmQueue.cs

diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs
deleted file mode 100644 (file)
index 83ebc98..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*  Encode.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
-using System;\r
-using System.Diagnostics;\r
-using System.Windows.Forms;\r
-using System.IO;\r
-using Handbrake.Functions;\r
-\r
-namespace Handbrake.EncodeQueue\r
-{\r
-    public class Encode\r
-    {\r
-        public Process hbProcess { get; set; }\r
-        public int processID { get; set; }\r
-        public IntPtr processHandle { get; set; }\r
-        public Boolean isEncoding { get; set; }\r
-        public String currentQuery { get; set; }\r
-\r
-        /// <summary>\r
-        /// Execute a HandBrakeCLI process.\r
-        /// </summary>\r
-        /// <param name="query">The CLI Query</param>\r
-        public void runCli(string query)\r
-        {\r
-            try\r
-            {\r
-                string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
-                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
-                string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
-                string strCmdLine = String.Format(@" CMD /c """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, query, logPath);\r
-\r
-                ProcessStartInfo cliStart = new ProcessStartInfo("CMD.exe", strCmdLine);\r
-                if (Properties.Settings.Default.enocdeStatusInGui)\r
-                {\r
-                    cliStart.RedirectStandardOutput = true;\r
-                    cliStart.UseShellExecute = false;\r
-                }\r
-                if (Properties.Settings.Default.cli_minimized)\r
-                    cliStart.WindowStyle = ProcessWindowStyle.Minimized;\r
-\r
-                Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
-                hbProcess = Process.Start(cliStart);\r
-                processID = Main.getCliProcess(before);\r
-                isEncoding = true;\r
-                currentQuery = query;\r
-                if (hbProcess != null)\r
-                    processHandle = hbProcess.MainWindowHandle; // Set the process Handle\r
-\r
-                // Set the process Priority\r
-                Process hbCliProcess = null;\r
-                if (processID != -1)\r
-                    hbCliProcess = Process.GetProcessById(processID);\r
-\r
-                if (hbCliProcess != null)\r
-                    switch (Properties.Settings.Default.processPriority)\r
-                    {\r
-                        case "Realtime":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
-                            break;\r
-                        case "High":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.High;\r
-                            break;\r
-                        case "Above Normal":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.AboveNormal;\r
-                            break;\r
-                        case "Normal":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.Normal;\r
-                            break;\r
-                        case "Low":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.Idle;\r
-                            break;\r
-                        default:\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.BelowNormal;\r
-                            break;\r
-                    }\r
-            }\r
-            catch (Exception exc)\r
-            {\r
-                MessageBox.Show("It would appear that HandBrakeCLI has not started correctly. You should take a look at the Activity log as it may indicate the reason why.\n\n   Detailed Error Information: error occured in runCli()\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
-            }\r
-\r
-        }\r
-\r
-        /// <summary>\r
-        /// Kill the CLI process\r
-        /// </summary>\r
-        public void closeCLI()\r
-        {\r
-            hbProcess.Kill();\r
-        }\r
-\r
-        /// <summary>\r
-        /// Perform an action after an encode. e.g a shutdown, standby, restart etc.\r
-        /// </summary>\r
-        public void afterEncodeAction()\r
-        {\r
-            isEncoding = false;\r
-            currentQuery = String.Empty;\r
-            // Do something whent he encode ends.\r
-            switch (Properties.Settings.Default.CompletionOption)\r
-            {\r
-                case "Shutdown":\r
-                    Process.Start("Shutdown", "-s -t 60");\r
-                    break;\r
-                case "Log Off":\r
-                    Win32.ExitWindowsEx(0, 0);\r
-                    break;\r
-                case "Suspend":\r
-                    Application.SetSuspendState(PowerState.Suspend, true, true);\r
-                    break;\r
-                case "Hibernate":\r
-                    Application.SetSuspendState(PowerState.Hibernate, true, true);\r
-                    break;\r
-                case "Lock System":\r
-                    Win32.LockWorkStation();\r
-                    break;\r
-                case "Quit HandBrake":\r
-                    Application.Exit();\r
-                    break;\r
-                default:\r
-                    break;\r
-            }\r
-        }\r
-\r
-        /// <summar>\r
-        /// Append the CLI query to the start of the log file.\r
-        /// </summary>\r
-        /// <param name="query"></param>\r
-        public void addCLIQueryToLog(string query)\r
-        {\r
-            string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
-            string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
-\r
-            StreamReader reader = new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));\r
-            String log = reader.ReadToEnd();\r
-            reader.Close();\r
-\r
-            StreamWriter writer = new StreamWriter(File.Create(logPath));\r
-\r
-            writer.Write("### CLI Query: " + query + "\n\n");\r
-            writer.Write("#########################################\n\n");\r
-            writer.WriteLine(log);\r
-            writer.Flush();\r
-            writer.Close();\r
-        }\r
-\r
-        /// <summary>\r
-        /// Save a copy of the log to the users desired location or a default location\r
-        /// if this feature is enabled in options.\r
-        /// </summary>\r
-        /// <param name="destination"></param>\r
-        public void copyLog(string destination)\r
-        {\r
-            try\r
-            {\r
-                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
-                string tempLogFile = Path.Combine(logDir, "last_encode_log.txt");\r
-\r
-                string encodeDestinationPath = Path.GetDirectoryName(destination);\r
-                String destinationFile = Path.GetFileName(destination);\r
-                string encodeLogFile = destinationFile + " " + DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + ".txt";\r
-\r
-                // Make sure the log directory exists.\r
-                if (!Directory.Exists(logDir))\r
-                    Directory.CreateDirectory(logDir);\r
-\r
-                // Copy the Log to HandBrakes log folder in the users applciation data folder.\r
-                File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));\r
-\r
-                // Save a copy of the log file in the same location as the enocde.\r
-                if (Properties.Settings.Default.saveLogWithVideo)\r
-                    File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));\r
-\r
-                // Save a copy of the log file to a user specified location\r
-                if (Directory.Exists(Properties.Settings.Default.saveLogPath))\r
-                    if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath)\r
-                        File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile));\r
-            }\r
-            catch (Exception exc)\r
-            {\r
-                MessageBox.Show("Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc, "Error",\r
-                                MessageBoxButtons.OK, MessageBoxIcon.Error);\r
-            }\r
-        }\r
-\r
-    }\r
-}
\ No newline at end of file
similarity index 54%
rename from win/C#/EncodeQueue/QueueHandler.cs
rename to win/C#/EncodeQueue/EncodeAndQueueHandler.cs
index d183af0..09d1f14 100644 (file)
@@ -7,45 +7,22 @@
 using System;\r
 using System.Collections.Generic;\r
 using System.Collections.ObjectModel;\r
+using System.Diagnostics;\r
 using System.IO;\r
 using System.Threading;\r
 using System.Windows.Forms;\r
 using System.Xml.Serialization;\r
+using Handbrake.Functions;\r
 \r
 namespace Handbrake.EncodeQueue\r
 {\r
-    /// <summary>\r
-    /// Provides a handler for encoding jobs and a queue of those jobs.\r
-    /// </summary>\r
-    public class QueueHandler\r
+    public class EncodeAndQueueHandler\r
     {\r
-        public Encode encodeHandler = new Encode();\r
         private static XmlSerializer serializer = new XmlSerializer(typeof(List<Job>));\r
         private List<Job> queue = new List<Job>();\r
         private int nextJobId;\r
 \r
-        /// <summary>\r
-        /// Gets the number of items in the queue.\r
-        /// </summary>\r
-        public int Count\r
-        {\r
-            get { return queue.Count; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets the last encode that was processed.\r
-        /// </summary>\r
-        /// <returns></returns>\r
-        public Job LastEncode { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets the current state of the encode queue.\r
-        /// </summary>\r
-        public ReadOnlyCollection<Job> CurrentQueue\r
-        {\r
-            get { return queue.AsReadOnly(); }\r
-        }\r
-\r
+        #region Event Handlers\r
         /// <summary>\r
         /// Fires when an encode job has been started.\r
         /// </summary>\r
@@ -65,9 +42,9 @@ namespace Handbrake.EncodeQueue
         /// Fires when the entire encode queue has completed.\r
         /// </summary>\r
         public event EventHandler QueueCompleted;\r
+        #endregion\r
 \r
-        #region Queue Handling\r
-\r
+        #region Queue\r
         /// <summary>\r
         /// Gets and removes the next job in the queue.\r
         /// </summary>\r
@@ -84,6 +61,23 @@ namespace Handbrake.EncodeQueue
         }\r
 \r
         /// <summary>\r
+        /// Gets the current state of the encode queue.\r
+        /// </summary>\r
+        public ReadOnlyCollection<Job> CurrentQueue\r
+        {\r
+            get { return queue.AsReadOnly(); }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Gets the number of items in the queue.\r
+        /// </summary>\r
+        public int Count\r
+        {\r
+            get { return queue.Count; }\r
+        }\r
+\r
+\r
+        /// <summary>\r
         /// Adds an item to the queue.\r
         /// </summary>\r
         /// <param name="query">The query that will be passed to the HandBrake CLI.</param>\r
@@ -252,15 +246,23 @@ namespace Handbrake.EncodeQueue
 \r
         #region Encoding\r
 \r
-        public bool PauseRequested { get; private set; }\r
-        public bool IsEncoding { get; private set; }\r
+        /// <summary>\r
+        /// Gets the last encode that was processed.\r
+        /// </summary>\r
+        /// <returns></returns> \r
+        public Job LastEncode { get; set; }\r
+\r
+        /// <summary>\r
+        /// Request Pause\r
+        /// </summary>\r
+        public Boolean PauseRequested { get; private set; }\r
 \r
         /// <summary>\r
         /// Starts encoding the first job in the queue and continues encoding until all jobs\r
         /// have been encoded.\r
         /// </summary>\r
         public void StartEncodeQueue()\r
-        { \r
+        {\r
             if (this.Count != 0)\r
             {\r
                 if (PauseRequested)\r
@@ -297,7 +299,7 @@ namespace Handbrake.EncodeQueue
         /// </summary>\r
         public void EndEncodeJob()\r
         {\r
-            encodeHandler.closeCLI();\r
+            closeCLI();\r
         }\r
 \r
         private void startProcess(object state)\r
@@ -308,18 +310,20 @@ namespace Handbrake.EncodeQueue
                 string query = GetNextJob().Query;\r
                 WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
 \r
-                encodeHandler.runCli(query);\r
+                runCli(query);\r
 \r
                 if (NewJobStarted != null)\r
                     NewJobStarted(this, new EventArgs());\r
 \r
-                encodeHandler.hbProcess.WaitForExit();\r
+                hbProcess.WaitForExit();\r
 \r
-                encodeHandler.addCLIQueryToLog(query);\r
-                encodeHandler.copyLog(LastEncode.Destination);\r
+                addCLIQueryToLog(query);\r
+                copyLog(LastEncode.Destination);\r
 \r
-                encodeHandler.hbProcess.Close();\r
-                encodeHandler.hbProcess.Dispose();\r
+                hbProcess.Close();\r
+                hbProcess.Dispose();\r
+\r
+                isEncoding = false;\r
 \r
                 if (CurrentJobCompleted != null)\r
                     CurrentJobCompleted(this, new EventArgs());\r
@@ -334,9 +338,184 @@ namespace Handbrake.EncodeQueue
                 QueueCompleted(this, new EventArgs());\r
 \r
             // After the encode is done, we may want to shutdown, suspend etc.\r
-            encodeHandler.afterEncodeAction();\r
+            afterEncodeAction();\r
         }\r
 \r
         #endregion\r
+\r
+        #region CLI and Log Handling\r
+        public Process hbProcess { get; set; }\r
+        public int processID { get; set; }\r
+        public IntPtr processHandle { get; set; }\r
+        public String currentQuery { get; set; }\r
+        public Boolean isEncoding { get; set; }\r
+\r
+        /// <summary>\r
+        /// Execute a HandBrakeCLI process.\r
+        /// </summary>\r
+        /// <param name="query">The CLI Query</param>\r
+        public void runCli(string query)\r
+        {\r
+            try\r
+            {\r
+                string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
+                string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs", "last_encode_log.txt");\r
+                string strCmdLine = String.Format(@" /C """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, query, logPath);\r
+                ProcessStartInfo cliStart = new ProcessStartInfo("CMD.exe", strCmdLine);\r
+\r
+                if (Properties.Settings.Default.enocdeStatusInGui)\r
+                {\r
+                    cliStart.RedirectStandardOutput = true;\r
+                    cliStart.UseShellExecute = false;\r
+                }\r
+                if (Properties.Settings.Default.cli_minimized)\r
+                    cliStart.WindowStyle = ProcessWindowStyle.Minimized;\r
+\r
+                Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
+                hbProcess = Process.Start(cliStart);\r
+                processID = Main.getCliProcess(before);\r
+                isEncoding = true;\r
+                currentQuery = query;\r
+                if (hbProcess != null)\r
+                    processHandle = hbProcess.MainWindowHandle; // Set the process Handle\r
+\r
+                // Set the process Priority\r
+                Process hbCliProcess = null;\r
+                if (processID != -1)\r
+                    hbCliProcess = Process.GetProcessById(processID);\r
+\r
+                if (hbCliProcess != null)\r
+                    switch (Properties.Settings.Default.processPriority)\r
+                    {\r
+                        case "Realtime":\r
+                            hbCliProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
+                            break;\r
+                        case "High":\r
+                            hbCliProcess.PriorityClass = ProcessPriorityClass.High;\r
+                            break;\r
+                        case "Above Normal":\r
+                            hbCliProcess.PriorityClass = ProcessPriorityClass.AboveNormal;\r
+                            break;\r
+                        case "Normal":\r
+                            hbCliProcess.PriorityClass = ProcessPriorityClass.Normal;\r
+                            break;\r
+                        case "Low":\r
+                            hbCliProcess.PriorityClass = ProcessPriorityClass.Idle;\r
+                            break;\r
+                        default:\r
+                            hbCliProcess.PriorityClass = ProcessPriorityClass.BelowNormal;\r
+                            break;\r
+                    }\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                MessageBox.Show("It would appear that HandBrakeCLI has not started correctly. You should take a look at the Activity log as it may indicate the reason why.\n\n   Detailed Error Information: error occured in runCli()\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+            }\r
+\r
+        }\r
+\r
+        /// <summary>\r
+        /// Kill the CLI process\r
+        /// </summary>\r
+        public void closeCLI()\r
+        {\r
+            hbProcess.Kill();\r
+            isEncoding = false;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Perform an action after an encode. e.g a shutdown, standby, restart etc.\r
+        /// </summary>\r
+        public void afterEncodeAction()\r
+        {\r
+            isEncoding = false;\r
+            currentQuery = String.Empty;\r
+            // Do something whent he encode ends.\r
+            switch (Properties.Settings.Default.CompletionOption)\r
+            {\r
+                case "Shutdown":\r
+                    Process.Start("Shutdown", "-s -t 60");\r
+                    break;\r
+                case "Log Off":\r
+                    Win32.ExitWindowsEx(0, 0);\r
+                    break;\r
+                case "Suspend":\r
+                    Application.SetSuspendState(PowerState.Suspend, true, true);\r
+                    break;\r
+                case "Hibernate":\r
+                    Application.SetSuspendState(PowerState.Hibernate, true, true);\r
+                    break;\r
+                case "Lock System":\r
+                    Win32.LockWorkStation();\r
+                    break;\r
+                case "Quit HandBrake":\r
+                    Application.Exit();\r
+                    break;\r
+                default:\r
+                    break;\r
+            }\r
+        }\r
+\r
+        /// <summar>\r
+        /// Append the CLI query to the start of the log file.\r
+        /// </summary>\r
+        /// <param name="query"></param>\r
+        public void addCLIQueryToLog(string query)\r
+        {\r
+            string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+            string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
+\r
+            StreamReader reader = new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));\r
+            String log = reader.ReadToEnd();\r
+            reader.Close();\r
+\r
+            StreamWriter writer = new StreamWriter(File.Create(logPath));\r
+\r
+            writer.Write("### CLI Query: " + query + "\n\n");\r
+            writer.Write("#########################################\n\n");\r
+            writer.WriteLine(log);\r
+            writer.Flush();\r
+            writer.Close();\r
+        }\r
+\r
+        /// <summary>\r
+        /// Save a copy of the log to the users desired location or a default location\r
+        /// if this feature is enabled in options.\r
+        /// </summary>\r
+        /// <param name="destination"></param>\r
+        public void copyLog(string destination)\r
+        {\r
+            try\r
+            {\r
+                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+                string tempLogFile = Path.Combine(logDir, "last_encode_log.txt");\r
+\r
+                string encodeDestinationPath = Path.GetDirectoryName(destination);\r
+                String destinationFile = Path.GetFileName(destination);\r
+                string encodeLogFile = destinationFile + " " + DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + ".txt";\r
+\r
+                // Make sure the log directory exists.\r
+                if (!Directory.Exists(logDir))\r
+                    Directory.CreateDirectory(logDir);\r
+\r
+                // Copy the Log to HandBrakes log folder in the users applciation data folder.\r
+                File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));\r
+\r
+                // Save a copy of the log file in the same location as the enocde.\r
+                if (Properties.Settings.Default.saveLogWithVideo)\r
+                    File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));\r
+\r
+                // Save a copy of the log file to a user specified location\r
+                if (Directory.Exists(Properties.Settings.Default.saveLogPath))\r
+                    if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath)\r
+                        File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile));\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                MessageBox.Show("Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc, "Error",\r
+                                MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+            }\r
+        }\r
+        #endregion\r
     }\r
 }
\ No newline at end of file
index 075bdfa..987876e 100644 (file)
@@ -25,122 +25,75 @@ namespace Handbrake.Functions
         /// <summary>\r
         /// Calculate the duration of the selected title and chapters\r
         /// </summary>\r
-        public static TimeSpan calculateDuration(string chapter_start, string chapter_end, Parsing.Title selectedTitle)\r
+        public static TimeSpan calculateDuration(int chapterStart, int chapterEnd, Parsing.Title selectedTitle)\r
         {\r
-            TimeSpan Duration = TimeSpan.FromSeconds(0.0);\r
-\r
-            // Get the durations between the 2 chapter points and add them together.\r
-            if (chapter_start != "Auto" && chapter_end != "Auto")\r
+            TimeSpan duration = TimeSpan.FromSeconds(0.0);\r
+            chapterStart++; chapterEnd++;\r
+            if (chapterStart != 0 && chapterEnd != 0 && chapterEnd <= selectedTitle.Chapters.Count)\r
             {\r
-                int start_chapter, end_chapter;\r
-                int.TryParse(chapter_start, out start_chapter);\r
-                int.TryParse(chapter_end, out end_chapter);\r
-\r
-                int position = start_chapter - 1;\r
-\r
-                if (start_chapter <= end_chapter)\r
-                {\r
-                    if (end_chapter > selectedTitle.Chapters.Count)\r
-                        end_chapter = selectedTitle.Chapters.Count;\r
-\r
-                    while (position != end_chapter)\r
-                    {\r
-                        TimeSpan dur = selectedTitle.Chapters[position].Duration;\r
-                        Duration = Duration + dur;\r
-                        position++;\r
-                    }\r
-                }\r
+                for (int i = chapterStart; i <= chapterEnd; i++)\r
+                    duration += selectedTitle.Chapters[i - 1].Duration;\r
             }\r
-            return Duration;\r
+\r
+            return duration;\r
         }\r
 \r
         /// <summary>\r
         /// Select the longest title in the DVD title dropdown menu on frmMain\r
         /// </summary>\r
-        public static Parsing.Title selectLongestTitle(ComboBox drp_dvdtitle)\r
+        public static Parsing.Title selectLongestTitle(Parsing.DVD thisDvd)\r
         {\r
-            int current_largest = 0;\r
-            Parsing.Title title2Select;\r
-\r
-            // Check if there are titles in the DVD title dropdown menu and make sure, it's not just "Automatic"\r
-            if (drp_dvdtitle.Items[0].ToString() != "Automatic")\r
-                title2Select = (Parsing.Title)drp_dvdtitle.Items[0];\r
-            else\r
-                title2Select = null;\r
+            TimeSpan longestDurationFound = TimeSpan.FromSeconds(0.0);\r
+            Parsing.Title returnTitle = null;\r
 \r
-            // So, If there are titles in the DVD Title dropdown menu, lets select the longest.\r
-            if (title2Select != null)\r
+            foreach (Parsing.Title item in thisDvd.Titles)\r
             {\r
-                foreach (Parsing.Title x in drp_dvdtitle.Items)\r
+                if (item.Duration > longestDurationFound)\r
                 {\r
-                    string title = x.ToString();\r
-                    if (title != "Automatic")\r
-                    {\r
-                        string[] y = title.Split(' ');\r
-                        string time = y[1].Replace("(", "").Replace(")", "");\r
-                        string[] z = time.Split(':');\r
-\r
-                        int hours = int.Parse(z[0]) * 60 * 60;\r
-                        int minutes = int.Parse(z[1]) * 60;\r
-                        int seconds = int.Parse(z[2]);\r
-                        int total_sec = hours + minutes + seconds;\r
-\r
-                        if (current_largest == 0)\r
-                        {\r
-                            current_largest = hours + minutes + seconds;\r
-                            title2Select = x;\r
-                        }\r
-                        else\r
-                        {\r
-                            if (total_sec > current_largest)\r
-                            {\r
-                                current_largest = total_sec;\r
-                                title2Select = x;\r
-                            }\r
-                        }\r
-                    }\r
+                    returnTitle = item;\r
+                    longestDurationFound = item.Duration;\r
                 }\r
             }\r
-            return title2Select;\r
+            return returnTitle;\r
         }\r
 \r
         /// <summary>\r
         /// Set's up the DataGridView on the Chapters tab (frmMain)\r
         /// </summary>\r
-        public static DataGridView chapterNaming(DataGridView data_chpt, string chapter_end)\r
+        public static DataGridView chapterNaming(DataGridView dataChpt, string chapterEnd)\r
         {\r
             int i = 0, finish = 0;\r
 \r
-            if (chapter_end != "Auto")\r
-                int.TryParse(chapter_end, out finish);\r
+            if (chapterEnd != "Auto")\r
+                int.TryParse(chapterEnd, out finish);\r
 \r
             while (i < finish)\r
             {\r
-                int n = data_chpt.Rows.Add();\r
-                data_chpt.Rows[n].Cells[0].Value = (i + 1);\r
-                data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
-                data_chpt.Rows[n].Cells[0].ValueType = typeof(int);\r
-                data_chpt.Rows[n].Cells[1].ValueType = typeof(string);\r
+                int n = dataChpt.Rows.Add();\r
+                dataChpt.Rows[n].Cells[0].Value = (i + 1);\r
+                dataChpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
+                dataChpt.Rows[n].Cells[0].ValueType = typeof(int);\r
+                dataChpt.Rows[n].Cells[1].ValueType = typeof(string);\r
                 i++;\r
             }\r
 \r
-            return data_chpt;\r
+            return dataChpt;\r
         }\r
 \r
         /// <summary>\r
         /// 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(ComboBox drp_dvdtitle, string chapter_start, string chatper_end, string source, string dest, int format)\r
+        public static string autoName(ComboBox drpDvdtitle, string chapter_start, string chatper_end, string source, string dest, int format)\r
         {\r
             string AutoNamePath = string.Empty;\r
-            if (drp_dvdtitle.Text != "Automatic")\r
+            if (drpDvdtitle.Text != "Automatic")\r
             {\r
                 // Get the Source Name \r
                 string sourceName = Path.GetFileNameWithoutExtension(source);\r
 \r
                 // Get the Selected Title Number\r
-                string[] titlesplit = drp_dvdtitle.Text.Split(' ');\r
+                string[] titlesplit = drpDvdtitle.Text.Split(' ');\r
                 string dvdTitle = titlesplit[0].Replace("Automatic", "");\r
 \r
                 // Get the Chapter Start and Chapter End Numbers\r
@@ -151,25 +104,25 @@ namespace Handbrake.Functions
                     combinedChapterTag = chapterStart + "-" + chapterFinish;\r
 \r
                 // Get the destination filename.\r
-                string destination_filename;\r
+                string destinationFilename;\r
                 if (Properties.Settings.Default.autoNameFormat != "")\r
                 {\r
-                    destination_filename = Properties.Settings.Default.autoNameFormat;\r
-                    destination_filename = destination_filename.Replace("{source}", sourceName).Replace("{title}", dvdTitle).Replace("{chapters}", combinedChapterTag);\r
+                    destinationFilename = Properties.Settings.Default.autoNameFormat;\r
+                    destinationFilename = destinationFilename.Replace("{source}", sourceName).Replace("{title}", dvdTitle).Replace("{chapters}", combinedChapterTag);\r
                 }\r
                 else\r
-                    destination_filename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;\r
+                    destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;\r
 \r
                 // Add the appropriate file extension\r
                 if (format == 0)\r
                 {\r
                     if (Properties.Settings.Default.useM4v)\r
-                        destination_filename += ".m4v";\r
+                        destinationFilename += ".m4v";\r
                     else\r
-                        destination_filename += ".mp4";\r
+                        destinationFilename += ".mp4";\r
                 }\r
                 else if (format == 1)\r
-                    destination_filename += ".mkv";\r
+                    destinationFilename += ".mkv";\r
 \r
                 // Now work out the path where the file will be stored.\r
                 // First case: If the destination box doesn't already contain a path, make one.\r
@@ -177,14 +130,14 @@ namespace Handbrake.Functions
                 {\r
                     // If there is an auto name path, use it...\r
                     if (Properties.Settings.Default.autoNamePath.Trim() != "" && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")\r
-                        AutoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destination_filename);\r
+                        AutoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destinationFilename);\r
                     else // ...otherwise, output to the source directory\r
                         AutoNamePath = null;\r
                 }\r
                 else // Otherwise, use the path that is already there.\r
                 {\r
                     // Use the path and change the file extension to match the previous destination\r
-                    AutoNamePath = Path.Combine(Path.GetDirectoryName(dest), destination_filename);\r
+                    AutoNamePath = Path.Combine(Path.GetDirectoryName(dest), destinationFilename);\r
                     AutoNamePath = Path.ChangeExtension(AutoNamePath, Path.GetExtension(dest));\r
                 }\r
             }\r
@@ -222,6 +175,7 @@ namespace Handbrake.Functions
                 {\r
                     line = stdOutput.ReadLine() ?? "";\r
                     Match m = Regex.Match(line, @"HandBrake ([0-9.]*)(svn[0-9M]*) \([0-9]*\)");\r
+                    Match platform = Regex.Match(line, @"- ([A-Za-z0-9\s ]*) -");\r
 \r
                     if (m.Success)\r
                     {\r
@@ -231,6 +185,9 @@ namespace Handbrake.Functions
                         Properties.Settings.Default.hb_build = int.Parse(arr[1]);\r
                         Properties.Settings.Default.hb_version = arr[0];\r
                     }\r
+                    if (platform.Success)\r
+                        Properties.Settings.Default.hb_platform = platform.Value.Replace("-", "").Trim();\r
+\r
                     if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.\r
                     {\r
                         Process cli = Process.GetProcessById(cliProcess.Id);\r
@@ -286,34 +243,36 @@ namespace Handbrake.Functions
             // avoiding any previous instances of HandBrakeCLI.exe in before.\r
             // Kill the current process.\r
 \r
-            Process[] hbProcesses = Process.GetProcessesByName("HandBrakeCLI");\r
+            DateTime startTime = DateTime.Now;\r
+            TimeSpan duration;\r
 \r
-            // Another hack. We maybe need to wait a few seconds for HandBrakeCLI to launch\r
-            if (hbProcesses.Length == 0)\r
+            Process[] hbProcesses = Process.GetProcessesByName("HandBrakeCLI");\r
+            while (hbProcesses.Length == 0)\r
             {\r
-                Thread.Sleep(2000);\r
                 hbProcesses = Process.GetProcessesByName("HandBrakeCLI");\r
+                duration = DateTime.Now - startTime;\r
+                if (duration.Seconds > 5 && hbProcesses.Length == 0) // Make sure we don't wait forever if the process doesn't start\r
+                    return -1;\r
             }\r
 \r
             Process hbProcess = null;\r
-            if (hbProcesses.Length > 0)\r
-                foreach (Process process in hbProcesses)\r
+            foreach (Process process in hbProcesses)\r
+            {\r
+                Boolean found = false;\r
+                // Check if the current CLI instance was running before we started the current one\r
+                foreach (Process bprocess in before)\r
                 {\r
-                    Boolean found = false;\r
-                    // Check if the current CLI instance was running before we started the current one\r
-                    foreach (Process bprocess in before)\r
-                    {\r
-                        if (process.Id == bprocess.Id)\r
-                            found = true;\r
-                    }\r
+                    if (process.Id == bprocess.Id)\r
+                        found = true;\r
+                }\r
 \r
-                    // If it wasn't running before, we found the process we want.\r
-                    if (!found)\r
-                    {\r
-                        hbProcess = process;\r
-                        break;\r
-                    }\r
+                // If it wasn't running before, we found the process we want.\r
+                if (!found)\r
+                {\r
+                    hbProcess = process;\r
+                    break;\r
                 }\r
+            }\r
             if (hbProcess != null)\r
                 return hbProcess.Id;\r
 \r
@@ -333,9 +292,7 @@ namespace Handbrake.Functions
                 foreach (FileInfo file in logFiles)\r
                 {\r
                     if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))\r
-                    {\r
                         File.Delete(file.FullName);\r
-                    }\r
                 }\r
             }\r
         }\r
index fda90e5..13d5e10 100644 (file)
     <Compile Include="Presets\Import.cs" />\r
     <Compile Include="Presets\preset.cs" />\r
     <Compile Include="Presets\PresetsHandler.cs" />\r
-    <Compile Include="EncodeQueue\QueueHandler.cs" />\r
+    <Compile Include="EncodeQueue\EncodeAndQueueHandler.cs" />\r
     <Compile Include="Functions\AppcastReader.cs" />\r
-    <Compile Include="EncodeQueue\Encode.cs" />\r
     <Compile Include="Functions\QueryParser.cs" />\r
     <Compile Include="Parsing\AudioTrack.cs" />\r
     <Compile Include="Parsing\Chapter.cs" />\r
index f1cc044..4cf4635 100644 (file)
@@ -441,5 +441,17 @@ namespace Handbrake.Properties {
                 this["DubAudio"] = value;\r
             }\r
         }\r
+        \r
+        [global::System.Configuration.UserScopedSettingAttribute()]\r
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+        [global::System.Configuration.DefaultSettingValueAttribute("")]\r
+        public string hb_platform {\r
+            get {\r
+                return ((string)(this["hb_platform"]));\r
+            }\r
+            set {\r
+                this["hb_platform"] = value;\r
+            }\r
+        }\r
     }\r
 }\r
index ebd6f44..0f9c5ff 100644 (file)
     <Setting Name="DubAudio" Type="System.Boolean" Scope="User">\r
       <Value Profile="(Default)">False</Value>\r
     </Setting>\r
+    <Setting Name="hb_platform" Type="System.String" Scope="User">\r
+      <Value Profile="(Default)" />\r
+    </Setting>\r
   </Settings>\r
 </SettingsFile>
\ No newline at end of file
index eb64a36..5a00d0c 100644 (file)
             <setting name="DubAudio" serializeAs="String">\r
                 <value>False</value>\r
             </setting>\r
+            <setting name="hb_platform" serializeAs="String">\r
+                <value />\r
+            </setting>\r
         </Handbrake.Properties.Settings>\r
     </userSettings>\r
 <startup><supportedRuntime version="v2.0.50727"/></startup></configuration>\r
index bcf01c8..c4fbce8 100644 (file)
@@ -39,7 +39,7 @@ namespace Handbrake
             this.label1 = new System.Windows.Forms.Label();\r
             this.lbl_HBBuild = new System.Windows.Forms.Label();\r
             this.PictureBox1 = new System.Windows.Forms.PictureBox();\r
-            this.button1 = new System.Windows.Forms.Button();\r
+            this.btn_close = new System.Windows.Forms.Button();\r
             ((System.ComponentModel.ISupportInitialize)(this.PictureBox1)).BeginInit();\r
             this.SuspendLayout();\r
             // \r
@@ -72,7 +72,7 @@ namespace Handbrake
             this.lbl_HBBuild.Location = new System.Drawing.Point(125, 33);\r
             this.lbl_HBBuild.Margin = new System.Windows.Forms.Padding(3, 1, 3, 3);\r
             this.lbl_HBBuild.Name = "lbl_HBBuild";\r
-            this.lbl_HBBuild.Size = new System.Drawing.Size(152, 13);\r
+            this.lbl_HBBuild.Size = new System.Drawing.Size(224, 13);\r
             this.lbl_HBBuild.TabIndex = 32;\r
             this.lbl_HBBuild.Text = "{Version}";\r
             this.lbl_HBBuild.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;\r
@@ -90,24 +90,25 @@ namespace Handbrake
             this.PictureBox1.TabIndex = 33;\r
             this.PictureBox1.TabStop = false;\r
             // \r
-            // button1\r
+            // btn_close\r
             // \r
-            this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;\r
-            this.button1.Location = new System.Drawing.Point(274, 82);\r
-            this.button1.Name = "button1";\r
-            this.button1.Size = new System.Drawing.Size(75, 23);\r
-            this.button1.TabIndex = 35;\r
-            this.button1.Text = "OK";\r
-            this.button1.UseVisualStyleBackColor = true;\r
+            this.btn_close.DialogResult = System.Windows.Forms.DialogResult.OK;\r
+            this.btn_close.Location = new System.Drawing.Point(274, 82);\r
+            this.btn_close.Name = "btn_close";\r
+            this.btn_close.Size = new System.Drawing.Size(75, 23);\r
+            this.btn_close.TabIndex = 35;\r
+            this.btn_close.Text = "OK";\r
+            this.btn_close.UseVisualStyleBackColor = true;\r
+            this.btn_close.Click += new System.EventHandler(this.btn_close_Click);\r
             // \r
             // frmAbout\r
             // \r
-            this.AcceptButton = this.button1;\r
+            this.AcceptButton = this.btn_close;\r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
-            this.CancelButton = this.button1;\r
+            this.CancelButton = this.btn_close;\r
             this.ClientSize = new System.Drawing.Size(363, 117);\r
-            this.Controls.Add(this.button1);\r
+            this.Controls.Add(this.btn_close);\r
             this.Controls.Add(this.label1);\r
             this.Controls.Add(this.PictureBox1);\r
             this.Controls.Add(this.lbl_HBBuild);\r
@@ -134,6 +135,6 @@ namespace Handbrake
         internal System.Windows.Forms.Label label1;\r
         internal System.Windows.Forms.Label lbl_HBBuild;\r
         internal System.Windows.Forms.PictureBox PictureBox1;\r
-        private System.Windows.Forms.Button button1;\r
+        private System.Windows.Forms.Button btn_close;\r
     }\r
 }
\ No newline at end of file
index e43706f..a35779a 100644 (file)
@@ -14,14 +14,12 @@ namespace Handbrake
         public frmAbout()\r
         {\r
             InitializeComponent();\r
-            lbl_HBBuild.Text = Properties.Settings.Default.hb_version + "  " + Properties.Settings.Default.hb_build;\r
+            lbl_HBBuild.Text = Properties.Settings.Default.hb_version + " (" + Properties.Settings.Default.hb_build + ") - " + Properties.Settings.Default.hb_platform;\r
         }\r
 \r
         private void btn_close_Click(object sender, EventArgs e)\r
         {\r
             this.Close();\r
         }\r
-\r
-  \r
     }\r
 }
\ No newline at end of file
index c308990..84f9bdd 100644 (file)
@@ -20,7 +20,7 @@ namespace Handbrake
         delegate void SetTextCallback(string text);\r
         String read_file;\r
         Thread monitor;\r
-        QueueHandler encodeQueue;\r
+        EncodeAndQueueHandler encodeQueue;\r
         int position;  // Position in the arraylist reached by the current log output in the rtf box.\r
         string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
         private frmMain mainWin;\r
@@ -28,16 +28,15 @@ namespace Handbrake
         /// <summary>\r
         /// This window should be used to display the RAW output of the handbrake CLI which is produced during an encode.\r
         /// </summary>\r
-        public frmActivityWindow(string file, QueueHandler eh, frmMain mw)\r
+        public frmActivityWindow(string file, EncodeAndQueueHandler eh, frmMain mw)\r
         {\r
             InitializeComponent();\r
 \r
             rtf_actLog.Text = string.Empty;\r
             encodeQueue = eh;\r
-            read_file = file;\r
             position = 0;\r
             mainWin = mw;\r
-            \r
+\r
             // When the window closes, we want to abort the monitor thread.\r
             this.Disposed += new EventHandler(forceQuit);\r
 \r
@@ -45,15 +44,33 @@ namespace Handbrake
             displayLogHeader();\r
 \r
             if (file == "last_scan_log.txt")\r
-                txt_log.Text = "Scan Log";\r
-            else if (file == "last_encode_log.txt")\r
-                txt_log.Text = "Encode Log";\r
+                setLogView(true);\r
+            else\r
+                setLogView(false);\r
 \r
             // Start a new thread which will montior and keep the log window up to date if required/\r
             startLogThread(read_file);\r
         }\r
 \r
         /// <summary>\r
+        /// Set the file which the log window is viewing.\r
+        /// </summary>\r
+        /// <param name="scan"></param>\r
+        public void setLogView(Boolean scan)\r
+        {\r
+            if (scan)\r
+            {\r
+                txt_log.Text = "Scan Log";\r
+                read_file = "last_scan_log.txt";\r
+            }\r
+            else\r
+            {\r
+                read_file = "last_encode_log.txt";\r
+                txt_log.Text = "Encode Log";\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
         /// Displays the Log header\r
         /// </summary>\r
         private void displayLogHeader()\r
@@ -68,7 +85,7 @@ namespace Handbrake
             rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));\r
             rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));\r
             rtf_actLog.AppendText("#########################################\n\n");\r
-            if (encodeQueue.IsEncoding && encodeQueue.LastEncode.Query != String.Empty)\r
+            if (encodeQueue.isEncoding && encodeQueue.LastEncode.Query != String.Empty)\r
             {\r
                 rtf_actLog.AppendText("### CLI Query: " + encodeQueue.LastEncode.Query + "\n\n");\r
                 rtf_actLog.AppendText("#########################################\n\n");\r
@@ -114,7 +131,7 @@ namespace Handbrake
                 updateTextFromThread();\r
                 while (true)\r
                 {\r
-                    if (encodeQueue.IsEncoding || mainWin.isScanning)\r
+                    if (encodeQueue.isEncoding || mainWin.isScanning)\r
                         updateTextFromThread();\r
                     else\r
                     {\r
@@ -304,7 +321,7 @@ namespace Handbrake
         #endregion\r
 \r
         #region System Information\r
-        \r
+\r
 \r
         /// <summary>\r
         /// Returns the total physical ram in a system\r
index 62e0bc6..f385b15 100644 (file)
@@ -22,7 +22,7 @@ namespace Handbrake
     public partial class frmMain : Form\r
     {\r
         // Objects which may be used by one or more other objects *************\r
-        QueueHandler encodeQueue = new QueueHandler();\r
+        EncodeAndQueueHandler encodeQueue = new EncodeAndQueueHandler();\r
         PresetsHandler presetHandler = new PresetsHandler();\r
         QueryGenerator queryGen = new QueryGenerator();\r
 \r
@@ -650,7 +650,7 @@ namespace Handbrake
                     encodeQueue.RequestPause();\r
 \r
                     // Allow the CLI to exit cleanly\r
-                    Win32.SetForegroundWindow((int)encodeQueue.encodeHandler.processHandle);\r
+                    Win32.SetForegroundWindow((int)encodeQueue.processHandle);\r
                     SendKeys.Send("^C");\r
 \r
                     // Update the GUI\r
@@ -1004,7 +1004,7 @@ namespace Handbrake
                     drop_chapterFinish.Text = c_start.ToString();\r
             }\r
 \r
-            lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString();\r
+            lbl_duration.Text = Main.calculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();\r
 \r
             // Run the Autonaming function\r
             if (Properties.Settings.Default.autoNaming)\r
@@ -1035,7 +1035,7 @@ namespace Handbrake
                     drop_chapterFinish.Text = c_start.ToString();\r
             }\r
 \r
-            lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString();\r
+            lbl_duration.Text = Main.calculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();\r
 \r
             // Run the Autonaming function\r
             if (Properties.Settings.Default.autoNaming)\r
@@ -1469,7 +1469,7 @@ namespace Handbrake
 \r
                 // Now select the longest title\r
                 if (thisDVD.Titles.Count != 0)\r
-                    drp_dvdtitle.SelectedItem = Main.selectLongestTitle(drp_dvdtitle);\r
+                    drp_dvdtitle.SelectedItem = Main.selectLongestTitle(thisDVD);\r
 \r
                 // Enable the creation of chapter markers if the file is an image of a dvd.\r
                 if (sourcePath.ToLower().Contains(".iso") || sourcePath.ToLower().Contains("VIDEO_TS"))\r
@@ -1696,7 +1696,7 @@ namespace Handbrake
         protected override void OnFormClosing(FormClosingEventArgs e)\r
         {\r
             // If currently encoding, the queue isn't paused, and there are queue items to process, prompt to confirm close.\r
-            if ((encodeQueue.IsEncoding) && (!encodeQueue.PauseRequested) && (encodeQueue.Count > 0))\r
+            if ((encodeQueue.isEncoding) && (!encodeQueue.PauseRequested) && (encodeQueue.Count > 0))\r
             {\r
                 DialogResult result = MessageBox.Show("HandBrake has queue items to process. Closing HandBrake will not stop the current encoding, but will stop processing the queue.\n\nDo you want to close HandBrake?",\r
                     "Close HandBrake?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
@@ -1713,7 +1713,7 @@ namespace Handbrake
         {\r
             try\r
             {\r
-                Parser encode = new Parser(encodeQueue.encodeHandler.hbProcess.StandardOutput.BaseStream);\r
+                Parser encode = new Parser(encodeQueue.hbProcess.StandardOutput.BaseStream);\r
                 encode.OnEncodeProgress += encodeOnEncodeProgress;\r
                 while (!encode.EndOfStream)\r
                 {\r
index c1f2e73..96ef4a8 100644 (file)
@@ -15,7 +15,7 @@ namespace Handbrake
     {\r
 \r
         QueryGenerator hb_common_func = new QueryGenerator();\r
-        Encode process = new Encode();\r
+        EncodeAndQueueHandler process = new EncodeAndQueueHandler();\r
         private delegate void UpdateUIHandler();\r
         String currently_playing = "";\r
         readonly frmMain mainWindow;\r
index d52545b..e110a47 100644 (file)
@@ -16,9 +16,9 @@ namespace Handbrake
     public partial class frmQueue : Form\r
     {\r
         private delegate void UpdateHandler();\r
-        private QueueHandler queue;\r
+        private EncodeAndQueueHandler queue;\r
 \r
-        public frmQueue(QueueHandler q)\r
+        public frmQueue(EncodeAndQueueHandler q)\r
         {\r
             InitializeComponent();\r
 \r
@@ -81,7 +81,7 @@ namespace Handbrake
                 MessageBox.Show("Encoding restarted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
             }\r
 \r
-            if (!queue.IsEncoding)\r
+            if (!queue.isEncoding)\r
                 queue.StartEncodeQueue();\r
 \r
         }\r