Fix & Refact (Subrip + Csv33)

This commit is contained in:
ivandrofly 2015-01-31 19:18:13 +00:00
parent a2238cdb77
commit ecdbaf3712
2 changed files with 4 additions and 13 deletions

View File

@ -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] == ':')

View File

@ -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('.', ':');