OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 22 Aug 2007 15:29:49 +0000 (15:29 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 22 Aug 2007 15:29:49 +0000 (15:29 +0000)
- Added debuging / crash prevention code in frmReadDVD.
- Fixed issue with queue when adding items after initial encode.

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

win/C#/Parsing/DVD.cs
win/C#/frmQueue.cs
win/C#/frmReadDVD.cs

index 0259612..3ba2120 100644 (file)
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Text;\r
 using System.IO;\r
 using System.Text.RegularExpressions;\r
+using System.Windows.Forms;\r
 \r
 namespace Handbrake.Parsing\r
 {\r
index ee6301a..62e32d3 100644 (file)
@@ -55,7 +55,6 @@ namespace Handbrake
 \r
                 if ((initialListCount - i) != (list_queue.Items.Count))\r
                 {\r
-                    MessageBox.Show("Added an Item");\r
                     initialListCount++;\r
                 }\r
             }\r
index d56f0f3..ca6d233 100644 (file)
@@ -32,30 +32,45 @@ namespace Handbrake
 \r
         private void btn_ok_Click(object sender, EventArgs e)\r
         {\r
-            btn_ok.Enabled = false;\r
-            //btn_skip.Visible = true;\r
-            lbl_pressOk.Visible = false;\r
-            lbl_progress.Text = "0%";\r
-            //lbl_progress.Visible = true;\r
-            lbl_status.Visible = true;\r
-            // throw cli call and parsing on it's own thread\r
-            ThreadPool.QueueUserWorkItem(startProc);\r
+            \r
+            try\r
+            {\r
+                btn_ok.Enabled = false;\r
+                //btn_skip.Visible = true;\r
+                lbl_pressOk.Visible = false;\r
+                lbl_progress.Text = "0%";\r
+                //lbl_progress.Visible = true;\r
+                lbl_status.Visible = true;\r
+                // throw cli call and parsing on it's own thread\r
+                ThreadPool.QueueUserWorkItem(startProc);\r
+            }\r
+            catch(Exception exc)\r
+            {\r
+                MessageBox.Show(exc.ToString());\r
+            }\r
         }\r
      \r
         private void updateUIElements()\r
         {\r
-            if (this.InvokeRequired)\r
+            try\r
             {\r
-                this.BeginInvoke(new UpdateUIHandler(updateUIElements));\r
-                return;\r
+                if (this.InvokeRequired)\r
+                {\r
+                    this.BeginInvoke(new UpdateUIHandler(updateUIElements));\r
+                    return;\r
+                }\r
+                // Now pass this streamreader to frmMain so that it can be used there.\r
+                mainWindow.setStreamReader(thisDvd);\r
+\r
+                mainWindow.drp_dvdtitle.Items.Clear();\r
+                mainWindow.drp_dvdtitle.Items.AddRange(thisDvd.Titles.ToArray());\r
+\r
+                this.Close();\r
+            }\r
+            catch(Exception exc)\r
+            {\r
+                MessageBox.Show(exc.ToString());\r
             }\r
-            // Now pass this streamreader to frmMain so that it can be used there.\r
-            mainWindow.setStreamReader(thisDvd);\r
-\r
-            mainWindow.drp_dvdtitle.Items.Clear();\r
-            mainWindow.drp_dvdtitle.Items.AddRange(thisDvd.Titles.ToArray());\r
-\r
-            this.Close();\r
         }\r
 \r
         Functions.CLI process = new Functions.CLI();\r
@@ -68,20 +83,27 @@ namespace Handbrake
             /*\r
              * Quick and Dirty hack to get around the stderr crashes of hbcli. Lets try feeding brians parser text straight from a text file.\r
              */\r
-            string appPath = Application.StartupPath.ToString();\r
-            appPath = appPath + "\\";\r
-            string strCmdLine = "cmd /c " + '"' + '"' + appPath + "\\hbcli.exe" + '"' +  " -i" + '"' + inputFile + '"' + " -t0 >" + '"'+ appPath + "\\dvdinfo.dat" + '"' + " 2>&1" + '"';\r
-            Process hbproc = Process.Start("CMD.exe", strCmdLine);\r
-            hbproc.WaitForExit();\r
-\r
-\r
-            StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");\r
-    \r
-            thisDvd = Parsing.DVD.Parse(sr);\r
-\r
-            sr.Close();\r
-            Console.ReadLine();\r
-            updateUIElements();\r
+            try\r
+            {\r
+                string appPath = Application.StartupPath.ToString();\r
+                appPath = appPath + "\\";\r
+                string strCmdLine = "cmd /c " + '"' + '"' + appPath + "\\hbcli.exe" + '"' +  " -i" + '"' + inputFile + '"' + " -t0 >" + '"'+ appPath + "\\dvdinfo.dat" + '"' + " 2>&1" + '"';\r
+                Process hbproc = Process.Start("CMD.exe", strCmdLine);\r
+                hbproc.WaitForExit();\r
+\r
+          \r
+                StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");\r
+        \r
+                thisDvd = Parsing.DVD.Parse(sr);\r
+\r
+                sr.Close();\r
+                Console.ReadLine();\r
+                updateUIElements();\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                MessageBox.Show(exc.ToString());\r
+            }\r
             //*********************************************************************************************************************************************\r
 \r
             /*\r
@@ -105,7 +127,7 @@ namespace Handbrake
             */\r
         }\r
 \r
-        private void Parser_OnScanProgress(object Sender, int CurrentTitle, int TitleCount)\r
+        /*private void Parser_OnScanProgress(object Sender, int CurrentTitle, int TitleCount)\r
         {\r
             if (this.InvokeRequired)\r
             {\r
@@ -118,14 +140,19 @@ namespace Handbrake
                 progress = 100;\r
             }\r
             this.lbl_progress.Text = progress.ToString() + "%";\r
-        }\r
+        }*/\r
 \r
         private void btn_skip_Click(object sender, EventArgs e)\r
         {\r
-            //process.killCLI();\r
-            this.Close();\r
-            cancel = 1;  \r
+            try\r
+            {\r
+                this.Close();\r
+                cancel = 1;\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                MessageBox.Show(exc.ToString());\r
+            }\r
         }\r
-\r
     }\r
 }
\ No newline at end of file