OSDN Git Service

Change the fifo size from being statically tuned for a Mac Pro with 4 CPUs to dynamic...
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmReadDVD.cs
index ad55511..ff50275 100644 (file)
@@ -20,7 +20,6 @@ namespace Handbrake
         private Parsing.DVD thisDvd;\r
         private Process hbProc;\r
         private delegate void UpdateUIHandler();\r
-        //private int cancel = 0;\r
 \r
         public frmReadDVD(string inputFile, frmMain parent, frmDvdInfo dvdInfoWindow)\r
         {\r
@@ -28,28 +27,34 @@ namespace Handbrake
             this.inputFile = inputFile;\r
             this.mainWindow = parent;\r
             this.dvdInfo = dvdInfoWindow;\r
+            startScan();\r
+            \r
         }\r
 \r
-        private void btn_ok_Click(object sender, EventArgs e)\r
+        private void startScan()\r
         {\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
+            catch (Exception exc)\r
             {\r
-                MessageBox.Show(exc.ToString());\r
+                if (Properties.Settings.Default.GuiDebug == "Checked")\r
+                {\r
+                    MessageBox.Show("frmReadDVD.cs - startScan " + exc.ToString());\r
+                }\r
+                else\r
+                {\r
+                    MessageBox.Show(Properties.Settings.Default.defaultError.ToString());\r
+                }\r
             }\r
         }\r
-     \r
+   \r
         private void updateUIElements()\r
         {\r
             try\r
@@ -64,30 +69,36 @@ namespace Handbrake
 \r
                 mainWindow.drp_dvdtitle.Items.Clear();\r
                 mainWindow.drp_dvdtitle.Items.AddRange(thisDvd.Titles.ToArray());\r
-\r
+                mainWindow.drp_dvdtitle.Text = "Automatic";\r
+                mainWindow.drop_chapterFinish.Text = "Auto";\r
+                mainWindow.drop_chapterStart.Text = "Auto";\r
+  \r
                 this.Close();\r
             }\r
             catch(Exception exc)\r
             {\r
-                MessageBox.Show(exc.ToString());\r
+                if (Properties.Settings.Default.GuiDebug == "Checked")\r
+                {\r
+                    MessageBox.Show("frmReadDVD.cs - updateUIElements " + exc.ToString());\r
+                }\r
+                else\r
+                {\r
+                    MessageBox.Show(Properties.Settings.Default.defaultError.ToString());\r
+                }\r
             }\r
         }\r
 \r
         Functions.CLI process = new Functions.CLI();\r
+\r
         private void startProc(object state)\r
         {\r
             //string query = "-i " + '"' + inputFile + '"' + " -t0";\r
             // hbProc = process.runCli(this, query, true, true, false, true);\r
 \r
-            //*********************************************************************************************************************************************\r
-            /*\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
             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
+                string appPath = Application.StartupPath.ToString()+ "\\";\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
                 hbproc.Dispose();\r
@@ -96,16 +107,20 @@ namespace Handbrake
           \r
                 StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");\r
                 thisDvd = Parsing.DVD.Parse(sr);\r
-\r
                 sr.Close();\r
 \r
-                Console.ReadLine();\r
-\r
                 updateUIElements();\r
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show(exc.ToString());\r
+                if (Properties.Settings.Default.GuiDebug == "Checked")\r
+                {\r
+                    MessageBox.Show("frmReadDVD.cs - startProc " + exc.ToString());\r
+                }\r
+                else\r
+                {\r
+                    MessageBox.Show(Properties.Settings.Default.defaultError.ToString());\r
+                }\r
             }\r
 \r
         }\r
@@ -148,17 +163,5 @@ namespace Handbrake
             this.lbl_progress.Text = progress.ToString() + "%";\r
         }*/\r
 \r
-        private void btn_skip_Click(object sender, EventArgs e)\r
-        {\r
-            try\r
-            {\r
-                this.Close();\r
-                //cancel = 1;\r
-            }\r
-            catch (Exception exc)\r
-            {\r
-                MessageBox.Show(exc.ToString());\r
-            }\r
-        }\r
     }\r
 }
\ No newline at end of file