Minor refact (casing)

This commit is contained in:
Nikolaj Olsson 2016-02-08 22:14:28 +01:00
parent 0ebd0f8cee
commit 66e5a00459
9 changed files with 19 additions and 19 deletions

View File

@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
public class MidwayInscriberCGX : SubtitleFormat public class MidwayInscriberCGX : SubtitleFormat
{ {
private static readonly Regex regexTimeCodes = new Regex(@"<\d\d:\d\d:\d\d:\d\d> <\d\d:\d\d:\d\d:\d\d>$", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes = new Regex(@"<\d\d:\d\d:\d\d:\d\d> <\d\d:\d\d:\d\d:\d\d>$", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {
@ -69,9 +69,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
if (!string.IsNullOrWhiteSpace(line)) if (!string.IsNullOrWhiteSpace(line))
{ {
if (regexTimeCodes.IsMatch(line)) if (RegexTimeCodes.IsMatch(line))
{ {
int idx = regexTimeCodes.Match(line).Index; int idx = RegexTimeCodes.Match(line).Index;
string temp = line.Substring(0, idx).Trim(); string temp = line.Substring(0, idx).Trim();
sb.AppendLine(temp); sb.AppendLine(temp);

View File

@ -9,7 +9,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
/// </summary> /// </summary>
public class SeImageHtmlIndex : SubtitleFormat public class SeImageHtmlIndex : SubtitleFormat
{ {
private static readonly Regex regexTimeCodes = new Regex(@"^#\d+:\d+", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes = new Regex(@"^#\d+:\d+", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {
@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
_errorCount = 0; _errorCount = 0;
foreach (string line in lines) foreach (string line in lines)
{ {
if (line.Contains(".png") && regexTimeCodes.IsMatch(line)) if (line.Contains(".png") && RegexTimeCodes.IsMatch(line))
{ {
int idx = line.IndexOf("<div"); int idx = line.IndexOf("<div");
if (idx > 0) if (idx > 0)

View File

@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
public class TurboTitler : SubtitleFormat public class TurboTitler : SubtitleFormat
{ {
private static Regex regexTimeCodes = new Regex(@"^\d:\d\d:\d\d\.\d\d,\d:\d\d:\d\d\.\d\d,NTP ", RegexOptions.Compiled); private static readonly Regex regexTimeCodes = new Regex(@"^\d:\d\d:\d\d\.\d\d,\d:\d\d:\d\d\.\d\d,NTP ", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {

View File

@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
public class UleadSubtitleFormat : SubtitleFormat public class UleadSubtitleFormat : SubtitleFormat
{ {
private static readonly Regex regexTimeCodes = new Regex(@"^#\d+ \d\d;\d\d;\d\d;\d\d \d\d;\d\d;\d\d;\d\d", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes = new Regex(@"^#\d+ \d\d;\d\d;\d\d;\d\d \d\d;\d\d;\d\d;\d\d", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {
@ -82,7 +82,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
foreach (string l2 in lines) foreach (string l2 in lines)
{ {
string line = l2.TrimEnd('ഀ'); string line = l2.TrimEnd('ഀ');
if (line.StartsWith('#') && regexTimeCodes.IsMatch(line)) if (line.StartsWith('#') && RegexTimeCodes.IsMatch(line))
{ {
string[] parts = line.Split(splitChar, StringSplitOptions.RemoveEmptyEntries); string[] parts = line.Split(splitChar, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length >= 3) if (parts.Length >= 3)

View File

@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
public class UnknownSubtitle27 : SubtitleFormat public class UnknownSubtitle27 : SubtitleFormat
{ {
private static Regex regexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d: ", RegexOptions.Compiled); private static readonly Regex regexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d: ", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {

View File

@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
public class UnknownSubtitle4 : SubtitleFormat public class UnknownSubtitle4 : SubtitleFormat
{ {
private readonly static Regex RegexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d.\d+, \d\d:\d\d:\d\d.\d+$", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d.\d+, \d\d:\d\d:\d\d.\d+$", RegexOptions.Compiled);
private enum ExpectingLine private enum ExpectingLine
{ {

View File

@ -10,8 +10,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
//>>> "COMMON GROUND" IS FUNDED BY 10:01:04:12 1 //>>> "COMMON GROUND" IS FUNDED BY 10:01:04:12 1
//THE MINNESOTA ARTS AND CULTURAL 10:01:07:09 //THE MINNESOTA ARTS AND CULTURAL 10:01:07:09
private static Regex regexTimeCodes1 = new Regex(@" \d\d:\d\d:\d\d:\d\d$", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes1 = new Regex(@" \d\d:\d\d:\d\d:\d\d$", RegexOptions.Compiled);
private static Regex regexTimeCodes2 = new Regex(@" \d\d:\d\d:\d\d:\d\d +\d+$", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes2 = new Regex(@" \d\d:\d\d:\d\d:\d\d +\d+$", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {
@ -84,12 +84,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
foreach (string line in lines) foreach (string line in lines)
{ {
string s = line.Trim(); string s = line.Trim();
var match = regexTimeCodes2.Match(s); var match = RegexTimeCodes2.Match(s);
if (match.Success) if (match.Success)
{ {
s = s.Substring(0, match.Index + 13).Trim(); s = s.Substring(0, match.Index + 13).Trim();
} }
match = regexTimeCodes1.Match(s); match = RegexTimeCodes1.Match(s);
if (match.Success && match.Index > 13) if (match.Success && match.Index > 13)
{ {
string text = s.Substring(0, match.Index).Trim(); string text = s.Substring(0, match.Index).Trim();
@ -110,7 +110,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
} }
} }
} }
else if (string.IsNullOrWhiteSpace(line) || regexTimeCodes1.IsMatch(" " + s)) else if (string.IsNullOrWhiteSpace(line) || RegexTimeCodes1.IsMatch(" " + s))
{ {
// skip empty lines // skip empty lines
} }

View File

@ -9,7 +9,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{ {
//* 00001.00-00003.00 02.01 00.0 1 0001 00 16-090-090 //* 00001.00-00003.00 02.01 00.0 1 0001 00 16-090-090
//* 00138.10-00143.05 00.00 00.0 1 0003 00 16-090-090 //* 00138.10-00143.05 00.00 00.0 1 0003 00 16-090-090
private static Regex regexTimeCodes = new Regex(@"^\*\s+\d\d\d\d\d\.\d\d-\d\d\d\d\d\.\d\d \d\d.\d\d \d\d.\d\ \d \d\d\d\d \d\d \d\d-\d\d\d-\d\d\d$", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes = new Regex(@"^\*\s+\d\d\d\d\d\.\d\d-\d\d\d\d\d\.\d\d \d\d.\d\d \d\d.\d\ \d \d\d\d\d \d\d \d\d-\d\d\d-\d\d\d$", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {
@ -82,7 +82,7 @@ ST 0 EB 3.10
char[] splitChar = { '.' }; char[] splitChar = { '.' };
foreach (string line in arr) foreach (string line in arr)
{ {
if (regexTimeCodes.IsMatch(line.Trim())) if (RegexTimeCodes.IsMatch(line.Trim()))
{ {
string[] temp = line.Substring(1).Trim().Substring(0, 17).Split('-'); string[] temp = line.Substring(1).Trim().Substring(0, 17).Split('-');
if (temp.Length == 2) if (temp.Length == 2)

View File

@ -8,7 +8,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
public class UnknownSubtitle47 : SubtitleFormat public class UnknownSubtitle47 : SubtitleFormat
{ {
//7:00:01:27AM //7:00:01:27AM
private static Regex regexTimeCodes = new Regex(@"^\d\:\d\d\:\d\d\:\d\d\t", RegexOptions.Compiled); private static readonly Regex RegexTimeCodes = new Regex(@"^\d\:\d\d\:\d\d\:\d\d\t", RegexOptions.Compiled);
public override string Extension public override string Extension
{ {
@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
foreach (string line in lines) foreach (string line in lines)
{ {
string s = line.Trim(); string s = line.Trim();
if (regexTimeCodes.Match(s).Success) if (RegexTimeCodes.Match(s).Success)
{ {
try try
{ {