Improved old TTML format to include time code HH:MM:SS - thx Maksim :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2256 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-11-30 21:06:01 +00:00
parent 26fbe646bf
commit 73badae24f

View File

@ -230,7 +230,21 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
}
else
{
subtitle.Paragraphs.Add(new Paragraph(TimedText10.GetTimeCode(start, false), TimedText10.GetTimeCode(end, false), text));
if (start.Length == 8 && start[2] == ':' && start[5] == ':' &&
end.Length == 8 && end[2] == ':' && end[5] == ':')
{
Paragraph p = new Paragraph();
string[] parts = start.Split(new[] { ':' });
p.StartTime = new TimeCode(int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]), 0);
parts = end.Split(new[] { ':' });
p.EndTime = new TimeCode(int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]), 0);
p.Text = text;
subtitle.Paragraphs.Add(p);
}
else
{
subtitle.Paragraphs.Add(new Paragraph(TimedText10.GetTimeCode(start, false), TimedText10.GetTimeCode(end, false), text));
}
}
}
else if (node.Attributes["dur"] != null)