From 66e5a0045980a1b101e6175de646f9140950f163 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 8 Feb 2016 22:14:28 +0100 Subject: [PATCH] Minor refact (casing) --- libse/SubtitleFormats/MidwayInscriberCGX.cs | 6 +++--- libse/SubtitleFormats/SeImageHtmlIndex.cs | 4 ++-- libse/SubtitleFormats/TurboTitler.cs | 2 +- libse/SubtitleFormats/UleadSubtitleFormat.cs | 4 ++-- libse/SubtitleFormats/UnknownSubtitle27.cs | 2 +- libse/SubtitleFormats/UnknownSubtitle4.cs | 2 +- libse/SubtitleFormats/UnknownSubtitle44.cs | 10 +++++----- libse/SubtitleFormats/UnknownSubtitle45.cs | 4 ++-- libse/SubtitleFormats/UnknownSubtitle47.cs | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libse/SubtitleFormats/MidwayInscriberCGX.cs b/libse/SubtitleFormats/MidwayInscriberCGX.cs index 6ce311108..d8b665976 100644 --- a/libse/SubtitleFormats/MidwayInscriberCGX.cs +++ b/libse/SubtitleFormats/MidwayInscriberCGX.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { 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 { @@ -69,9 +69,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { 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(); sb.AppendLine(temp); diff --git a/libse/SubtitleFormats/SeImageHtmlIndex.cs b/libse/SubtitleFormats/SeImageHtmlIndex.cs index 7ed69c795..38b58e0aa 100644 --- a/libse/SubtitleFormats/SeImageHtmlIndex.cs +++ b/libse/SubtitleFormats/SeImageHtmlIndex.cs @@ -9,7 +9,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats /// 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 { @@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats _errorCount = 0; foreach (string line in lines) { - if (line.Contains(".png") && regexTimeCodes.IsMatch(line)) + if (line.Contains(".png") && RegexTimeCodes.IsMatch(line)) { int idx = line.IndexOf(" 0) diff --git a/libse/SubtitleFormats/TurboTitler.cs b/libse/SubtitleFormats/TurboTitler.cs index ef256c5d5..928d23231 100644 --- a/libse/SubtitleFormats/TurboTitler.cs +++ b/libse/SubtitleFormats/TurboTitler.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { 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 { diff --git a/libse/SubtitleFormats/UleadSubtitleFormat.cs b/libse/SubtitleFormats/UleadSubtitleFormat.cs index 52cd4b679..0e3b5da24 100644 --- a/libse/SubtitleFormats/UleadSubtitleFormat.cs +++ b/libse/SubtitleFormats/UleadSubtitleFormat.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { 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 { @@ -82,7 +82,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats foreach (string l2 in lines) { string line = l2.TrimEnd('ഀ'); - if (line.StartsWith('#') && regexTimeCodes.IsMatch(line)) + if (line.StartsWith('#') && RegexTimeCodes.IsMatch(line)) { string[] parts = line.Split(splitChar, StringSplitOptions.RemoveEmptyEntries); if (parts.Length >= 3) diff --git a/libse/SubtitleFormats/UnknownSubtitle27.cs b/libse/SubtitleFormats/UnknownSubtitle27.cs index 72787a68e..0065f4c92 100644 --- a/libse/SubtitleFormats/UnknownSubtitle27.cs +++ b/libse/SubtitleFormats/UnknownSubtitle27.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { 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 { diff --git a/libse/SubtitleFormats/UnknownSubtitle4.cs b/libse/SubtitleFormats/UnknownSubtitle4.cs index 593d42522..5cced18fd 100644 --- a/libse/SubtitleFormats/UnknownSubtitle4.cs +++ b/libse/SubtitleFormats/UnknownSubtitle4.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { 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 { diff --git a/libse/SubtitleFormats/UnknownSubtitle44.cs b/libse/SubtitleFormats/UnknownSubtitle44.cs index 98c20392a..c3a3dc4d9 100644 --- a/libse/SubtitleFormats/UnknownSubtitle44.cs +++ b/libse/SubtitleFormats/UnknownSubtitle44.cs @@ -10,8 +10,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats //>>> "COMMON GROUND" IS FUNDED BY 10:01:04:12 1 //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 Regex regexTimeCodes2 = new Regex(@" \d\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 readonly Regex RegexTimeCodes2 = new Regex(@" \d\d:\d\d:\d\d:\d\d +\d+$", RegexOptions.Compiled); public override string Extension { @@ -84,12 +84,12 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats foreach (string line in lines) { string s = line.Trim(); - var match = regexTimeCodes2.Match(s); + var match = RegexTimeCodes2.Match(s); if (match.Success) { s = s.Substring(0, match.Index + 13).Trim(); } - match = regexTimeCodes1.Match(s); + match = RegexTimeCodes1.Match(s); if (match.Success && match.Index > 13) { 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 } diff --git a/libse/SubtitleFormats/UnknownSubtitle45.cs b/libse/SubtitleFormats/UnknownSubtitle45.cs index a10fd78a1..02295ab9f 100644 --- a/libse/SubtitleFormats/UnknownSubtitle45.cs +++ b/libse/SubtitleFormats/UnknownSubtitle45.cs @@ -9,7 +9,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { //* 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 - 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 { @@ -82,7 +82,7 @@ ST 0 EB 3.10 char[] splitChar = { '.' }; 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('-'); if (temp.Length == 2) diff --git a/libse/SubtitleFormats/UnknownSubtitle47.cs b/libse/SubtitleFormats/UnknownSubtitle47.cs index 49cc54ab4..1df6a2545 100644 --- a/libse/SubtitleFormats/UnknownSubtitle47.cs +++ b/libse/SubtitleFormats/UnknownSubtitle47.cs @@ -8,7 +8,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats public class UnknownSubtitle47 : SubtitleFormat { //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 { @@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats foreach (string line in lines) { string s = line.Trim(); - if (regexTimeCodes.Match(s).Success) + if (RegexTimeCodes.Match(s).Success) { try {