diff options
author | sr55 <[email protected]> | 2007-07-16 16:52:58 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-07-16 16:52:58 +0000 |
commit | 2595cd0693e666366e824fdbbfe45adade38a08e (patch) | |
tree | 44c61ec26d8a22cfc7ecfd1cf9724c22518ba696 /win/C#/Parsing | |
parent | 5e8776b2f2e87120efaae2ed509bce845c5de94c (diff) |
WinGui:
- CLI process handling code moved into its own class. Reduces code replication. Returns hbProc
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@696 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Parsing')
-rw-r--r-- | win/C#/Parsing/Chapter.cs | 21 | ||||
-rw-r--r-- | win/C#/Parsing/DVD.cs | 2 | ||||
-rw-r--r-- | win/C#/Parsing/Subtitle.cs | 1 | ||||
-rw-r--r-- | win/C#/Parsing/Title.cs | 67 |
4 files changed, 11 insertions, 80 deletions
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;
}
|