summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/C#/HandBrakeCS.csproj2
-rw-r--r--win/C#/Parsing/Chapter.cs21
-rw-r--r--win/C#/Parsing/DVD.cs2
-rw-r--r--win/C#/Parsing/Subtitle.cs1
-rw-r--r--win/C#/Parsing/Title.cs67
-rw-r--r--win/C#/frmMain.cs37
-rw-r--r--win/C#/frmQueue.cs33
-rw-r--r--win/C#/frmReadDVD.cs12
8 files changed, 25 insertions, 150 deletions
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj
index 235cf2762..2316eb678 100644
--- a/win/C#/HandBrakeCS.csproj
+++ b/win/C#/HandBrakeCS.csproj
@@ -62,6 +62,8 @@
<Compile Include="frmOptions.Designer.cs">
<DependentUpon>frmOptions.cs</DependentUpon>
</Compile>
+ <Compile Include="Functions\CLI.cs" />
+ <Compile Include="Functions\Update.cs" />
<Compile Include="Parsing\AudioTrack.cs" />
<Compile Include="Parsing\Chapter.cs" />
<Compile Include="Parsing\DVD.cs" />
diff --git a/win/C#/Parsing/Chapter.cs b/win/C#/Parsing/Chapter.cs
index 44627ac63..c74f0d56e 100644
--- a/win/C#/Parsing/Chapter.cs
+++ b/win/C#/Parsing/Chapter.cs
@@ -16,24 +16,6 @@ namespace Handbrake.Parsing
}
}
- /*private int[] m_cellRange;
- public int[] CellRange
- {
- get
- {
- return this.m_cellRange;
- }
- }
-
- private int m_blocks;
- public int BlockCount
- {
- get
- {
- return this.m_blocks;
- }
- }*/
-
private TimeSpan m_duration;
public TimeSpan Duration
{
@@ -56,8 +38,6 @@ namespace Handbrake.Parsing
Chapter thisChapter = new Chapter();
string[] splitter = curLine.Split(new string[] { " + ", ": cells ", ", ", " blocks, duration ", "->" }, StringSplitOptions.RemoveEmptyEntries);
thisChapter.m_chapterNumber = int.Parse(splitter[0]);
- //thisChapter.m_cellRange = new int[2] { int.Parse(splitter[1]), int.Parse(splitter[2]) };
- //thisChapter.m_blocks = int.Parse(splitter[3]);
thisChapter.m_duration = TimeSpan.Parse(splitter[4]);
return thisChapter;
}
@@ -74,6 +54,7 @@ namespace Handbrake.Parsing
while (!curLine.Contains(" + audio tracks:"))
{
Chapter thisChapter = Chapter.Parse(output);
+
if (thisChapter != null)
{
chapters.Add(thisChapter);
diff --git a/win/C#/Parsing/DVD.cs b/win/C#/Parsing/DVD.cs
index 4b09ac828..ef6586e39 100644
--- a/win/C#/Parsing/DVD.cs
+++ b/win/C#/Parsing/DVD.cs
@@ -2,6 +2,8 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
+using System.Windows.Forms;
+
namespace Handbrake.Parsing
{
diff --git a/win/C#/Parsing/Subtitle.cs b/win/C#/Parsing/Subtitle.cs
index 343806ab0..d91638076 100644
--- a/win/C#/Parsing/Subtitle.cs
+++ b/win/C#/Parsing/Subtitle.cs
@@ -53,6 +53,7 @@ namespace Handbrake.Parsing
while ((char)output.Peek() != '+') // oh glorious hack, serve me well
{
Subtitle thisSubtitle = Subtitle.Parse(output);
+
if (thisSubtitle != null)
{
subtitles.Add(thisSubtitle);
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs
index 245adfcdb..e55bd78e6 100644
--- a/win/C#/Parsing/Title.cs
+++ b/win/C#/Parsing/Title.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
+using System.Windows.Forms;
namespace Handbrake.Parsing
{
@@ -35,42 +36,6 @@ namespace Handbrake.Parsing
}
}
- /*private int m_vts;
- public int Vts
- {
- get
- {
- return this.m_vts;
- }
- }
-
- private int m_ttn;
- public int Ttn
- {
- get
- {
- return this.m_ttn;
- }
- }
-
- private int[] m_cellRange;
- public int[] CellRange
- {
- get
- {
- return this.m_cellRange;
- }
- }
-
- private int m_blockCount;
- public int BlockCount
- {
- get
- {
- return this.m_blockCount;
- }
- }*/
-
private int m_titleNumber;
public int TitleNumber
{
@@ -107,14 +72,6 @@ namespace Handbrake.Parsing
}
}
- /*private float m_fps;
- public float Fps
- {
- get
- {
- return this.m_fps;
- }
- }*/
private int[] m_autoCrop;
public int[] AutoCropDimensions
@@ -130,7 +87,6 @@ namespace Handbrake.Parsing
this.m_audioTracks = new List<AudioTrack>();
this.m_chapters = new List<Chapter>();
this.m_subtitles = new List<Subtitle>();
- //this.m_cellRange = new int[2];
}
public override string ToString()
@@ -147,19 +103,16 @@ namespace Handbrake.Parsing
* This will be converted to use Regex soon, I promise ;)
* brianmario - 7/9/07
*/
- try
- {
+
string curLine = output.ReadLine();
thisTitle.m_titleNumber = int.Parse(curLine.Substring(curLine.Length - 2, 1));
curLine = output.ReadLine();
string[] splitter = curLine.Split(',');
- //thisTitle.m_vts = int.Parse(splitter[0].Substring(8));
- //thisTitle.m_ttn = int.Parse(splitter[1].Substring(5));
+
splitter = splitter[2].Trim().Split(' ', '(', ')');
- //thisTitle.m_blockCount = int.Parse(splitter[3]);
+
splitter = splitter[1].Split('-', '>');
- //thisTitle.m_cellRange[0] = int.Parse(splitter[0]);
- //thisTitle.m_cellRange[1] = int.Parse(splitter[2]);
+
curLine = output.ReadLine();
splitter = curLine.Split(new string[] { " + duration: " }, StringSplitOptions.RemoveEmptyEntries);
thisTitle.m_duration = TimeSpan.Parse(splitter[0]);
@@ -167,20 +120,14 @@ namespace Handbrake.Parsing
splitter = curLine.Split(new string[] { " + size: ", "aspect: ", ", ", " fps", "x" }, StringSplitOptions.RemoveEmptyEntries);
thisTitle.m_resolution = new Size(int.Parse(splitter[0]), int.Parse(splitter[1]));
thisTitle.m_aspectRatio = float.Parse(splitter[2].ToString());
- //thisTitle.m_fps = float.Parse(splitter[3].ToString());
+
curLine = output.ReadLine();
splitter = curLine.Split(new string[] { " + autocrop: ", "/" }, StringSplitOptions.RemoveEmptyEntries);
thisTitle.m_autoCrop = new int[4] { int.Parse(splitter[0]), int.Parse(splitter[1]), int.Parse(splitter[2]), int.Parse(splitter[3]) };
thisTitle.m_chapters.AddRange(Chapter.ParseList(output));
thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));
thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));
- }
- catch (Exception)
- {
- // hbcli crashed caused an exception here. Just threw this in to prevent a program error.
- // Can be debuged later.
- }
-
+
return thisTitle;
}
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 5361a3489..234af0aa4 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -603,38 +603,10 @@ namespace Handbrake
query = QueryEditorText.Text;
}
- hbProc = new System.Diagnostics.Process();
- hbProc.StartInfo.FileName = "hbcli.exe";
- hbProc.StartInfo.Arguments = query;
- hbProc.StartInfo.UseShellExecute = false;
- hbProc.Start();
-
- // Set the process Priority
- string priority = Properties.Settings.Default.processPriority;
- switch (priority)
- {
- case "Realtime":
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;
- break;
- case "High":
- hbProc.PriorityClass = ProcessPriorityClass.High;
- break;
- case "Above Normal":
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
- break;
- case "Normal":
- hbProc.PriorityClass = ProcessPriorityClass.Normal;
- break;
- case "Low":
- hbProc.PriorityClass = ProcessPriorityClass.Idle;
- break;
- default:
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
- break;
- }
+ Functions.CLI process = new Functions.CLI();
+ Process hbProc = process.runCli(this, query, false, false, false, false);
ThreadPool.QueueUserWorkItem(procMonitor);
- // TODO: Need to write a bit of code here to do process monitoring.
}
private void procMonitor(object state)
@@ -744,9 +716,10 @@ namespace Handbrake
text_width.BackColor = Color.LightGreen;
}
}
-
+
// There is a bug here *******************************************************************
- if (!lbl_Aspect.Text.Equals("Select a Title")){
+ if (lbl_Aspect.Text != "Select a Title")
+ {
int height = int.Parse(text_width.Text) / int.Parse(lbl_Aspect.Text);
MessageBox.Show("test");
int mod16 = height % 16;
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 09b3f19c8..8d273215d 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -77,41 +77,14 @@ namespace Handbrake
for (int i = 0; i < initialListCount; i++)
{
string query = list_queue.Items[0].ToString();
- Process hbProc = new Process();
- hbProc.StartInfo.FileName = "hbcli.exe";
- hbProc.StartInfo.Arguments = query;
- hbProc.StartInfo.UseShellExecute = false;
- hbProc.Start();
-
- // Set the process Priority
-
- switch (Properties.Settings.Default.processPriority)
- {
- case "Realtime":
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;
- break;
- case "High":
- hbProc.PriorityClass = ProcessPriorityClass.High;
- break;
- case "Above Normal":
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
- break;
- case "Normal":
- hbProc.PriorityClass = ProcessPriorityClass.Normal;
- break;
- case "Low":
- hbProc.PriorityClass = ProcessPriorityClass.Idle;
- break;
- default:
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
- break;
- }
+ Functions.CLI process = new Functions.CLI();
+ Process hbProc = process.runCli(this, query, false, false, false, false);
+
hbProc.WaitForExit();
hbProc.Close();
hbProc.Dispose();
-
updateUIElements();
}
}
diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs
index 04a47029b..62a1563cc 100644
--- a/win/C#/frmReadDVD.cs
+++ b/win/C#/frmReadDVD.cs
@@ -7,6 +7,7 @@ using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
+using System.Diagnostics;
namespace Handbrake
@@ -59,15 +60,10 @@ namespace Handbrake
private void startProc(object state)
{
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;
+
+ Functions.CLI process = new Functions.CLI();
+ Process hbProc = process.runCli(this, query, true, true, false, true);
- hbProc.Start();
Parsing.Parser readData = new Parsing.Parser(hbProc.StandardError.BaseStream);
hbProc.WaitForExit();
hbProc.Close();