mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 20:52:44 +01:00
Fix & Refact (Subrip + Csv33)
This commit is contained in:
parent
a2238cdb77
commit
ecdbaf3712
@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
bool continuation = false;
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.StartsWith("$FontName") || line.StartsWith("$ColorIndex1"))
|
||||
if (line.StartsWith("$FontName", StringComparison.Ordinal) || line.StartsWith("$ColorIndex1", StringComparison.Ordinal))
|
||||
return false;
|
||||
Match m = null;
|
||||
if (line.Length > 8 && line[2] == ':')
|
||||
|
@ -193,22 +193,14 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
private static bool IsText(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
if (string.IsNullOrWhiteSpace(text) || Utilities.IsInteger(text) || _regexTimeCodes.IsMatch(text))
|
||||
return false;
|
||||
|
||||
if (Utilities.IsInteger(text))
|
||||
return false;
|
||||
|
||||
if (_regexTimeCodes.IsMatch(text))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string RemoveBadChars(string line)
|
||||
{
|
||||
line = line.Replace("\0", " ");
|
||||
return line;
|
||||
return line.Replace("\0", " ");
|
||||
}
|
||||
|
||||
private static bool TryReadTimeCodesLine(string line, Paragraph paragraph)
|
||||
@ -233,8 +225,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
line = line.Substring(0, 29);
|
||||
|
||||
// removes all extra spaces
|
||||
line = line.Replace(" ", string.Empty).Replace("-->", defaultSeparator);
|
||||
line = line.Trim();
|
||||
line = line.Replace(" ", string.Empty).Replace("-->", defaultSeparator).Trim();
|
||||
|
||||
// Fix a few more cases of wrong time codes, seen this: 00.00.02,000 --> 00.00.04,000
|
||||
line = line.Replace('.', ':');
|
||||
|
Loading…
Reference in New Issue
Block a user