summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/C#/HandBrakeCS.csproj2
-rw-r--r--win/C#/Parsing/AudioTrack.cs5
-rw-r--r--win/C#/Parsing/Subtitle.cs5
-rw-r--r--win/C#/Parsing/Title.cs6
-rw-r--r--win/C#/frmAbout.Designer.cs1
-rw-r--r--win/C#/frmDVDData.Designer.cs5
-rw-r--r--win/C#/frmDVDData.cs5
-rw-r--r--win/C#/frmMain.cs16
-rw-r--r--win/C#/frmReadDVD.Designer.cs1
-rw-r--r--win/C#/frmReadDVD.cs60
-rw-r--r--win/C#/frmUpdate.Designer.cs1
11 files changed, 69 insertions, 38 deletions
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj
index 499cf29f6..9ad49c2c5 100644
--- a/win/C#/HandBrakeCS.csproj
+++ b/win/C#/HandBrakeCS.csproj
@@ -37,7 +37,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Content Include="file.txt" />
<Compile Include="frmAbout.cs">
<SubType>Form</SubType>
</Compile>
@@ -65,6 +64,7 @@
<Compile Include="Parsing\AudioTrack.cs" />
<Compile Include="Parsing\Chapter.cs" />
<Compile Include="Parsing\DVD.cs" />
+ <Compile Include="Parsing\Parser.cs" />
<Compile Include="Parsing\Subtitle.cs" />
<Compile Include="Parsing\Title.cs" />
<Compile Include="Program.cs" />
diff --git a/win/C#/Parsing/AudioTrack.cs b/win/C#/Parsing/AudioTrack.cs
index 6232da2a9..0f89d3d37 100644
--- a/win/C#/Parsing/AudioTrack.cs
+++ b/win/C#/Parsing/AudioTrack.cs
@@ -61,6 +61,11 @@ namespace Handbrake.Parsing
}
}
+ public override string ToString()
+ {
+ return string.Format("{0} ({1}) ({2})", this.m_language, this.m_format, this.m_subFormat);
+ }
+
public static AudioTrack Parse(StreamReader output)
{
string curLine = output.ReadLine();
diff --git a/win/C#/Parsing/Subtitle.cs b/win/C#/Parsing/Subtitle.cs
index a9c169ddc..ba037b545 100644
--- a/win/C#/Parsing/Subtitle.cs
+++ b/win/C#/Parsing/Subtitle.cs
@@ -25,6 +25,11 @@ namespace Handbrake.Parsing
}
}
+ public override string ToString()
+ {
+ return this.m_language;
+ }
+
public static Subtitle Parse(StreamReader output)
{
string curLine = output.ReadLine();
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs
index 5df7a6bb4..99b32cd70 100644
--- a/win/C#/Parsing/Title.cs
+++ b/win/C#/Parsing/Title.cs
@@ -133,6 +133,12 @@ namespace Handbrake.Parsing
this.m_cellRange = new int[2];
}
+ public override string ToString()
+ {
+ return string.Format("{0} - {1}h{2}m{3}s", this.m_titleNumber, this.m_duration.Hours,
+ this.m_duration.Minutes, this.m_duration.Seconds);
+ }
+
public static Title Parse(StreamReader output)
{
Title thisTitle = new Title();
diff --git a/win/C#/frmAbout.Designer.cs b/win/C#/frmAbout.Designer.cs
index f4e65592b..6bbf4e68f 100644
--- a/win/C#/frmAbout.Designer.cs
+++ b/win/C#/frmAbout.Designer.cs
@@ -127,6 +127,7 @@ namespace Handbrake
this.Controls.Add(this.Label2);
this.Controls.Add(this.PictureBox1);
this.Controls.Add(this.Label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmAbout";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
diff --git a/win/C#/frmDVDData.Designer.cs b/win/C#/frmDVDData.Designer.cs
index 005be7e5a..6476e7ec9 100644
--- a/win/C#/frmDVDData.Designer.cs
+++ b/win/C#/frmDVDData.Designer.cs
@@ -68,8 +68,9 @@ namespace Handbrake
this.btn_close.TabStop = false;
this.btn_close.Text = "Close Window";
this.btn_close.UseVisualStyleBackColor = false;
+ this.btn_close.Click += new System.EventHandler(this.btn_close_Click);
//
- // DVDData
+ // frmDVDData
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -78,7 +79,7 @@ namespace Handbrake
this.Controls.Add(this.rtf_dvdInfo);
this.Controls.Add(this.btn_close);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.Name = "DVDData";
+ this.Name = "frmDVDData";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Read DVD";
this.ResumeLayout(false);
diff --git a/win/C#/frmDVDData.cs b/win/C#/frmDVDData.cs
index bc33cb0c8..f413d220a 100644
--- a/win/C#/frmDVDData.cs
+++ b/win/C#/frmDVDData.cs
@@ -14,5 +14,10 @@ namespace Handbrake
{
InitializeComponent();
}
+
+ private void btn_close_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
}
} \ No newline at end of file
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 471e61a3f..09954b293 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -339,7 +339,7 @@ namespace Handbrake
private void mnu_update_Click(object sender, EventArgs e)
{
Form Update = new frmUpdate();
- Update.Show();
+ Update.ShowDialog();
}
private void mnu_exit_Click(object sender, EventArgs e)
@@ -351,7 +351,7 @@ namespace Handbrake
private void mnu_encode_Click(object sender, EventArgs e)
{
Form Queue = new frmQueue();
- Queue.Show();
+ Queue.ShowDialog();
}
private void mnu_viewDVDdata_Click(object sender, EventArgs e)
@@ -363,7 +363,7 @@ namespace Handbrake
private void mnu_options_Click(object sender, EventArgs e)
{
Form Options = new frmOptions();
- Options.Show();
+ Options.ShowDialog();
}
// PRESETS MENU --------------------------------------------------------------
@@ -516,7 +516,7 @@ namespace Handbrake
private void mnu_about_Click(object sender, EventArgs e)
{
Form About = new frmAbout();
- About.Show();
+ About.ShowDialog();
}
@@ -536,8 +536,8 @@ namespace Handbrake
if (filename != "")
{
text_source.Text = filename;
- Form frmReadDVD = new frmReadDVD(filename, (frmMain)frmMain.ActiveForm);
- frmReadDVD.Show();
+ Form frmReadDVD = new frmReadDVD(filename, this);
+ frmReadDVD.ShowDialog();
}
}
@@ -548,8 +548,8 @@ namespace Handbrake
if (filename != "")
{
text_source.Text = filename;
- Form frmReadDVD = new frmReadDVD(filename, (frmMain)frmMain.ActiveForm);
- frmReadDVD.Show();
+ Form frmReadDVD = new frmReadDVD(filename, this);
+ frmReadDVD.ShowDialog();
}
}
diff --git a/win/C#/frmReadDVD.Designer.cs b/win/C#/frmReadDVD.Designer.cs
index c55d243be..1cb811133 100644
--- a/win/C#/frmReadDVD.Designer.cs
+++ b/win/C#/frmReadDVD.Designer.cs
@@ -103,6 +103,7 @@ namespace Handbrake
this.Controls.Add(this.btn_ok);
this.Controls.Add(this.Label3);
this.Controls.Add(this.Label2);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmReadDVD";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs
index 0d8e109e9..caf9d5853 100644
--- a/win/C#/frmReadDVD.cs
+++ b/win/C#/frmReadDVD.cs
@@ -12,20 +12,44 @@ namespace Handbrake
{
public partial class frmReadDVD : Form
{
+ private string inputFile;
+ private frmMain mainWindow;
+ private Parsing.DVD thisDvd;
+ private delegate void UpdateUIHandler();
- string inputFile;
- frmMain mainWindow;
-
- public frmReadDVD(string inputFile, frmMain window)
+ public frmReadDVD(string inputFile, frmMain parent)
{
InitializeComponent();
this.inputFile = inputFile;
- this.mainWindow = window;
+ this.mainWindow = parent;
}
private void btn_ok_Click(object sender, EventArgs e)
{
-
+ lbl_status.Visible = true;
+ btn_ok.Enabled = false;
+ lbl_pressOk.Visible = false;
+ // throw cli call and parsing on it's own thread
+ System.Threading.ThreadPool.QueueUserWorkItem(startProc);
+ }
+
+ private void updateUIElements()
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new UpdateUIHandler(updateUIElements));
+ return;
+ }
+ // Now pass this streamreader to frmMain so that it can be used there.
+ mainWindow.setStreamReader(thisDvd);
+
+ mainWindow.drp_dvdtitle.Items.Clear();
+ mainWindow.drp_dvdtitle.Items.AddRange(thisDvd.Titles.ToArray());
+ this.Close();
+ }
+
+ private void startProc(object state)
+ {
string query = "-i " + '"' + inputFile + '"' + " -t0";
System.Diagnostics.Process hbProc = new System.Diagnostics.Process();
hbProc.StartInfo.FileName = "hbcli.exe";
@@ -35,33 +59,15 @@ namespace Handbrake
hbProc.StartInfo.UseShellExecute = false;
hbProc.StartInfo.CreateNoWindow = true;
-
hbProc.Start();
- StreamReader readData = new StreamReader(new BufferedStream(hbProc.StandardError.BaseStream));
+ Parsing.Parser readData = new Parsing.Parser(hbProc.StandardError.BaseStream);
hbProc.WaitForExit();
hbProc.Close();
// Setup the parser
- Parsing.DVD thisDvd = Parsing.DVD.Parse(readData);
-
- // Now pass this streamreader to frmMain so that it can be used there.
- mainWindow.setStreamReader(thisDvd);
-
- // 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;
+ thisDvd = Parsing.DVD.Parse(readData);
- while (count >= counter)
- {
- title = thisDvd.Titles[counter].TitleNumber.ToString() + " (" + thisDvd.Titles[counter].Duration.ToString() + ")";
- mainWindow.drp_dvdtitle.Items.Add(title);
- counter++;
- }
- this.Close();
+ updateUIElements();
}
-
-
-
}
} \ No newline at end of file
diff --git a/win/C#/frmUpdate.Designer.cs b/win/C#/frmUpdate.Designer.cs
index a7e00ea65..e9fd429e9 100644
--- a/win/C#/frmUpdate.Designer.cs
+++ b/win/C#/frmUpdate.Designer.cs
@@ -245,6 +245,7 @@ namespace Handbrake
this.Controls.Add(this.Label2);
this.Controls.Add(this.btn_update);
this.Controls.Add(this.Label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmUpdate";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;