diff options
Diffstat (limited to 'win/C#/Parsing/AudioTrack.cs')
-rw-r--r-- | win/C#/Parsing/AudioTrack.cs | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/win/C#/Parsing/AudioTrack.cs b/win/C#/Parsing/AudioTrack.cs index 56a35194b..a28e01737 100644 --- a/win/C#/Parsing/AudioTrack.cs +++ b/win/C#/Parsing/AudioTrack.cs @@ -4,13 +4,13 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text.RegularExpressions;
-
namespace Handbrake.Parsing
{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Text.RegularExpressions;
+
/// <summary>
/// An object represending an AudioTrack associated with a Title, in a DVD
/// </summary>
@@ -74,7 +74,7 @@ namespace Handbrake.Parsing public string ISO639_2
{
- get { return m_iso639_2; }
+ get { return m_iso639_2; }
}
/// <summary>
@@ -85,13 +85,13 @@ namespace Handbrake.Parsing {
if (m_subFormat == null)
return string.Format("{0} {1} ({2})", m_trackNumber, m_language, m_format);
-
+
return string.Format("{0} {1} ({2}) ({3})", m_trackNumber, m_language, m_format, m_subFormat);
}
public static AudioTrack Parse(StringReader output)
{
- String audio_track = output.ReadLine();
+ string audio_track = output.ReadLine();
Match m = Regex.Match(audio_track, @"^ \+ ([0-9]*), ([A-Za-z0-9]*) \((.*)\) \((.*)\)");
Match track = Regex.Match(audio_track, @"^ \+ ([0-9]*), ([A-Za-z0-9]*) \((.*)\)"); // ID and Language
Match iso639_2 = Regex.Match(audio_track, @"iso639-2: ([a-zA-Z]*)\)");
@@ -99,24 +99,25 @@ namespace Handbrake.Parsing Match bitrate = Regex.Match(audio_track, @"([0-9]*)bps");
string subformat = m.Groups[4].Value.Trim().Contains("iso639") ? null : m.Groups[4].Value;
- string samplerateVal = samplerate.Success ? samplerate.Groups[0].Value.Replace("Hz", "").Trim() : "0";
- string bitrateVal = bitrate.Success ? bitrate.Groups[0].Value.Replace("bps", "").Trim() : "0";
+ string samplerateVal = samplerate.Success ? samplerate.Groups[0].Value.Replace("Hz", string.Empty).Trim() : "0";
+ string bitrateVal = bitrate.Success ? bitrate.Groups[0].Value.Replace("bps", string.Empty).Trim() : "0";
if (track.Success)
{
var thisTrack = new AudioTrack
- {
- m_trackNumber = int.Parse(track.Groups[1].Value.Trim()),
- m_language = track.Groups[2].Value,
- m_format = m.Groups[3].Value,
- m_subFormat = subformat,
- m_frequency = int.Parse(samplerateVal),
- m_bitrate = int.Parse(bitrateVal),
- m_iso639_2 = iso639_2.Value.Replace("iso639-2: ", "").Replace(")", "")
- };
- return thisTrack;
+ {
+ m_trackNumber = int.Parse(track.Groups[1].Value.Trim()),
+ m_language = track.Groups[2].Value,
+ m_format = m.Groups[3].Value,
+ m_subFormat = subformat,
+ m_frequency = int.Parse(samplerateVal),
+ m_bitrate = int.Parse(bitrateVal),
+ m_iso639_2 =
+ iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)
+ };
+ return thisTrack;
}
-
+
return null;
}
|