diff options
author | sr55 <[email protected]> | 2009-04-01 23:48:34 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-04-01 23:48:34 +0000 |
commit | 414d6a56cc67f2fa56353ee3ce80adaa8cfeb45f (patch) | |
tree | 171172730223e0e525b68f4afb3ea6ff2e5ccc9c /win/C#/Parsing | |
parent | 683faec1c917365b32332d86693e72479ba315bf (diff) |
WinGui:
- Just some minor code tweaks to clean things up.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2291 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Parsing')
-rw-r--r-- | win/C#/Parsing/AudioTrack.cs | 37 | ||||
-rw-r--r-- | win/C#/Parsing/Chapter.cs | 11 | ||||
-rw-r--r-- | win/C#/Parsing/Parser.cs | 8 | ||||
-rw-r--r-- | win/C#/Parsing/Subtitle.cs | 11 | ||||
-rw-r--r-- | win/C#/Parsing/Title.cs | 4 |
5 files changed, 39 insertions, 32 deletions
diff --git a/win/C#/Parsing/AudioTrack.cs b/win/C#/Parsing/AudioTrack.cs index d2d6f3fac..86c2b6e05 100644 --- a/win/C#/Parsing/AudioTrack.cs +++ b/win/C#/Parsing/AudioTrack.cs @@ -79,8 +79,8 @@ namespace Handbrake.Parsing {
if (m_subFormat == null)
return string.Format("{0} {1} ({2})", m_trackNumber, m_language, m_format);
- else
- return string.Format("{0} {1} ({2}) ({3})", m_trackNumber, m_language, m_format, m_subFormat);
+
+ return string.Format("{0} {1} ({2}) ({3})", m_trackNumber, m_language, m_format, m_subFormat);
}
public static AudioTrack Parse(StringReader output)
@@ -91,25 +91,30 @@ namespace Handbrake.Parsing Match y = Regex.Match(audio_track, @"^ \+ ([0-9]*), ([A-Za-z0-9]*) \((.*)\)");
if (m.Success)
{
- var thisTrack = new AudioTrack();
- thisTrack.m_trackNumber = int.Parse(m.Groups[1].Value.Trim());
- thisTrack.m_language = m.Groups[2].Value;
- thisTrack.m_format = m.Groups[3].Value;
- thisTrack.m_subFormat = m.Groups[4].Value;
- thisTrack.m_frequency = int.Parse(m.Groups[5].Value.Trim());
- thisTrack.m_bitrate = int.Parse(m.Groups[6].Value.Trim());
+ var thisTrack = new AudioTrack
+ {
+ m_trackNumber = int.Parse(m.Groups[1].Value.Trim()),
+ m_language = m.Groups[2].Value,
+ m_format = m.Groups[3].Value,
+ m_subFormat = m.Groups[4].Value,
+ m_frequency = int.Parse(m.Groups[5].Value.Trim()),
+ m_bitrate = int.Parse(m.Groups[6].Value.Trim())
+ };
return thisTrack;
}
- else if (y.Success)
+
+ if (y.Success)
{
- var thisTrack = new AudioTrack();
- thisTrack.m_trackNumber = int.Parse(y.Groups[1].Value.Trim());
- thisTrack.m_language = y.Groups[2].Value;
- thisTrack.m_format = y.Groups[3].Value;
+ var thisTrack = new AudioTrack
+ {
+ m_trackNumber = int.Parse(y.Groups[1].Value.Trim()),
+ m_language = y.Groups[2].Value,
+ m_format = y.Groups[3].Value
+ };
return thisTrack;
}
- else
- return null;
+
+ return null;
}
public static AudioTrack[] ParseList(StringReader output)
diff --git a/win/C#/Parsing/Chapter.cs b/win/C#/Parsing/Chapter.cs index 301fa5719..1bf38f4d8 100644 --- a/win/C#/Parsing/Chapter.cs +++ b/win/C#/Parsing/Chapter.cs @@ -51,13 +51,14 @@ namespace Handbrake.Parsing @"^ \+ ([0-9]*): cells ([0-9]*)->([0-9]*), ([0-9]*) blocks, duration ([0-9]{2}:[0-9]{2}:[0-9]{2})");
if (m.Success)
{
- var thisChapter = new Chapter();
- thisChapter.m_chapterNumber = int.Parse(m.Groups[1].Value.Trim());
- thisChapter.m_duration = TimeSpan.Parse(m.Groups[5].Value);
+ var thisChapter = new Chapter
+ {
+ m_chapterNumber = int.Parse(m.Groups[1].Value.Trim()),
+ m_duration = TimeSpan.Parse(m.Groups[5].Value)
+ };
return thisChapter;
}
- else
- return null;
+ return null;
}
public static Chapter[] ParseList(StringReader output)
diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index 24dcef40f..c15275030 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -37,7 +37,7 @@ namespace Handbrake.Parsing {
get
{
- return this.m_buffer;
+ return m_buffer;
}
}
@@ -64,14 +64,14 @@ namespace Handbrake.Parsing public Parser(Stream baseStream)
: base(baseStream)
{
- this.m_buffer = string.Empty;
+ m_buffer = string.Empty;
}
public override string ReadLine()
{
string tmp = base.ReadLine();
- this.m_buffer += tmp;
+ m_buffer += tmp;
Match m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");
if (OnReadLine != null)
OnReadLine(this, tmp);
@@ -86,7 +86,7 @@ namespace Handbrake.Parsing {
string tmp = base.ReadToEnd();
- this.m_buffer += tmp;
+ m_buffer += tmp;
if (OnReadToEnd != null)
OnReadToEnd(this, tmp);
diff --git a/win/C#/Parsing/Subtitle.cs b/win/C#/Parsing/Subtitle.cs index 71e00121e..e3ff72af0 100644 --- a/win/C#/Parsing/Subtitle.cs +++ b/win/C#/Parsing/Subtitle.cs @@ -50,13 +50,14 @@ namespace Handbrake.Parsing Match m = Regex.Match(curLine, @"^ \+ ([0-9]*), ([A-Za-z, ]*) \((.*)\)");
if (m.Success && !curLine.Contains("HandBrake has exited."))
{
- var thisSubtitle = new Subtitle();
- thisSubtitle.m_trackNumber = int.Parse(m.Groups[1].Value.Trim());
- thisSubtitle.m_language = m.Groups[2].Value;
+ var thisSubtitle = new Subtitle
+ {
+ m_trackNumber = int.Parse(m.Groups[1].Value.Trim()),
+ m_language = m.Groups[2].Value
+ };
return thisSubtitle;
}
- else
- return null;
+ return null;
}
public static Subtitle[] ParseList(StringReader output)
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index 74ccab752..80736064b 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -126,7 +126,7 @@ namespace Handbrake.Parsing if (m.Success)
thisTitle.m_titleNumber = int.Parse(m.Groups[1].Value.Trim());
- String testData = output.ReadLine();
+ output.ReadLine();
// Get duration for this title
@@ -146,7 +146,7 @@ namespace Handbrake.Parsing // Get autocrop region for this title
m = Regex.Match(output.ReadLine(), @"^ \+ autocrop: ([0-9]*)/([0-9]*)/([0-9]*)/([0-9]*)");
if (m.Success)
- thisTitle.m_autoCrop = new int[4]
+ thisTitle.m_autoCrop = new int[]
{
int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value),
int.Parse(m.Groups[3].Value), int.Parse(m.Groups[4].Value)
|