Now allows a variation of timecodes in Spruce Subtitle format

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@511 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-06-21 17:29:54 +00:00
parent 66ba64a24d
commit 05ffdc7725

View File

@ -107,6 +107,7 @@ $ColorIndex4 = 3
//00:01:54:19,00:01:56:17,We should be thankful|they accepted our offer.
subtitle.Paragraphs.Clear();
var regexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d:\d\d,\d\d:\d\d:\d\d:\d\d,.+", RegexOptions.Compiled);
var regexTimeCodes2 = new Regex(@"^\d\d:\d\d:\d\d:\d\d, \d\d:\d\d:\d\d:\d\d,.+", RegexOptions.Compiled);
foreach (string line in lines)
{
if (regexTimeCodes.IsMatch(line))
@ -124,6 +125,21 @@ $ColorIndex4 = 3
_errorCount++;
}
}
else if (regexTimeCodes2.IsMatch(line))
{
string start = line.Substring(0, 11);
string end = line.Substring(13, 11);
try
{
Paragraph p = new Paragraph(DecodeTimeCode(start), DecodeTimeCode(end), DecodeText(line.Substring(25).Trim()));
subtitle.Paragraphs.Add(p);
}
catch
{
_errorCount++;
}
}
else if (line.Trim().Length > 0 && !line.StartsWith("//") && !line.StartsWith("$"))
{
_errorCount++;