[refact] - Minor update (Idx.cs)

This commit is contained in:
Ivandro Ismael 2016-02-12 06:01:17 +00:00
parent a9ed730b12
commit cabb63ed77

View File

@ -83,11 +83,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
_errorCount = 0; _errorCount = 0;
subtitle.Paragraphs.Clear(); subtitle.Paragraphs.Clear();
char[] splitChars = { ',', ':' };
foreach (string line in lines) foreach (string line in lines)
{ {
if (_regexTimeCodes.IsMatch(line)) if (_regexTimeCodes.IsMatch(line))
{ {
Paragraph p = GetTimeCodes(line); Paragraph p = GetParagraph(line.Split(splitChars, StringSplitOptions.RemoveEmptyEntries));
if (p != null) if (p != null)
subtitle.Paragraphs.Add(p); subtitle.Paragraphs.Add(p);
else else
@ -108,11 +109,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
} }
} }
private static Paragraph GetTimeCodes(string line) private static Paragraph GetParagraph(string[] parts)
{ {
// timestamp: 00:00:01:401, filepos: 000000000 // timestamp: 00:00:01:401, filepos: 000000000
string[] parts = line.Split(new[] { ',', ':' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 7) if (parts.Length == 7)
{ {
int hours; int hours;