summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Parsing
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-04-16 18:36:23 +0000
committersr55 <[email protected]>2011-04-16 18:36:23 +0000
commitc921f0242dd7da08ea07b9ef5e02d37dd91b020d (patch)
tree8f1324382a0ffae776274957d925cb10e90ac4bb /win/CS/HandBrake.ApplicationServices/Parsing
parent680ed831fb94849f57565665ed4f467f2d3283e5 (diff)
WinGui:
- Switching Audio Selection dropdown to be databound. Added The scanned source track to the Audio Track model. - Added new Move to Top / Bottom options on the right click. - Further UI tweaks and fixes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3935 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Parsing')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs (renamed from win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs)54
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Title.cs6
2 files changed, 39 insertions, 21 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs
index 0597f4d1b..14f807c6c 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs
@@ -12,17 +12,17 @@ namespace HandBrake.ApplicationServices.Parsing
/// <summary>
/// An object represending an AudioTrack associated with a Title, in a DVD
/// </summary>
- public class AudioTrack
+ public class Audio
{
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
- public AudioTrack()
- {
+ public Audio()
+ {
}
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
/// <param name="trackNumber">
/// The track number.
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// <param name="bitrate">
/// The bitrate.
/// </param>
- public AudioTrack(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)
+ public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)
{
this.TrackNumber = trackNumber;
this.Language = language;
@@ -57,6 +57,17 @@ namespace HandBrake.ApplicationServices.Parsing
}
/// <summary>
+ /// Gets A Dummy Not Found Track
+ /// </summary>
+ public static Audio NoneFound
+ {
+ get
+ {
+ return new Audio { Description = "None Found" };
+ }
+ }
+
+ /// <summary>
/// Gets or sets The track number of this Audio Track
/// </summary>
public int TrackNumber { get; set; }
@@ -100,7 +111,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// <returns>
/// An Audio Track obkect
/// </returns>
- public static AudioTrack Parse(StringReader output)
+ public static Audio Parse(StringReader output)
{
string audioTrack = output.ReadLine();
Match m = Regex.Match(audioTrack, @"^ \+ ([0-9]*), ([A-Za-z0-9,\s]*) \((.*)\) \((.*)\)");
@@ -115,13 +126,13 @@ namespace HandBrake.ApplicationServices.Parsing
if (track.Success)
{
- var thisTrack = new AudioTrack
+ var thisTrack = new Audio
{
- TrackNumber = int.Parse(track.Groups[1].Value.Trim()),
- Language = track.Groups[2].Value,
+ TrackNumber = int.Parse(track.Groups[1].Value.Trim()),
+ Language = track.Groups[2].Value,
Format = m.Groups[3].Value,
- Description = subformat,
- SampleRate = int.Parse(samplerateVal),
+ Description = subformat,
+ SampleRate = int.Parse(samplerateVal),
Bitrate = int.Parse(bitrateVal),
LanguageCode = iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)
};
@@ -140,12 +151,12 @@ namespace HandBrake.ApplicationServices.Parsing
/// <returns>
/// An array of audio tracks
/// </returns>
- public static AudioTrack[] ParseList(StringReader output)
+ public static Audio[] ParseList(StringReader output)
{
- var tracks = new List<AudioTrack>();
+ var tracks = new List<Audio>();
while (true)
{
- AudioTrack thisTrack = Parse(output);
+ Audio thisTrack = Parse(output);
if (thisTrack != null)
tracks.Add(thisTrack);
else
@@ -160,10 +171,17 @@ namespace HandBrake.ApplicationServices.Parsing
/// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>
public override string ToString()
{
- if (Description == null)
- return string.Format("{0} {1} ({2})", TrackNumber, Language, Format);
+ if (this.Description == NoneFound.Description)
+ {
+ return this.Description;
+ }
+
+ if (this.Description == null)
+ {
+ return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.Format);
+ }
- return string.Format("{0} {1} ({2}) ({3})", TrackNumber, Language, Format, Description);
+ return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);
}
}
} \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
index 2f08eb19e..98c2f02f2 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs
@@ -30,7 +30,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// </summary>
public Title()
{
- this.AudioTracks = new List<AudioTrack>();
+ this.AudioTracks = new List<Audio>();
this.Chapters = new List<Chapter>();
this.Subtitles = new List<Subtitle>();
}
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing
/// <summary>
/// Gets or sets a Collection of audio tracks associated with this Title
/// </summary>
- public List<AudioTrack> AudioTracks { get; set; }
+ public List<Audio> AudioTracks { get; set; }
/// <summary>
/// Gets or sets a Collection of subtitles associated with this Title
@@ -193,7 +193,7 @@ namespace HandBrake.ApplicationServices.Parsing
thisTitle.Chapters.AddRange(Chapter.ParseList(output));
- thisTitle.AudioTracks.AddRange(AudioTrack.ParseList(output));
+ thisTitle.AudioTracks.AddRange(Audio.ParseList(output));
thisTitle.Subtitles.AddRange(Subtitle.ParseList(output));