mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Minor fix for subtitle format not beeing too 'greedy'
This commit is contained in:
parent
65f8bce6cc
commit
dc050bc837
@ -114,6 +114,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
expectStartTime = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
if (p != null && p.StartTime.TotalMilliseconds > 0)
|
||||
subtitle.Paragraphs.Add(p);
|
||||
|
@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
//«Steppe»
|
||||
//Bogdan Voloshin, Yaroslavl
|
||||
|
||||
static readonly Regex RegexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d.\d\d\d$", RegexOptions.Compiled);
|
||||
static readonly Regex RegexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d.\d{1,3}$", RegexOptions.Compiled);
|
||||
|
||||
public override string Extension
|
||||
{
|
||||
@ -117,6 +117,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
int startMinutes = int.Parse(parts[1]);
|
||||
int startSeconds = int.Parse(parts[2]);
|
||||
int startMilliseconds = int.Parse(parts[3]);
|
||||
|
||||
if (parts[3].Length == 2)
|
||||
_errorCount++;
|
||||
|
||||
paragraph.StartTime = new TimeCode(startHours, startMinutes, startSeconds, startMilliseconds);
|
||||
return true;
|
||||
}
|
||||
|
@ -75,6 +75,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
p.Text = line;
|
||||
else
|
||||
p.Text = p.Text + Environment.NewLine + line;
|
||||
|
||||
if (p.Text.Length > 800)
|
||||
{
|
||||
_errorCount++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Paragraph p2 in subtitle.Paragraphs)
|
||||
|
@ -68,7 +68,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorCount++;
|
||||
_errorCount+=2;
|
||||
}
|
||||
}
|
||||
foreach (Paragraph p2 in subtitle.Paragraphs)
|
||||
|
@ -187,6 +187,14 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsLong(string s)
|
||||
{
|
||||
long i;
|
||||
if (long.TryParse(s, out i))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static SubtitleFormat GetSubtitleFormatByFriendlyName(string friendlyName)
|
||||
{
|
||||
foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats)
|
||||
|
Loading…
Reference in New Issue
Block a user