Fixed time code reading in format "USF" - thx Thomas L :)

This commit is contained in:
niksedk 2015-10-19 21:53:36 +02:00
parent c021a2902c
commit 9b3f3f64b1

View File

@ -94,13 +94,21 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
string[] parts = code.Split(new[] { ':', '.', ',' }, StringSplitOptions.RemoveEmptyEntries);
//00:00:07:12
if (parts.Length == 1)
{
return new TimeCode(0, 0, int.Parse(code), 0); // seconds only
}
if (parts.Length == 2)
{
return new TimeCode(0, 0, int.Parse(parts[0]), int.Parse(parts[1])); // seconds + ms
}
//00:00:07:120
string hour = parts[0];
string minutes = parts[1];
string seconds = parts[2];
string frames = parts[3];
return new TimeCode(int.Parse(hour), int.Parse(minutes), int.Parse(seconds), FramesToMillisecondsMax999(int.Parse(frames)));
string ms = parts[3];
return new TimeCode(int.Parse(hour), int.Parse(minutes), int.Parse(seconds), int.Parse(ms));
}
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)