From f72607bbb58a523b437cdd2f74fe5ffe02fbcda2 Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 10 Jul 2007 22:35:11 +0000 Subject: [PATCH] WinGui: - Just some more C# getting checked in. Not far from completion now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@669 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/HandBrakeCS.csproj | 1 + win/C#/HandBrakeCS.suo | Bin 41472 -> 43520 bytes win/C#/frmMain.cs | 46 ++++++++- win/C#/frmReadDVD.Designer.cs | 36 +++++-- win/C#/frmReadDVD.cs | 187 +++++----------------------------- win/Handbrake.suo | Bin 32768 -> 32768 bytes 6 files changed, 92 insertions(+), 178 deletions(-) diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 1cd5a4e49..499cf29f6 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -37,6 +37,7 @@ + Form diff --git a/win/C#/HandBrakeCS.suo b/win/C#/HandBrakeCS.suo index bc9c1e19d94c129a490bad34ca1223ca03e9616d..ba8ae8e7c319dcdb4f3c974ce722e08e06e58576 100644 GIT binary patch delta 4720 zcmeHLdr*|u6~Fh}U0CF`u*+kY1$n5f$Xk5!S{^D2@=!#vs9+FLKoNlgqTOg>oQ5Q_ zCrJ|%9Hh3ji8jP9O&t>zYdW>f12dCJlh#h!=}f27u`fs4N!q&o-EY5Lmjn~jcKTQE z%x~|x=RVH8=bn4c`PT7<aOz#W&%B_K*Z+S$N- zx?E`tC;?RpETb_0D1K+SCW(eBt;3DaIJNB|M{_4N1y_E|H5kD1X+Zl^y%CfSpgUDI zvIl9YPdCWd&~06^!6Rq}x`i-G^~36kYQbFx)B)>( z&9uosBc~bEHlPLA4zvP0fSo`a&<=C}yMW!mBLGeK+YMc>9%~PMX`B7IMZdWH%SC;& zs79YD+x1#W4_U4-F-$1S5e8+=C=XzQ8{pyInlUMHiHhcB1PfjnAPUDKg+jj?9FKTv zuD_elX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eu-!g?LUiTsr zH}gs>ua|6c+Z7=q;cD~O*gYFw{Ka+0OZ_Y>_nkk^vv?S9h~H($EbDzP746C}GUxvR D==NS9 diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 70b8c48e3..471e61a3f 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -536,7 +536,7 @@ namespace Handbrake if (filename != "") { text_source.Text = filename; - Form frmReadDVD = new frmReadDVD(filename); + Form frmReadDVD = new frmReadDVD(filename, (frmMain)frmMain.ActiveForm); frmReadDVD.Show(); } @@ -548,7 +548,7 @@ namespace Handbrake if (filename != "") { text_source.Text = filename; - Form frmReadDVD = new frmReadDVD(filename); + Form frmReadDVD = new frmReadDVD(filename, (frmMain)frmMain.ActiveForm); frmReadDVD.Show(); } @@ -936,9 +936,49 @@ namespace Handbrake } } + Parsing.DVD thisDVD; + public void setStreamReader(Parsing.DVD dvd) + { + this.thisDVD = dvd; + } + private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e) { - //TODO: Convert the Parsing Code. + // Reset some values on the form + lbl_Aspect.Text = "Select a Title"; + lbl_RecomendedCrop.Text = "Select a Title"; + QueryEditorText.Text = ""; + + // If the dropdown is set to automatic nothing else needs to be done. + // Otheriwse if its not, title data has to be loased from parsing. + if (drp_dvdtitle.Text != "Automatic") + { + string[] temp; + string title; + temp = drp_dvdtitle.Text.Split(' '); + title = temp[0].Trim(); + + int count = thisDVD.Titles.Count - 1; + int counter = 0; + + while (count >= counter) + { + + if (thisDVD.Titles[counter].TitleNumber.ToString() == title) + { + lbl_Aspect.Text = thisDVD.Titles[counter].AspectRatio.ToString(); + lbl_RecomendedCrop.Text = thisDVD.Titles[counter].AutoCropDimensions[0] + "/" + thisDVD.Titles[counter].AutoCropDimensions[1] + "/" + thisDVD.Titles[counter].AutoCropDimensions[2] + "/" + thisDVD.Titles[counter].AutoCropDimensions[3]; + // Still need to set these up. + MessageBox.Show(thisDVD.Titles[counter].AudioTracks[0].ToString()); + MessageBox.Show(thisDVD.Titles[counter].Chapters.ToString()); + MessageBox.Show(thisDVD.Titles[counter].Subtitles.ToString()); + } + counter++; + } + + + } + } // diff --git a/win/C#/frmReadDVD.Designer.cs b/win/C#/frmReadDVD.Designer.cs index 5cf290e1f..c55d243be 100644 --- a/win/C#/frmReadDVD.Designer.cs +++ b/win/C#/frmReadDVD.Designer.cs @@ -29,21 +29,22 @@ namespace Handbrake private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmReadDVD)); - this.Label4 = new System.Windows.Forms.Label(); + this.lbl_pressOk = new System.Windows.Forms.Label(); this.btn_ok = new System.Windows.Forms.Button(); this.Label3 = new System.Windows.Forms.Label(); this.Label2 = new System.Windows.Forms.Label(); + this.lbl_status = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // Label4 + // lbl_pressOk // - this.Label4.AutoSize = true; - this.Label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label4.Location = new System.Drawing.Point(66, 51); - this.Label4.Name = "Label4"; - this.Label4.Size = new System.Drawing.Size(178, 13); - this.Label4.TabIndex = 29; - this.Label4.Text = "Press OK to start the process."; + this.lbl_pressOk.AutoSize = true; + this.lbl_pressOk.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_pressOk.Location = new System.Drawing.Point(66, 60); + this.lbl_pressOk.Name = "lbl_pressOk"; + this.lbl_pressOk.Size = new System.Drawing.Size(178, 13); + this.lbl_pressOk.TabIndex = 29; + this.lbl_pressOk.Text = "Press OK to start the process."; // // btn_ok // @@ -81,12 +82,24 @@ namespace Handbrake this.Label2.TabIndex = 26; this.Label2.Text = "Status:"; // + // lbl_status + // + this.lbl_status.AutoSize = true; + this.lbl_status.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_status.Location = new System.Drawing.Point(66, 41); + this.lbl_status.Name = "lbl_status"; + this.lbl_status.Size = new System.Drawing.Size(178, 13); + this.lbl_status.TabIndex = 30; + this.lbl_status.Text = "Processing.... Please Wait!"; + this.lbl_status.Visible = false; + // // frmReadDVD // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(473, 86); - this.Controls.Add(this.Label4); + this.Controls.Add(this.lbl_status); + this.Controls.Add(this.lbl_pressOk); this.Controls.Add(this.btn_ok); this.Controls.Add(this.Label3); this.Controls.Add(this.Label2); @@ -101,9 +114,10 @@ namespace Handbrake #endregion - internal System.Windows.Forms.Label Label4; + internal System.Windows.Forms.Label lbl_pressOk; internal System.Windows.Forms.Button btn_ok; internal System.Windows.Forms.Label Label3; internal System.Windows.Forms.Label Label2; + internal System.Windows.Forms.Label lbl_status; } } \ No newline at end of file diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index 2c95731df..0d8e109e9 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -5,6 +5,8 @@ using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; +using System.IO; + namespace Handbrake { @@ -12,197 +14,54 @@ namespace Handbrake { string inputFile; + frmMain mainWindow; - public frmReadDVD(string inputFile) + public frmReadDVD(string inputFile, frmMain window) { InitializeComponent(); this.inputFile = inputFile; + this.mainWindow = window; } - public void scan(string filename) + private void btn_ok_Click(object sender, EventArgs e) { - string query = "-i " + '"' + filename + '"' + " -t0"; + + string query = "-i " + '"' + inputFile + '"' + " -t0"; System.Diagnostics.Process hbProc = new System.Diagnostics.Process(); hbProc.StartInfo.FileName = "hbcli.exe"; hbProc.StartInfo.RedirectStandardOutput = true; hbProc.StartInfo.RedirectStandardError = true; hbProc.StartInfo.Arguments = query; hbProc.StartInfo.UseShellExecute = false; + hbProc.StartInfo.CreateNoWindow = true; + + hbProc.Start(); - System.IO.StreamReader errorReader = new System.IO.StreamReader(new System.IO.BufferedStream(hbProc.StandardError.BaseStream)); + StreamReader readData = new StreamReader(new BufferedStream(hbProc.StandardError.BaseStream)); hbProc.WaitForExit(); hbProc.Close(); - //Parsing.DVD thisDvd = Parsing.DVD.Parse(errorReader); + // Setup the parser + Parsing.DVD thisDvd = Parsing.DVD.Parse(readData); - String DvdData = errorReader.ReadToEnd(); - DvdData = DvdData + "-- end --"; + // Now pass this streamreader to frmMain so that it can be used there. + mainWindow.setStreamReader(thisDvd); - String[] DvdDataArr = DvdData.Split('\n'); - int DvdDataSize = DvdDataArr.Length -1; - String line = ""; + // Setup frmMain drp_dvdTitle with the title information in the form: 1 (02:34:11) + int count = thisDvd.Titles.Count -1; int counter = 0; + string title; - // - // Some varbiles used for parseing HandBrakes output - // - - // DVD info stroage varibles - string titleData = ""; - string duationData = ""; - string sizeData = ""; - string cropdata = ""; - string chatperData = ""; - string audioData = ""; - string subtitleData = ""; - - string fullTitleData = ""; - - // Position Pointers - bool chapterPointer = false; - bool audioPointer = false; - bool subtitlePointer = false; - - // Error handling varibles - bool titleError = false; - bool readError = false; - - while (counter <= DvdDataSize) + while (count >= counter) { - line = DvdDataArr[counter]; + title = thisDvd.Titles[counter].TitleNumber.ToString() + " (" + thisDvd.Titles[counter].Duration.ToString() + ")"; + mainWindow.drp_dvdtitle.Items.Add(title); counter++; - - // Get all the 1 liner data and set chaper potiner to true when done - if (line.Contains("exited.")){ - subtitlePointer = false; - fullTitleData = titleData.Trim() + " ~ " + duationData.Trim() + " ~ " + sizeData.Trim() + " ~ " + cropdata.Trim() + " ~ " + chatperData.Trim() + " ~ " + audioData.Trim() + " ~ " + subtitleData.Trim(); - add(fullTitleData, titleData, duationData); - counter++; - }else if (line.Contains("+ title")){ - if (titleData != "") { - subtitlePointer = true; - fullTitleData = titleData.Trim() + " ~ " + duationData.Trim() + " ~ " + sizeData.Trim() + " ~ " + cropdata.Trim() + " ~ " + chatperData.Trim() + " ~ " + audioData.Trim() + " ~ " + subtitleData.Trim(); - add(fullTitleData, titleData, duationData); - counter = counter + 1; - } - titleData = line; - }else if (line.Contains("+ duration")) { - duationData = line; - }else if (line.Contains("+ size")) { - sizeData = line; - }else if (line.Contains("+ autocrop")) { - cropdata = line; - }else if (line.Contains("+ chapters")) { - chatperData = line; - chapterPointer = true; - } - - // Get all the chapter information in 1 varible - if (chapterPointer == true) - { - if (!line.Contains("+ audio")) - { - chapterPointer = false; - audioPointer = true; - audioData = line; - } - else - { - if (!chatperData.Equals(line)) - { - chatperData = chatperData + " & " + line.Trim(); - } - } - } - - // Get all the audio channel information in 1 varible - if (audioPointer == true) - { - if (line.Contains("+ subtitle")) - { - audioPointer = false; - subtitlePointer = true; - subtitleData = line; - } - else - { - if (!audioData.Equals(line)) - { - audioData = audioData + " & " + line.Trim(); - } - } - } - - //Get all the subtitle data into 1 varible - if (subtitlePointer == true) - { - if (line.Contains("+ subtitle")) - { - subtitleData = line; - } else - { - if (!subtitleData.Equals(line)) - { - subtitleData = subtitleData + " & " + line.Trim(); - } - } - } - - // Handle some of Handbrakes Error outputs if they occur. - if (line.Contains("No title")) - { - titleError = true; - } - - if (line.Contains("***")) - { - readError = true; - } - - // Display error messages for errors detected above. - if (readError == true) - { - MessageBox.Show("Some DVD Title information may be missing however you may still be able to select your required title for encoding!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); - } - - if (titleError == true) - { - MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); - } - - } - } - - public void add(string fullTitleData, string titleData, string durationData) - { - - try - { - string t = titleData.Trim().Substring(8).Replace(":", ""); - string d = durationData.Trim().Substring(12); - - // Lets store the captured full title data as a string in the programs settings file. - // This can then be used by the DVD title dropdown menu to populate other fields. - - Properties.Settings.Default.FullDVDInfo = Properties.Settings.Default.FullDVDInfo + " \n " + fullTitleData; - - //Now lets add the info to the main form dropdowns - frmMain form = (frmMain)frmMain.ActiveForm; - string title = t + " " + " " + d + " "; - form.drp_dvdtitle.Items.Add(title); - } - catch (Exception) - { - // Don't really need to do anything about it. } + this.Close(); } - private void btn_ok_Click(object sender, EventArgs e) - { - scan(inputFile); - } - } } \ No newline at end of file diff --git a/win/Handbrake.suo b/win/Handbrake.suo index 69e3c52546b4595b74d194759c5676231f03ce0d..d694413309a3788850f6a55ae732f3384798a129 100644 GIT binary patch delta 492 zcmY*VJ1j$C82#_nR=Dv9rPYK|MH7UGpf$K2i9s8W)+4=-Y9k>?Jld!bdc|l!jznUx zSWF`R!CE2)kuXTaW{?;xHY5MNM3~O`zwiIP@0_D)yr%J|vnI=ZZ*_9{k}jGa%y?I< zP_tv0&oN<85OGmgi~)Bs>I5rxg$6W+N}+_CkJ5qzogNpStIE!*Io{w(*nyp37fpFS zI4%p4_XSezK4XtQolU?w(#~bkWPLn?!CPaT{i2bkb29^5Tetp_ysJ7q`nXK)m_Bv( z3wRx}Q!%h)&Q?i~_=rq;2tJ3r@X3Xc{C1qkW$*;-m=|(TE;~@FeAl0=O0ey3MIaQ% zp1%QkK^IMj4vZ@!#_7A!1s=QMYc^5|)l!U@+8h!L$qG$__;Z|ORsEEiNwwo=4 zkQgos`;lK`dWfsYG&FY%>4>Qy_A59_5+ur`V~2^A$6Zt#zp*f% zeUn>;-KhwJe}M(gW?S@>TIc?THOp0Tf9L1G1d1AEwL|E5+cFy>_1x+s8{_uPHy!=CCp!g8Y2xhQih+%MH zm>dkYZ(EU}IpI{9h%Jkz+Droc-kQ!HScU<6@bTiY6b3n>V>ZC5e%1vaNci7$*Y* z1H#FP3?&SSK*vv>5G*q}E