diff options
author | sr55 <[email protected]> | 2010-06-06 14:14:19 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-06-06 14:14:19 +0000 |
commit | 833e294b1339e9843a3f82fe1b6779be9f7c7093 (patch) | |
tree | f2e8fc2276e26365c16519ba29b62baba1ab908e /win/C#/Parsing/Subtitle.cs | |
parent | 62d42d9f7a808d0f5f5432b26f88f977f13269dc (diff) |
WinGui:
- Some changes / improvements to the current models / parsing models.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3359 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Parsing/Subtitle.cs')
-rw-r--r-- | win/C#/Parsing/Subtitle.cs | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/win/C#/Parsing/Subtitle.cs b/win/C#/Parsing/Subtitle.cs index 52a0729db..fd0cdc552 100644 --- a/win/C#/Parsing/Subtitle.cs +++ b/win/C#/Parsing/Subtitle.cs @@ -9,6 +9,8 @@ namespace Handbrake.Parsing using System.IO;
using System.Text.RegularExpressions;
+ using Handbrake.Model;
+
/// <summary>
/// An object that represents a subtitle associated with a Title, in a DVD
/// </summary>
@@ -32,7 +34,41 @@ namespace Handbrake.Parsing /// <summary>
/// Gets the Subtitle Type
/// </summary>
- public string Type { get; private set; }
+ public SubtitleType SubtitleType { get; private set; }
+
+ /// <summary>
+ /// Gets Subtitle Type
+ /// </summary>
+ public string TypeString
+ {
+ get
+ {
+ return this.SubtitleType == SubtitleType.Picture ? "Bitmap" : "Text";
+ }
+ }
+
+ /// <summary>
+ /// Create a new Subtitle Object
+ /// </summary>
+ /// <param name="track">
+ /// The track.
+ /// </param>
+ /// <param name="lang">
+ /// The lang.
+ /// </param>
+ /// <param name="langCode">
+ /// The lang code.
+ /// </param>
+ /// <param name="type">
+ /// The type.
+ /// </param>
+ /// <returns>
+ /// A Subtitle Object
+ /// </returns>
+ public static Subtitle CreateSubtitleObject(int track, string lang, string langCode, SubtitleType type)
+ {
+ return new Subtitle { TrackNumber = track, Language = lang, LanguageCode = langCode, SubtitleType = type };
+ }
/// <summary>
/// Parse the input strings related to subtitles
@@ -55,7 +91,7 @@ namespace Handbrake.Parsing TrackNumber = int.Parse(m.Groups[1].Value.Trim()),
Language = m.Groups[2].Value,
LanguageCode = m.Groups[3].Value,
- Type = m.Groups[4].Value
+ SubtitleType = m.Groups[4].Value.Contains("Text") ? SubtitleType.Text : SubtitleType.Picture
};
return thisSubtitle;
}
@@ -92,7 +128,7 @@ namespace Handbrake.Parsing /// <returns>A string formatted as: {track #} {language}</returns>
public override string ToString()
{
- return string.Format("{0} {1} ({2})", TrackNumber, Language, Type);
+ return string.Format("{0} {1} ({2})", TrackNumber, Language, TypeString);
}
}
}
\ No newline at end of file |