Allow dash in number for WebVTT files - thx Maksim :)

This commit is contained in:
Nikolaj Olsson 2019-02-13 18:37:00 +01:00
parent 2e8a12803e
commit 07291a5313
2 changed files with 3 additions and 4 deletions

View File

@ -185,7 +185,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
subtitle.Header = "WEBVTT";
}
else if (p != null && hadEmptyLine && Utilities.IsInteger(line) &&
else if (p != null && hadEmptyLine && Utilities.IsInteger(line.RemoveChar('-')) &&
(RegexTimeCodesMiddle.IsMatch(next) ||
RegexTimeCodesShort.IsMatch(next) ||
RegexTimeCodes.IsMatch(next)))

View File

@ -60,7 +60,6 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
Paragraph p = null;
string positionInfo = string.Empty;
bool hadEmptyLine = false;
int numbers = 0;
for (var index = 0; index < lines.Count; index++)
{
string line = lines[index];
@ -112,12 +111,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
subtitle.Header = "WEBVTT FILE";
}
else if (p != null && hadEmptyLine && Utilities.IsInteger(line) &&
else if (p != null && hadEmptyLine && Utilities.IsInteger(line.RemoveChar('-')) &&
(RegexTimeCodesMiddle.IsMatch(next) ||
RegexTimeCodesShort.IsMatch(next) ||
RegexTimeCodes.IsMatch(next)))
{
numbers++;
// line number
}
else if (p != null)
{