summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2007-07-10 22:35:11 +0000
committersr55 <[email protected]>2007-07-10 22:35:11 +0000
commitf72607bbb58a523b437cdd2f74fe5ffe02fbcda2 (patch)
tree5fdd4ce0b57120d00b2e3e4c2d93842d759c806d
parent23f2dac9718628261d3fd9c7ab785cb399ccd18b (diff)
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
-rw-r--r--win/C#/HandBrakeCS.csproj1
-rw-r--r--win/C#/HandBrakeCS.suobin41472 -> 43520 bytes
-rw-r--r--win/C#/frmMain.cs46
-rw-r--r--win/C#/frmReadDVD.Designer.cs36
-rw-r--r--win/C#/frmReadDVD.cs187
-rw-r--r--win/Handbrake.suobin32768 -> 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 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Content Include="file.txt" />
<Compile Include="frmAbout.cs">
<SubType>Form</SubType>
</Compile>
diff --git a/win/C#/HandBrakeCS.suo b/win/C#/HandBrakeCS.suo
index bc9c1e19d..ba8ae8e7c 100644
--- a/win/C#/HandBrakeCS.suo
+++ b/win/C#/HandBrakeCS.suo
Binary files differ
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 69e3c5254..d69441330 100644
--- a/win/Handbrake.suo
+++ b/win/Handbrake.suo
Binary files differ