diff --git a/libse/AudioToText/PocketSphinx/SubtitleGenerator.cs b/libse/AudioToText/PocketSphinx/SubtitleGenerator.cs
index 7d261bb6b..abfb4c220 100644
--- a/libse/AudioToText/PocketSphinx/SubtitleGenerator.cs
+++ b/libse/AudioToText/PocketSphinx/SubtitleGenerator.cs
@@ -134,7 +134,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText.PocketSphinx
{
string text = paragraph.Text;
string textNoTags = HtmlUtil.RemoveHtmlTags(text, true);
- if (textNoTags != textNoTags.ToUpper())
+ if (textNoTags != textNoTags.ToUpperInvariant())
{
if (!string.IsNullOrEmpty(text))
{
diff --git a/libse/ContainerFormats/Mp4/Boxes/Mdat.cs b/libse/ContainerFormats/Mp4/Boxes/Mdat.cs
index 2eefcbf11..fd3bd560b 100644
--- a/libse/ContainerFormats/Mp4/Boxes/Mdat.cs
+++ b/libse/ContainerFormats/Mp4/Boxes/Mdat.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
namespace Nikse.SubtitleEdit.Core.ContainerFormats.Mp4.Boxes
@@ -21,11 +20,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Mp4.Boxes
return;
}
- if (Name == "vtte")
- {
- Console.WriteLine("vtte");
- }
- else if (Name == "vttc")
+ if (Name == "vttc")
{
var vttc = new Vttc(fs, Position);
if (vttc.Payload != null)
@@ -33,11 +28,6 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Mp4.Boxes
Payloads.AddRange(vttc.Payload);
}
}
- else if (Name == "payl")
- {
- Console.WriteLine("payl");
- }
-
fs.Seek((long)Position, SeekOrigin.Begin);
}
}
diff --git a/libse/ContainerFormats/Mp4/Boxes/Stbl.cs b/libse/ContainerFormats/Mp4/Boxes/Stbl.cs
index 7be225a16..319200b4c 100644
--- a/libse/ContainerFormats/Mp4/Boxes/Stbl.cs
+++ b/libse/ContainerFormats/Mp4/Boxes/Stbl.cs
@@ -181,7 +181,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Mp4.Boxes
var sb = new StringBuilder();
for (int j = 8; j < data.Length - 3; j++)
{
- string h = data[j].ToString("X2").ToLower();
+ string h = data[j].ToString("X2").ToLowerInvariant();
if (h.Length < 2)
{
h = "0" + h;
diff --git a/libse/Dictionaries/OcrFixReplaceList.cs b/libse/Dictionaries/OcrFixReplaceList.cs
index c0a3178b4..b14fc9df3 100644
--- a/libse/Dictionaries/OcrFixReplaceList.cs
+++ b/libse/Dictionaries/OcrFixReplaceList.cs
@@ -560,7 +560,7 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
public static string FixLowerCaseLInsideUpperCaseWord(string input)
{
var word = input;
- if (word.Length > 3 && word.RemoveChar('l').ToUpper() == word.RemoveChar('l'))
+ if (word.Length > 3 && word.RemoveChar('l').ToUpperInvariant() == word.RemoveChar('l'))
{
if (!word.Contains('<') && !word.Contains('>') && !word.Contains('\''))
{
diff --git a/libse/FixCasing.cs b/libse/FixCasing.cs
index e76370bec..162abbcd9 100644
--- a/libse/FixCasing.cs
+++ b/libse/FixCasing.cs
@@ -160,7 +160,7 @@ namespace Nikse.SubtitleEdit.Core
var words = text.Substring(idx).Split(' ', '\r', '\n', ',', '"', '?', '!', '.', '\'');
if (words.Length > 0 && !notChangeWords.Contains(words[0]))
{
- var upper = text[idx].ToString().ToUpper();
+ var upper = text[idx].ToString().ToUpperInvariant();
text = text.Remove(idx, 1).Insert(idx, upper);
}
}
diff --git a/libse/Forms/FixCommonErrors/FixMissingPeriodsAtEndOfLine.cs b/libse/Forms/FixCommonErrors/FixMissingPeriodsAtEndOfLine.cs
index 98eae4c2d..bb4dcb638 100644
--- a/libse/Forms/FixCommonErrors/FixMissingPeriodsAtEndOfLine.cs
+++ b/libse/Forms/FixCommonErrors/FixMissingPeriodsAtEndOfLine.cs
@@ -71,7 +71,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
!ExpectedString1.Contains(tempNoHtml[tempNoHtml.Length - 1]))
{
string tempTrimmed = tempNoHtml.TrimEnd().TrimEnd('\'', '"', '“', '”').TrimEnd();
- if (tempTrimmed.Length > 0 && !ExpectedString2.Contains(tempTrimmed[tempTrimmed.Length - 1]) && p.Text != p.Text.ToUpper())
+ if (tempTrimmed.Length > 0 && !ExpectedString2.Contains(tempTrimmed[tempTrimmed.Length - 1]) && p.Text != p.Text.ToUpperInvariant())
{
//don't end the sentence if the next word is an I word as they're always capped.
bool isNextCloseAndStartsWithI = isNextClose && (nextText.StartsWith("I ", StringComparison.Ordinal) ||
@@ -117,10 +117,10 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
}
else if (next != null && !string.IsNullOrEmpty(p.Text) && Utilities.AllLettersAndNumbers.Contains(p.Text[p.Text.Length - 1]))
{
- if (p.Text != p.Text.ToUpper())
+ if (p.Text != p.Text.ToUpperInvariant())
{
var st = new StrippableText(next.Text);
- if (st.StrippedText.Length > 0 && st.StrippedText != st.StrippedText.ToUpper() &&
+ if (st.StrippedText.Length > 0 && st.StrippedText != st.StrippedText.ToUpperInvariant() &&
char.IsUpper(st.StrippedText[0]))
{
if (callbacks.AllowFix(p, fixAction))
diff --git a/libse/Forms/FixCommonErrors/FixMusicNotation.cs b/libse/Forms/FixCommonErrors/FixMusicNotation.cs
index 19c987c97..5a61e34c3 100644
--- a/libse/Forms/FixCommonErrors/FixMusicNotation.cs
+++ b/libse/Forms/FixCommonErrors/FixMusicNotation.cs
@@ -73,7 +73,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
if (fix)
{
newText = newText.Replace(ms, Configuration.Settings.Tools.MusicSymbol);
- newText = newText.Replace(ms.ToUpper(), Configuration.Settings.Tools.MusicSymbol);
+ newText = newText.Replace(ms.ToUpperInvariant(), Configuration.Settings.Tools.MusicSymbol);
}
}
}
diff --git a/libse/Forms/FixCommonErrors/FixSpanishInvertedQuestionAndExclamationMarks.cs b/libse/Forms/FixCommonErrors/FixSpanishInvertedQuestionAndExclamationMarks.cs
index 853c50feb..bee504305 100644
--- a/libse/Forms/FixCommonErrors/FixSpanishInvertedQuestionAndExclamationMarks.cs
+++ b/libse/Forms/FixCommonErrors/FixSpanishInvertedQuestionAndExclamationMarks.cs
@@ -29,7 +29,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
wasLastLineClosed = false;
}
- if (!wasLastLineClosed && last.Text == last.Text.ToUpper())
+ if (!wasLastLineClosed && last.Text == last.Text.ToUpperInvariant())
{
wasLastLineClosed = true;
}
diff --git a/libse/Forms/FixCommonErrors/Helper.cs b/libse/Forms/FixCommonErrors/Helper.cs
index 69e9abfa3..4187db353 100644
--- a/libse/Forms/FixCommonErrors/Helper.cs
+++ b/libse/Forms/FixCommonErrors/Helper.cs
@@ -562,7 +562,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
!s.Contains(Environment.NewLine + "-") &&
!(s.StartsWith('[') && s.Contains("]" + Environment.NewLine, StringComparison.Ordinal)) &&
!(s.StartsWith('(') && s.Contains(")" + Environment.NewLine, StringComparison.Ordinal)) &&
- s != s.ToUpper())
+ s != s.ToUpperInvariant())
{
return Utilities.UnbreakLine(text);
}
diff --git a/libse/Forms/RemoveInterjection.cs b/libse/Forms/RemoveInterjection.cs
index a963b31de..1f07b56a4 100644
--- a/libse/Forms/RemoveInterjection.cs
+++ b/libse/Forms/RemoveInterjection.cs
@@ -243,7 +243,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
}
}
- if (temp.Length > 0 && s[0].ToString(CultureInfo.InvariantCulture) != s[0].ToString(CultureInfo.InvariantCulture).ToLower())
+ if (temp.Length > 0 && s[0].ToString(CultureInfo.InvariantCulture) != s[0].ToString(CultureInfo.InvariantCulture).ToLowerInvariant())
{
temp = char.ToUpper(temp[0]) + temp.Substring(1);
doRepeat = true;
diff --git a/libse/Forms/RemoveTextForHI.cs b/libse/Forms/RemoveTextForHI.cs
index f2e7eac19..31a5ae2e9 100644
--- a/libse/Forms/RemoveTextForHI.cs
+++ b/libse/Forms/RemoveTextForHI.cs
@@ -98,7 +98,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
// House 7x01 line 52: and she would like you to do three things:
// Okay or remove???
string noTagText = HtmlUtil.RemoveHtmlTags(text);
- if (noTagText.Length > 10 && noTagText.IndexOf(':') == noTagText.Length - 1 && noTagText != noTagText.ToUpper())
+ if (noTagText.Length > 10 && noTagText.IndexOf(':') == noTagText.Length - 1 && noTagText != noTagText.ToUpperInvariant())
{
return preAssTag + text;
}
@@ -130,7 +130,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
{
var pre = line.Substring(0, indexOfColon);
var noTagPre = HtmlUtil.RemoveHtmlTags(pre, true);
- if (Settings.RemoveTextBeforeColonOnlyUppercase && noTagPre != noTagPre.ToUpper())
+ if (Settings.RemoveTextBeforeColonOnlyUppercase && noTagPre != noTagPre.ToUpperInvariant())
{
bool remove = true;
newText = RemovePartialBeforeColon(line, indexOfColon, newText, count, ref removedInFirstLine, ref removedInSecondLine, ref remove);
@@ -146,7 +146,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
if (indexOf > 0 && indexOf < indexOfColon)
{
var toRemove = s.Substring(indexOf + 1, indexOfColon - indexOf).Trim();
- if (toRemove.Length > 1 && toRemove == toRemove.ToUpper())
+ if (toRemove.Length > 1 && toRemove == toRemove.ToUpperInvariant())
{
s = s.Remove(indexOf + 1, indexOfColon - indexOf);
s = s.Insert(indexOf + 1, " -");
@@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
{
if (count == 1 && newText.Length > 1 && removedInFirstLine &&
!".?!".Contains(newTextNoHtml[newTextNoHtml.Length - 1]) && newText.LineEndsWithHtmlTag(true) &&
- line != line.ToUpper())
+ line != line.ToUpperInvariant())
{
newText += Environment.NewLine;
if (pre.Contains("") && line.Contains("") && !line.Contains(""))
@@ -201,7 +201,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
}
else if (count == 1 && newTextNoHtml.Length > 1 && indexOfColon > 15 && line.Substring(0, indexOfColon).Contains(' ') &&
!".?!".Contains(newTextNoHtml[newTextNoHtml.Length - 1]) && newText.LineEndsWithHtmlTag(true) &&
- line != line.ToUpper())
+ line != line.ToUpperInvariant())
{
newText += Environment.NewLine;
if (pre.Contains("") && line.Contains("") && !line.Contains(""))
@@ -419,7 +419,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
int colonIndex = s2.IndexOf(':');
string start = s2.Substring(0, colonIndex);
- if (!Settings.RemoveTextBeforeColonOnlyUppercase || start == start.ToUpper())
+ if (!Settings.RemoveTextBeforeColonOnlyUppercase || start == start.ToUpperInvariant())
{
int endIndex = start.LastIndexOfAny(endChars);
if (colonIndex > 0 && colonIndex < s2.Length - 1)
@@ -1032,7 +1032,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
private bool IsHIDescription(string text)
{
- text = text.Trim(' ', '(', ')', '[', ']', '?', '{', '}').ToLower();
+ text = text.Trim(' ', '(', ')', '[', ']', '?', '{', '}').ToLowerInvariant();
if (text.Trim().Replace("mr. ", string.Empty).Replace("mrs. ", string.Empty).Replace("dr. ", string.Empty).Contains(' '))
{
AddWarning();
@@ -1047,8 +1047,8 @@ namespace Nikse.SubtitleEdit.Core.Forms
private static string GetRemovedString(string oldText, string newText)
{
- oldText = oldText.ToLower();
- newText = newText.ToLower();
+ oldText = oldText.ToLowerInvariant();
+ newText = newText.ToLowerInvariant();
int start = oldText.IndexOf(newText, StringComparison.Ordinal);
string result;
@@ -1280,7 +1280,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
foreach (var line in text.SplitToLines())
{
var lineNoHtml = HtmlUtil.RemoveHtmlTags(line, true);
- if (lineNoHtml == lineNoHtml.ToUpper() && lineNoHtml != lineNoHtml.ToLower())
+ if (lineNoHtml == lineNoHtml.ToUpperInvariant() && lineNoHtml != lineNoHtml.ToLowerInvariant())
{
var temp = lineNoHtml.TrimEnd(endTrimChars).Trim().Trim(trimChars);
if (temp.Length == 1 || temp == "YES" || temp == "NO" || temp == "WHY" || temp == "HI" || temp == "OK")
@@ -1307,8 +1307,8 @@ namespace Nikse.SubtitleEdit.Core.Forms
}
interjectionList.Add(s);
- interjectionList.Add(s.ToUpper());
- interjectionList.Add(s.ToLower());
+ interjectionList.Add(s.ToUpperInvariant());
+ interjectionList.Add(s.ToLowerInvariant());
interjectionList.Add(s.CapitalizeFirstLetter());
}
diff --git a/libse/HtmlUtil.cs b/libse/HtmlUtil.cs
index d0f4c7d88..65a9045e0 100644
--- a/libse/HtmlUtil.cs
+++ b/libse/HtmlUtil.cs
@@ -481,7 +481,7 @@ namespace Nikse.SubtitleEdit.Core
return false;
}
- var allLower = text.ToLower();
+ var allLower = text.ToLowerInvariant();
if (allLower.StartsWith("http://", StringComparison.Ordinal) || allLower.StartsWith("https://", StringComparison.Ordinal) ||
allLower.StartsWith("www.", StringComparison.Ordinal) || allLower.EndsWith(".org", StringComparison.Ordinal) ||
allLower.EndsWith(".com", StringComparison.Ordinal) || allLower.EndsWith(".net", StringComparison.Ordinal))
@@ -853,8 +853,8 @@ namespace Nikse.SubtitleEdit.Core
{
text = text.Replace("<" + tag + ">", string.Empty);
text = text.Replace("" + tag + ">", string.Empty);
- text = text.Replace("<" + tag.ToUpper() + ">", string.Empty);
- text = text.Replace("" + tag.ToUpper() + ">", string.Empty);
+ text = text.Replace("<" + tag.ToUpperInvariant() + ">", string.Empty);
+ text = text.Replace("" + tag.ToUpperInvariant() + ">", string.Empty);
}
else
{
diff --git a/libse/LanguageAutoDetect.cs b/libse/LanguageAutoDetect.cs
index 62bd215fe..7b044052f 100644
--- a/libse/LanguageAutoDetect.cs
+++ b/libse/LanguageAutoDetect.cs
@@ -560,7 +560,7 @@ namespace Nikse.SubtitleEdit.Core
}
int count;
- switch (shortName.Replace("-", "_").ToLower())
+ switch (shortName.Replace("-", "_").ToLowerInvariant())
{
case "da_dk":
count = GetCount(text, AutoDetectWordsDanish);
@@ -1076,7 +1076,7 @@ namespace Nikse.SubtitleEdit.Core
{ // keep utf-8 encoding if it's default
encoding = Encoding.UTF8;
}
- else if (couldBeUtf8 && fileName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase) && Encoding.Default.GetString(buffer).ToLower().Replace('\'', '"').Contains("encoding=\"utf-8\""))
+ else if (couldBeUtf8 && fileName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase) && Encoding.Default.GetString(buffer).ToLowerInvariant().Replace('\'', '"').Contains("encoding=\"utf-8\""))
{ // keep utf-8 encoding for xml files with utf-8 in header (without any utf-8 encoded characters, but with only allowed utf-8 characters)
encoding = Encoding.UTF8;
}
diff --git a/libse/Settings.cs b/libse/Settings.cs
index 8deb10f38..6a12764a6 100644
--- a/libse/Settings.cs
+++ b/libse/Settings.cs
@@ -494,7 +494,7 @@ $HorzAlign = Center
}
else
{
- string hex = Guid.NewGuid().ToString().RemoveChar('-').ToLower();
+ string hex = Guid.NewGuid().ToString().RemoveChar('-').ToLowerInvariant();
hex = hex.Insert(8, "-").Insert(13, "-").Insert(18, "-").Insert(23, "-");
CurrentDCinemaSubtitleId = hex;
CurrentDCinemaLanguage = "English";
diff --git a/libse/SpellCheck/SpellCheckWordLists.cs b/libse/SpellCheck/SpellCheckWordLists.cs
index 24cad1180..674bed19b 100644
--- a/libse/SpellCheck/SpellCheckWordLists.cs
+++ b/libse/SpellCheck/SpellCheckWordLists.cs
@@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
foreach (string namesItem in _names)
{
- _namesListUppercase.Add(namesItem.ToUpper());
+ _namesListUppercase.Add(namesItem.ToUpperInvariant());
}
if (languageName.StartsWith("en_", StringComparison.OrdinalIgnoreCase))
@@ -76,7 +76,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
{
foreach (XmlNode node in xmlNodeList)
{
- string word = node.InnerText.Trim().ToLower();
+ string word = node.InnerText.Trim().ToLowerInvariant();
if (word.Contains(' '))
{
_userPhraseList.Add(word);
@@ -224,11 +224,11 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
}
_names.Remove(word);
- _namesListUppercase.Remove(word.ToUpper());
+ _namesListUppercase.Remove(word.ToUpperInvariant());
if (_languageName.StartsWith("en_", StringComparison.Ordinal) && !word.EndsWith('s'))
{
_names.Remove(word + "s");
- _namesListUppercase.Remove(word.ToUpper() + "S");
+ _namesListUppercase.Remove(word.ToUpperInvariant() + "S");
}
if (!word.EndsWith('s'))
{
@@ -426,16 +426,16 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
}
_names.Add(word);
- _namesListUppercase.Add(word.ToUpper());
+ _namesListUppercase.Add(word.ToUpperInvariant());
if (_languageName.StartsWith("en_", StringComparison.Ordinal) && !word.EndsWith('s'))
{
_names.Add(word + "s");
- _namesListUppercase.Add(word.ToUpper() + "S");
+ _namesListUppercase.Add(word.ToUpperInvariant() + "S");
}
if (!word.EndsWith('s'))
{
_namesListWithApostrophe.Add(word + "'s");
- _namesListUppercase.Add(word.ToUpper() + "'S");
+ _namesListUppercase.Add(word.ToUpperInvariant() + "'S");
}
if (!word.EndsWith('\''))
{
@@ -456,7 +456,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
return false;
}
- word = word.Trim().ToLower();
+ word = word.Trim().ToLowerInvariant();
if (word.Length == 0 || _userWordList.Contains(word))
{
return false;
@@ -487,7 +487,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
public bool HasUserWord(string word)
{
- string s = word.ToLower();
+ string s = word.ToLowerInvariant();
return _userWordList.Contains(s) || (s.StartsWith('\'') || s.EndsWith('\'')) && _userWordList.Contains(s.Trim('\''));
}
diff --git a/libse/StrippableText.cs b/libse/StrippableText.cs
index 55609b822..115253f53 100644
--- a/libse/StrippableText.cs
+++ b/libse/StrippableText.cs
@@ -116,7 +116,7 @@ namespace Nikse.SubtitleEdit.Core
Post = Post.Remove(0, 1);
}
- string lower = StrippedText.ToLower();
+ string lower = StrippedText.ToLowerInvariant();
int idName = 0;
foreach (string name in nameList)
{
@@ -147,7 +147,7 @@ namespace Nikse.SubtitleEdit.Core
originalNames.Add(originalName);
StrippedText = StrippedText.Remove(start, name.Length);
StrippedText = StrippedText.Insert(start, GetAndInsertNextId(replaceIds, replaceNames, name, idName++));
- lower = StrippedText.ToLower();
+ lower = StrippedText.ToLowerInvariant();
}
}
if (start + 3 > lower.Length)
diff --git a/libse/SubtitleFormats/AdvancedSubStationAlpha.cs b/libse/SubtitleFormats/AdvancedSubStationAlpha.cs
index b98608e0f..8b9e826f1 100644
--- a/libse/SubtitleFormats/AdvancedSubStationAlpha.cs
+++ b/libse/SubtitleFormats/AdvancedSubStationAlpha.cs
@@ -873,7 +873,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
// switch to rrggbb from bbggrr
color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2);
- color = color.ToLower();
+ color = color.ToLowerInvariant();
text = text.Remove(start, end - start + 1);
if (italic)
@@ -918,7 +918,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
// switch to rrggbb from bbggrr
color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2);
- color = color.ToLower();
+ color = color.ToLowerInvariant();
text = text.Remove(start, end - start + 1);
if (italic)
@@ -1074,7 +1074,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
color = color.PadLeft(6, '0');
// switch to rrggbb from bbggrr
color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2);
- color = color.ToLower();
+ color = color.ToLowerInvariant();
extraTags += " color=\"" + color + "\"";
}
@@ -1198,7 +1198,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
}
else if (eventsStarted)
{
- string s = line.Trim().ToLower();
+ string s = line.Trim().ToLowerInvariant();
if (line.Length > 10 && s.StartsWith("format:", StringComparison.Ordinal))
{
indexLayer = -1;
@@ -1624,12 +1624,12 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
foreach (string line in header.SplitToLines())
{
- string s = line.Trim().ToLower();
+ string s = line.Trim().ToLowerInvariant();
if (s.StartsWith("format:", StringComparison.Ordinal))
{
if (line.Length > 10)
{
- var format = line.Substring(8).ToLower().Split(',');
+ var format = line.Substring(8).ToLowerInvariant().Split(',');
styleCount = format.Length;
for (int i = 0; i < format.Length; i++)
{
@@ -1722,7 +1722,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
Color dummyColor = Color.FromArgb(9, 14, 16, 26);
for (int i = 0; i < format.Length; i++)
{
- string f = format[i].Trim().ToLower();
+ string f = format[i].Trim().ToLowerInvariant();
if (i == nameIndex)
{
if (f.Length == 0)
@@ -1938,15 +1938,15 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
foreach (string line in header.SplitToLines())
{
- string s = line.Trim().ToLower();
+ string s = line.Trim().ToLowerInvariant();
if (s.StartsWith("format:", StringComparison.Ordinal))
{
if (line.Length > 10)
{
- var format = line.ToLower().Substring(8).Split(',');
+ var format = line.ToLowerInvariant().Substring(8).Split(',');
for (int i = 0; i < format.Length; i++)
{
- string f = format[i].Trim().ToLower();
+ string f = format[i].Trim().ToLowerInvariant();
if (f == "name")
{
nameIndex = i;
@@ -2030,7 +2030,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
var format = line.Substring(6).Split(',');
for (int i = 0; i < format.Length; i++)
{
- string f = format[i].Trim().ToLower();
+ string f = format[i].Trim().ToLowerInvariant();
if (i == nameIndex)
{
style.Name = format[i].Trim();
diff --git a/libse/SubtitleFormats/DCinemaInterop.cs b/libse/SubtitleFormats/DCinemaInterop.cs
index 16cc09c63..e52f96090 100644
--- a/libse/SubtitleFormats/DCinemaInterop.cs
+++ b/libse/SubtitleFormats/DCinemaInterop.cs
@@ -100,7 +100,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
hex = hex.Insert(8, "-").Insert(13, "-").Insert(18, "-").Insert(23, "-");
string xmlStructure = "" + Environment.NewLine +
- " " + hex.ToLower() + "" + Environment.NewLine +
+ " " + hex.ToLowerInvariant() + "" + Environment.NewLine +
" " + Environment.NewLine +
" 1" + Environment.NewLine +
" " + languageEnglishName + "" + Environment.NewLine +
@@ -138,9 +138,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xml.DocumentElement.SelectSingleNode("LoadFont").Attributes["Id"].InnerText = loadedFontId;
int fontSize = ss.CurrentDCinemaFontSize;
xml.DocumentElement.SelectSingleNode("Font").Attributes["Id"].InnerText = loadedFontId;
- xml.DocumentElement.SelectSingleNode("Font").Attributes["Color"].InnerText = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontColor).TrimStart('#').ToUpper();
+ xml.DocumentElement.SelectSingleNode("Font").Attributes["Color"].InnerText = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontColor).TrimStart('#').ToUpperInvariant();
xml.DocumentElement.SelectSingleNode("Font").Attributes["Effect"].InnerText = ss.CurrentDCinemaFontEffect;
- xml.DocumentElement.SelectSingleNode("Font").Attributes["EffectColor"].InnerText = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontEffectColor).TrimStart('#').ToUpper();
+ xml.DocumentElement.SelectSingleNode("Font").Attributes["EffectColor"].InnerText = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontEffectColor).TrimStart('#').ToUpperInvariant();
xml.DocumentElement.SelectSingleNode("Font").Attributes["Size"].InnerText = ss.CurrentDCinemaFontSize.ToString();
var mainListFont = xml.DocumentElement.SelectSingleNode("Font");
@@ -318,7 +318,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
c = c.Trim('"').Trim('\'').Trim();
if (c.StartsWith('#'))
{
- c = c.TrimStart('#').ToUpper().PadLeft(8, 'F');
+ c = c.TrimStart('#').ToUpperInvariant().PadLeft(8, 'F');
}
fontColors.Push(c);
diff --git a/libse/SubtitleFormats/DCinemaSmpte2007.cs b/libse/SubtitleFormats/DCinemaSmpte2007.cs
index 0377fda3d..617f5c9db 100644
--- a/libse/SubtitleFormats/DCinemaSmpte2007.cs
+++ b/libse/SubtitleFormats/DCinemaSmpte2007.cs
@@ -165,10 +165,10 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xml.DocumentElement.SelectSingleNode("dcst:LoadFont", nsmgr).Attributes["ID"].Value = loadedFontId;
xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Size"].Value = fontSize.ToString();
- xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Color"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontColor).TrimStart('#').ToUpper();
+ xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Color"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontColor).TrimStart('#').ToUpperInvariant();
xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["ID"].Value = loadedFontId;
xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Effect"].Value = ss.CurrentDCinemaFontEffect;
- xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["EffectColor"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontEffectColor).TrimStart('#').ToUpper();
+ xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["EffectColor"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontEffectColor).TrimStart('#').ToUpperInvariant();
XmlNode mainListFont = xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr);
int no = 0;
@@ -331,7 +331,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
c = c.Trim('"').Trim('\'').Trim();
if (c.StartsWith('#'))
{
- c = c.TrimStart('#').ToUpper().PadLeft(8, 'F');
+ c = c.TrimStart('#').ToUpperInvariant().PadLeft(8, 'F');
}
fontColors.Push(c);
@@ -795,7 +795,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
private static string GetColorStringFromDCinema(string p)
{
- string s = p.ToLower().Trim();
+ string s = p.ToLowerInvariant().Trim();
if (s.Replace("#", string.Empty).
Replace("0", string.Empty).
Replace("1", string.Empty).
diff --git a/libse/SubtitleFormats/DCinemaSmpte2010.cs b/libse/SubtitleFormats/DCinemaSmpte2010.cs
index eeed62aaf..126371944 100644
--- a/libse/SubtitleFormats/DCinemaSmpte2010.cs
+++ b/libse/SubtitleFormats/DCinemaSmpte2010.cs
@@ -166,10 +166,10 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xml.DocumentElement.SelectSingleNode("dcst:LoadFont", nsmgr).Attributes["ID"].Value = loadedFontId;
xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Size"].Value = fontSize.ToString();
- xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Color"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontColor).TrimStart('#').ToUpper();
+ xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Color"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontColor).TrimStart('#').ToUpperInvariant();
xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["ID"].Value = loadedFontId;
xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["Effect"].Value = ss.CurrentDCinemaFontEffect;
- xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["EffectColor"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontEffectColor).TrimStart('#').ToUpper();
+ xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr).Attributes["EffectColor"].Value = "FF" + Utilities.ColorToHex(ss.CurrentDCinemaFontEffectColor).TrimStart('#').ToUpperInvariant();
XmlNode mainListFont = xml.DocumentElement.SelectSingleNode("dcst:SubtitleList/dcst:Font", nsmgr);
int no = 0;
@@ -332,7 +332,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
c = c.Trim('"').Trim('\'').Trim();
if (c.StartsWith('#'))
{
- c = c.TrimStart('#').ToUpper().PadLeft(8, 'F');
+ c = c.TrimStart('#').ToUpperInvariant().PadLeft(8, 'F');
}
fontColors.Push(c);
diff --git a/libse/SubtitleFormats/Ebu.cs b/libse/SubtitleFormats/Ebu.cs
index a7a9dd258..61a181c14 100644
--- a/libse/SubtitleFormats/Ebu.cs
+++ b/libse/SubtitleFormats/Ebu.cs
@@ -578,7 +578,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
private static string GetNearestEbuColorCode(string color, Encoding encoding)
{
- color = color.ToLower();
+ color = color.ToLowerInvariant();
if (color == "black" || color == "000000")
{
return encoding.GetString(new byte[] { 0x00 }); // black
diff --git a/libse/SubtitleFormats/FinalCutProTest2Xml.cs b/libse/SubtitleFormats/FinalCutProTest2Xml.cs
index d88589fe2..02238433c 100644
--- a/libse/SubtitleFormats/FinalCutProTest2Xml.cs
+++ b/libse/SubtitleFormats/FinalCutProTest2Xml.cs
@@ -91,7 +91,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xml.LoadXml(xmlStructure);
xml.DocumentElement.SelectSingleNode("sequence").Attributes["id"].Value = title;
xml.DocumentElement.SelectSingleNode("sequence/name").InnerText = title;
- xml.DocumentElement.SelectSingleNode("sequence/uuid").InnerText = Guid.NewGuid().ToString().ToUpper();
+ xml.DocumentElement.SelectSingleNode("sequence/uuid").InnerText = Guid.NewGuid().ToString().ToUpperInvariant();
if (!string.IsNullOrEmpty(subtitle.Header))
{
var header = new XmlDocument();
@@ -237,7 +237,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var styleNameNode = valueEntries[no].SelectSingleNode("name");
if (styleNameNode != null)
{
- string styleName = styleNameNode.InnerText.ToLower().Trim();
+ string styleName = styleNameNode.InnerText.ToLowerInvariant().Trim();
italic = styleName == "italic" || styleName == "bold/italic";
bold = styleName == "bold" || styleName == "bold/italic";
}
@@ -262,7 +262,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var styleNameNode = valueEntries[no].SelectSingleNode("name");
if (styleNameNode != null)
{
- string styleName = styleNameNode.InnerText.ToLower().Trim();
+ string styleName = styleNameNode.InnerText.ToLowerInvariant().Trim();
italic = styleName == "italic" || styleName == "bold/italic";
bold = styleName == "bold" || styleName == "bold/italic";
}
diff --git a/libse/SubtitleFormats/FinalCutProTextXml.cs b/libse/SubtitleFormats/FinalCutProTextXml.cs
index ee88358fc..696312824 100644
--- a/libse/SubtitleFormats/FinalCutProTextXml.cs
+++ b/libse/SubtitleFormats/FinalCutProTextXml.cs
@@ -173,7 +173,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xml.DocumentElement.SelectSingleNode("sequence").Attributes["id"].Value = title;
xml.DocumentElement.SelectSingleNode("sequence/name").InnerText = title;
- xml.DocumentElement.SelectSingleNode("sequence/uuid").InnerText = Guid.NewGuid().ToString().ToUpper();
+ xml.DocumentElement.SelectSingleNode("sequence/uuid").InnerText = Guid.NewGuid().ToString().ToUpperInvariant();
if (!string.IsNullOrEmpty(subtitle.Header))
{
var header = new XmlDocument();
@@ -322,7 +322,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var styleNameNode = valueEntries[no].SelectSingleNode("name");
if (styleNameNode != null)
{
- string styleName = styleNameNode.InnerText.ToLower().Trim();
+ string styleName = styleNameNode.InnerText.ToLowerInvariant().Trim();
italic = styleName == "italic" || styleName == "bold/italic";
bold = styleName == "bold" || styleName == "bold/italic";
}
@@ -347,7 +347,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var styleNameNode = valueEntries[no].SelectSingleNode("name");
if (styleNameNode != null)
{
- string styleName = styleNameNode.InnerText.ToLower().Trim();
+ string styleName = styleNameNode.InnerText.ToLowerInvariant().Trim();
italic = styleName == "italic" || styleName == "bold/italic";
bold = styleName == "bold" || styleName == "bold/italic";
}
diff --git a/libse/SubtitleFormats/FinalCutProXml.cs b/libse/SubtitleFormats/FinalCutProXml.cs
index ea376b944..e5489a438 100644
--- a/libse/SubtitleFormats/FinalCutProXml.cs
+++ b/libse/SubtitleFormats/FinalCutProXml.cs
@@ -386,7 +386,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
xml.LoadXml(xmlStructure);
xml.DocumentElement.SelectSingleNode("sequence").Attributes["id"].Value = title;
xml.DocumentElement.SelectSingleNode("sequence/name").InnerText = title;
- xml.DocumentElement.SelectSingleNode("sequence/uuid").InnerText = Guid.NewGuid().ToString().ToUpper();
+ xml.DocumentElement.SelectSingleNode("sequence/uuid").InnerText = Guid.NewGuid().ToString().ToUpperInvariant();
if (!string.IsNullOrEmpty(subtitle.Header))
{
var header = new XmlDocument();
@@ -581,7 +581,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var styleNameNode = valueEntries[no].SelectSingleNode("name");
if (styleNameNode != null)
{
- string styleName = styleNameNode.InnerText.ToLower().Trim();
+ string styleName = styleNameNode.InnerText.ToLowerInvariant().Trim();
italic = styleName == "italic" || styleName == "bold/italic";
bold = styleName == "bold" || styleName == "bold/italic";
}
@@ -606,7 +606,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var styleNameNode = valueEntries[no].SelectSingleNode("name");
if (styleNameNode != null)
{
- string styleName = styleNameNode.InnerText.ToLower().Trim();
+ string styleName = styleNameNode.InnerText.ToLowerInvariant().Trim();
italic = styleName == "italic" || styleName == "bold/italic";
bold = styleName == "bold" || styleName == "bold/italic";
}
diff --git a/libse/SubtitleFormats/FinalDraftTemplate2.cs b/libse/SubtitleFormats/FinalDraftTemplate2.cs
index 34da7ecde..00cc71886 100644
--- a/libse/SubtitleFormats/FinalDraftTemplate2.cs
+++ b/libse/SubtitleFormats/FinalDraftTemplate2.cs
@@ -58,7 +58,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
actor = actor.Replace("( CONT’D )", string.Empty).Trim();
actor = actor.Replace("(CONT'D)", string.Empty).Trim();
actor = actor.Replace("(CONT’D)", string.Empty).Trim();
- actor = actor.ToUpper();
+ actor = actor.ToUpperInvariant();
}
else if (paragraphType != null && lowercaseChosencategories.Contains(paragraphType.InnerText.ToLowerInvariant()))
{
diff --git a/libse/SubtitleFormats/MacCaption.cs b/libse/SubtitleFormats/MacCaption.cs
index 32529a5d8..86bb9c626 100644
--- a/libse/SubtitleFormats/MacCaption.cs
+++ b/libse/SubtitleFormats/MacCaption.cs
@@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
//
///////////////////////////////////////////////////////////////////////////////////");
sb.AppendLine();
- sb.AppendLine("UUID=" + Guid.NewGuid().ToString().ToUpper());// UUID=9F6112F4-D9D0-4AAF-AA95-854710D3B57A
+ sb.AppendLine("UUID=" + Guid.NewGuid().ToString().ToUpperInvariant());// UUID=9F6112F4-D9D0-4AAF-AA95-854710D3B57A
sb.AppendLine("Creation Program=Subtitle Edit");
sb.AppendLine("Creation Date=" + DateTime.Now.ToLongDateString());
sb.AppendLine("Creation Time=" + DateTime.Now.ToShortTimeString());
diff --git a/libse/SubtitleFormats/Sami.cs b/libse/SubtitleFormats/Sami.cs
index 0123fc040..7dd18d8d6 100644
--- a/libse/SubtitleFormats/Sami.cs
+++ b/libse/SubtitleFormats/Sami.cs
@@ -34,7 +34,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var language = LanguageAutoDetect.AutoDetectGoogleLanguage(subtitle);
var ci = CultureInfo.GetCultureInfo(language);
language = CultureInfo.CreateSpecificCulture(ci.Name).Name;
- string languageTag = $"{language.Replace("-", string.Empty).ToUpper()}CC";
+ string languageTag = $"{language.Replace("-", string.Empty).ToUpperInvariant()}CC";
string languageName = ci.EnglishName;
string languageStyle = $".{languageTag} [ name: {languageName}; lang: {language.Replace("_", "-")} ; SAMIType: CC ; ]";
languageStyle = languageStyle.Replace("[", "{").Replace("]", "}");
@@ -225,7 +225,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
string language = LanguageAutoDetect.AutoDetectGoogleLanguage(subtitle);
var ci = CultureInfo.GetCultureInfo(language);
language = CultureInfo.CreateSpecificCulture(ci.Name).Name;
- string languageTag = $"{language.Replace("-", string.Empty).ToUpper()}CC";
+ string languageTag = $"{language.Replace("-", string.Empty).ToUpperInvariant()}CC";
return new List { languageTag };
}
@@ -239,7 +239,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
string allInput = sb.ToString();
- string allInputLower = allInput.ToLower();
+ string allInputLower = allInput.ToLowerInvariant();
if (!allInputLower.Contains(" 0 && text.Substring(st, 2).ToUpperInvariant() != "" && text.Substring(et, 4).ToUpper() != "
")
+ while (et < text.Length - 5 && text.Substring(et, 3).ToUpperInvariant() != "" && text.Substring(et, 4).ToUpper() != "
")
{
et++;
}
@@ -361,7 +361,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
text = text.Replace("
"))
+ (subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].Text.ToUpperInvariant().Trim() == ""))
{
subtitle.Paragraphs.RemoveAt(subtitle.Paragraphs.Count - 1);
}
diff --git a/libse/SubtitleFormats/SmilTimesheetData.cs b/libse/SubtitleFormats/SmilTimesheetData.cs
index de008a08d..2d465e701 100644
--- a/libse/SubtitleFormats/SmilTimesheetData.cs
+++ b/libse/SubtitleFormats/SmilTimesheetData.cs
@@ -110,7 +110,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
string allInput = sb.ToString();
- string allInputLower = allInput.ToLower();
+ string allInputLower = allInput.ToLowerInvariant();
const string syncTag = " 10 && s.StartsWith("format:", StringComparison.Ordinal))
{
var format = s.Substring(8).Split(',');
diff --git a/libse/SubtitleFormats/TimedText10.cs b/libse/SubtitleFormats/TimedText10.cs
index e051f6ba5..789e7933b 100644
--- a/libse/SubtitleFormats/TimedText10.cs
+++ b/libse/SubtitleFormats/TimedText10.cs
@@ -1428,7 +1428,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
if (p.Language != null)
{
- string l = p.Language.ToLower().Trim();
+ string l = p.Language.ToLowerInvariant().Trim();
if (!list.Contains(l))
{
list.Add(l);
diff --git a/libse/SubtitleFormats/UnknownSubtitle60.cs b/libse/SubtitleFormats/UnknownSubtitle60.cs
index dd6d30f24..89cbdce86 100644
--- a/libse/SubtitleFormats/UnknownSubtitle60.cs
+++ b/libse/SubtitleFormats/UnknownSubtitle60.cs
@@ -34,7 +34,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
sb.AppendLine(EncodeTimeCode(p.EndTime));
if (!string.IsNullOrEmpty(p.Actor))
{
- sb.AppendLine(p.Actor.ToUpper());
+ sb.AppendLine(p.Actor.ToUpperInvariant());
}
else
{
@@ -94,7 +94,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
else if (!string.IsNullOrWhiteSpace(line) && expectActor)
{
- if (line == line.ToUpper())
+ if (line == line.ToUpperInvariant())
{
p.Actor = line;
}
diff --git a/libse/Utilities.cs b/libse/Utilities.cs
index 3cd24be51..2535bdbba 100644
--- a/libse/Utilities.cs
+++ b/libse/Utilities.cs
@@ -1183,7 +1183,7 @@ namespace Nikse.SubtitleEdit.Core
userWordDictionary.Load(userWordListXmlFileName);
foreach (XmlNode node in userWordDictionary.DocumentElement.SelectNodes("word"))
{
- string s = node.InnerText.ToLower();
+ string s = node.InnerText.ToLowerInvariant();
if (!userWordList.Contains(s))
{
userWordList.Add(s);
@@ -1206,7 +1206,7 @@ namespace Nikse.SubtitleEdit.Core
{
foreach (XmlNode node in nodes)
{
- string s = node.InnerText.ToLower();
+ string s = node.InnerText.ToLowerInvariant();
if (!userWordList.Contains(s))
{
userWordList.Add(s);
@@ -1217,8 +1217,8 @@ namespace Nikse.SubtitleEdit.Core
return userWordListXmlFileName;
}
- public static readonly string UppercaseLetters = Configuration.Settings.General.UppercaseLetters.ToUpper();
- public static readonly string LowercaseLetters = Configuration.Settings.General.UppercaseLetters.ToLower();
+ public static readonly string UppercaseLetters = Configuration.Settings.General.UppercaseLetters.ToUpperInvariant();
+ public static readonly string LowercaseLetters = Configuration.Settings.General.UppercaseLetters.ToLowerInvariant();
public static readonly string LowercaseLettersWithNumbers = LowercaseLetters + "0123456789";
public static readonly string AllLetters = UppercaseLetters + LowercaseLetters;
public static readonly string AllLettersAndNumbers = UppercaseLetters + LowercaseLettersWithNumbers;
@@ -2284,7 +2284,7 @@ namespace Nikse.SubtitleEdit.Core
var endIdx = text.IndexOf('>', idx + 6);
if (endIdx > idx && endIdx < text.Length - 8)
{
- var color = text.Substring(idx, (endIdx - idx) + 1).ToLower();
+ var color = text.Substring(idx, (endIdx - idx) + 1).ToLowerInvariant();
text = RemoveSpaceBeforeAfterTag(text, color);
}
}
diff --git a/libse/VobSub/VobSubWriter.cs b/libse/VobSub/VobSubWriter.cs
index dcec2fa20..e5dd26dc3 100644
--- a/libse/VobSub/VobSubWriter.cs
+++ b/libse/VobSub/VobSubWriter.cs
@@ -140,7 +140,7 @@ namespace Nikse.SubtitleEdit.Core.VobSub
public void WriteParagraph(Paragraph p, Bitmap bmp, ContentAlignment alignment, Point? overridePosition = null) // inspired by code from SubtitleCreator
{
// timestamp: 00:00:33:900, filepos: 000000000
- _idx.AppendLine($"timestamp: {p.StartTime.Hours:00}:{p.StartTime.Minutes:00}:{p.StartTime.Seconds:00}:{p.StartTime.Milliseconds:000}, filepos: {_subFile.Position.ToString("X").PadLeft(9, '0').ToLower()}");
+ _idx.AppendLine($"timestamp: {p.StartTime.Hours:00}:{p.StartTime.Minutes:00}:{p.StartTime.Seconds:00}:{p.StartTime.Milliseconds:000}, filepos: {_subFile.Position.ToString("X").PadLeft(9, '0').ToLowerInvariant()}");
var nbmp = new NikseBitmap(bmp);
_emphasis2 = nbmp.ConverToFourColors(_background, _pattern, _emphasis1, _useInnerAntialiasing);
@@ -429,7 +429,7 @@ id: " + _languageNameShort + @", index: 0
private static string ToHexColor(Color c)
{
- return (c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2")).ToLower();
+ return (c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2")).ToLowerInvariant();
}
private void ReleaseManagedResources()
diff --git a/src/Forms/AddToUserDic.cs b/src/Forms/AddToUserDic.cs
index 529896f15..0aecff150 100644
--- a/src/Forms/AddToUserDic.cs
+++ b/src/Forms/AddToUserDic.cs
@@ -35,7 +35,7 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonOK_Click(object sender, EventArgs e)
{
- NewWord = textBoxAddName.Text.RemoveControlCharacters().Trim().ToLower();
+ NewWord = textBoxAddName.Text.RemoveControlCharacters().Trim().ToLowerInvariant();
if (NewWord.Length == 0)
{
DialogResult = DialogResult.Cancel;
diff --git a/src/Forms/AddWaveformBatch.cs b/src/Forms/AddWaveformBatch.cs
index 3e62906cb..669a813a2 100644
--- a/src/Forms/AddWaveformBatch.cs
+++ b/src/Forms/AddWaveformBatch.cs
@@ -146,7 +146,7 @@ namespace Nikse.SubtitleEdit.Forms
{
try
{
- string ext = Path.GetExtension(fileName).ToLower();
+ string ext = Path.GetExtension(fileName).ToLowerInvariant();
if (Utilities.VideoFileExtensions.Contains(ext))
{
var fi = new FileInfo(fileName);
@@ -268,34 +268,34 @@ namespace Nikse.SubtitleEdit.Forms
// check for delay in matroska files
var audioTrackNames = new List();
var mkvAudioTrackNumbers = new Dictionary();
- if (fileName.ToLower().EndsWith(".mkv", StringComparison.OrdinalIgnoreCase))
+ if (fileName.ToLowerInvariant().EndsWith(".mkv", StringComparison.OrdinalIgnoreCase))
{
- MatroskaFile matroska = null;
try
{
- matroska = new MatroskaFile(fileName);
-
- if (matroska.IsValid)
+ using (MatroskaFile matroska = new MatroskaFile(fileName))
{
- foreach (var track in matroska.GetTracks())
+ if (matroska.IsValid)
{
- if (track.IsAudio)
+ foreach (var track in matroska.GetTracks())
{
- if (track.CodecId != null && track.Language != null)
+ if (track.IsAudio)
{
- audioTrackNames.Add("#" + track.TrackNumber + ": " + track.CodecId.Replace("\0", string.Empty) + " - " + track.Language.Replace("\0", string.Empty));
- }
- else
- {
- audioTrackNames.Add("#" + track.TrackNumber);
- }
+ if (track.CodecId != null && track.Language != null)
+ {
+ audioTrackNames.Add("#" + track.TrackNumber + ": " + track.CodecId.Replace("\0", string.Empty) + " - " + track.Language.Replace("\0", string.Empty));
+ }
+ else
+ {
+ audioTrackNames.Add("#" + track.TrackNumber);
+ }
- mkvAudioTrackNumbers.Add(mkvAudioTrackNumbers.Count, track.TrackNumber);
+ mkvAudioTrackNumbers.Add(mkvAudioTrackNumbers.Count, track.TrackNumber);
+ }
+ }
+ if (mkvAudioTrackNumbers.Count > 0)
+ {
+ _delayInMilliseconds = (int)matroska.GetTrackStartTime(mkvAudioTrackNumbers[0]);
}
- }
- if (mkvAudioTrackNumbers.Count > 0)
- {
- _delayInMilliseconds = (int)matroska.GetTrackStartTime(mkvAudioTrackNumbers[0]);
}
}
}
@@ -303,10 +303,6 @@ namespace Nikse.SubtitleEdit.Forms
{
_delayInMilliseconds = 0;
}
- finally
- {
- matroska?.Dispose();
- }
}
updateStatus(Configuration.Settings.Language.AddWaveformBatch.Calculating);
diff --git a/src/Forms/AudioToText.cs b/src/Forms/AudioToText.cs
index f712091c1..34fbb01eb 100644
--- a/src/Forms/AudioToText.cs
+++ b/src/Forms/AudioToText.cs
@@ -118,7 +118,7 @@ namespace Nikse.SubtitleEdit.Forms
// check for delay in matroska files
var mkvAudioTrackNumbers = new Dictionary();
- if (_videoFileName.ToLower().EndsWith(".mkv", StringComparison.OrdinalIgnoreCase))
+ if (_videoFileName.ToLowerInvariant().EndsWith(".mkv", StringComparison.OrdinalIgnoreCase))
{
MatroskaFile matroska = null;
try
diff --git a/src/Forms/Beamer.cs b/src/Forms/Beamer.cs
index 1903d3076..2780b4e7b 100644
--- a/src/Forms/Beamer.cs
+++ b/src/Forms/Beamer.cs
@@ -367,7 +367,7 @@ namespace Nikse.SubtitleEdit.Forms
}
else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase))
{
- if (text.Substring(i).ToLower().Replace("", string.Empty).Length > 0)
+ if (text.Substring(i).ToLowerInvariant().Replace("", string.Empty).Length > 0)
{
if (lastText.EndsWith(' ') && !sb.StartsWith(' '))
{
diff --git a/src/Forms/ChangeCasingNames.cs b/src/Forms/ChangeCasingNames.cs
index 2d4337a1f..3f679e453 100644
--- a/src/Forms/ChangeCasingNames.cs
+++ b/src/Forms/ChangeCasingNames.cs
@@ -96,9 +96,9 @@ namespace Nikse.SubtitleEdit.Forms
string name = item.SubItems[1].Text;
string textNoTags = HtmlUtil.RemoveHtmlTags(text, true);
- if (textNoTags != textNoTags.ToUpper())
+ if (textNoTags != textNoTags.ToUpperInvariant())
{
- if (item.Checked && text != null && text.Contains(name, StringComparison.OrdinalIgnoreCase) && name.Length > 1 && name != name.ToLower())
+ if (item.Checked && text != null && text.Contains(name, StringComparison.OrdinalIgnoreCase) && name.Length > 1 && name != name.ToLowerInvariant())
{
var st = new StrippableText(text);
st.FixCasing(new List { name }, true, false, false, string.Empty);
@@ -140,15 +140,15 @@ namespace Nikse.SubtitleEdit.Forms
private void FindAllNames()
{
string text = HtmlUtil.RemoveHtmlTags(_subtitle.GetAllTexts());
- string textToLower = text.ToLower();
+ string textToLower = text.ToLowerInvariant();
listViewNames.BeginUpdate();
foreach (string name in _nameListInclMulti)
{
- int startIndex = textToLower.IndexOf(name.ToLower(), StringComparison.Ordinal);
+ int startIndex = textToLower.IndexOf(name.ToLowerInvariant(), StringComparison.Ordinal);
if (startIndex >= 0)
{
while (startIndex >= 0 && startIndex < text.Length &&
- textToLower.Substring(startIndex).Contains(name.ToLower()) && name.Length > 1 && name != name.ToLower())
+ textToLower.Substring(startIndex).Contains(name.ToLowerInvariant()) && name.Length > 1 && name != name.ToLower())
{
bool startOk = startIndex == 0 || "([ --'>\r\n¿¡\"”“„".Contains(text[startIndex - 1]);
if (startOk)
@@ -175,7 +175,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
- startIndex = textToLower.IndexOf(name.ToLower(), startIndex + 2, StringComparison.Ordinal);
+ startIndex = textToLower.IndexOf(name.ToLowerInvariant(), startIndex + 2, StringComparison.Ordinal);
}
}
}
@@ -200,10 +200,10 @@ namespace Nikse.SubtitleEdit.Forms
string text = UiUtil.GetStringFromListViewText(item.SubItems[2].Text);
- string lower = text.ToLower();
- if (lower.Contains(name.ToLower()) && name.Length > 1 && name != name.ToLower())
+ string lower = text.ToLowerInvariant();
+ if (lower.Contains(name.ToLowerInvariant()) && name.Length > 1 && name != name.ToLowerInvariant())
{
- int start = lower.IndexOf(name.ToLower(), StringComparison.Ordinal);
+ int start = lower.IndexOf(name.ToLowerInvariant(), StringComparison.Ordinal);
if (start >= 0)
{
bool startOk = start == 0 || lower[start - 1] == ' ' || lower[start - 1] == '-' || lower[start - 1] == '"' ||
diff --git a/src/Forms/EffectTypewriter.cs b/src/Forms/EffectTypewriter.cs
index 722d7eca5..7bf65d291 100644
--- a/src/Forms/EffectTypewriter.cs
+++ b/src/Forms/EffectTypewriter.cs
@@ -75,7 +75,7 @@ namespace Nikse.SubtitleEdit.Forms
{
AddTextToRichTextBox(rtb, bold > 0, italic > 0, underline > 0, currentColor, sb.ToString());
sb.Clear();
- string tag = GetTag(text.Substring(i).ToLower());
+ string tag = GetTag(text.Substring(i).ToLowerInvariant());
if (i + 1 < text.Length && text[i + 1] == '/')
{
if (tag == "" && italic > 0)
diff --git a/src/Forms/ExportPngXml.cs b/src/Forms/ExportPngXml.cs
index a32fd3d32..fb314aed9 100644
--- a/src/Forms/ExportPngXml.cs
+++ b/src/Forms/ExportPngXml.cs
@@ -737,7 +737,7 @@ namespace Nikse.SubtitleEdit.Forms
var empty = new Bitmap(width, height);
imagesSavedCount++;
string numberString = $"{imagesSavedCount:00000}";
- string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLower());
+ string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant());
SaveImage(empty, fileName, ImageFormat);
MessageBox.Show(string.Format(Configuration.Settings.Language.ExportPngXml.XImagesSavedInY, imagesSavedCount, folderBrowserDialog1.SelectedPath));
@@ -1085,7 +1085,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
return;
}
- xAndY = xAndY.ToLower();
+ xAndY = xAndY.ToLowerInvariant();
if (_exportType == ExportFormats.Fcp)
{
@@ -1257,7 +1257,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
if (!param.Saved)
{
string numberString = $"IMAGE{i:000}";
- string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLower());
+ string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant());
if (checkBoxFullFrameImage.Visible && checkBoxFullFrameImage.Checked)
{
@@ -1365,7 +1365,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
if (!param.Saved)
{
string numberString = $"IMAGE{i:000}";
- string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLower());
+ string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant());
SaveImage(param.Bitmap, fileName, ImageFormat);
imagesSavedCount++;
@@ -1386,7 +1386,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
if (!param.Saved)
{
string numberString = $"IMAGE{i:000}";
- string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLower());
+ string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant());
foreach (var encoder in ImageCodecInfo.GetImageEncoders())
{
@@ -1448,7 +1448,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
for (int k = lastFrame + 1; k < startFrame; k++)
{
string numberString = $"{k:00000}";
- string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLower());
+ string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant());
empty.Save(fileName, imageFormat);
imagesSavedCount++;
}
@@ -1469,7 +1469,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
for (int k = startFrame; k <= endFrame; k++)
{
string numberString = $"{k:00000}";
- string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLower());
+ string fileName = Path.Combine(folderBrowserDialog1.SelectedPath, numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant());
fullSize.Save(fileName, imageFormat);
imagesSavedCount++;
}
@@ -1591,7 +1591,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
internal int WriteFcpParagraph(StringBuilder sb, int imagesSavedCount, MakeBitmapParameter param, int i, string fileName)
{
string numberString = string.Format(Path.GetFileNameWithoutExtension(Path.GetFileName(fileName)) + "{0:0000}", i).RemoveChar(' ');
- var fileNameShort = numberString + "." + comboBoxImageFormat.Text.ToLower();
+ var fileNameShort = numberString + "." + comboBoxImageFormat.Text.ToLowerInvariant();
var targetImageFileName = Path.Combine(Path.GetDirectoryName(fileName), fileNameShort);
string fileNameNoPath = Path.GetFileName(fileNameShort);
string fileNameNoExt = Path.GetFileNameWithoutExtension(fileNameNoPath);
@@ -1795,7 +1795,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
// subtitle_exp_0001.png
//
sb.AppendLine("");
+ ToHHMMSSFF(param.P.EndTime) + "\" Forced=\"" + param.Forced.ToString().ToLowerInvariant() + "\">");
int x = (width - param.Bitmap.Width) / 2;
int y = height - (param.Bitmap.Height + param.BottomMargin);
@@ -2425,7 +2425,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
}
else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase))
{
- if (text.Substring(i).ToLower().Replace("", string.Empty).Length > 0)
+ if (text.Substring(i).ToLowerInvariant().Replace("", string.Empty).Length > 0)
{
if (lastText.EndsWith(' ') && !sb.StartsWith(' '))
{
@@ -3123,7 +3123,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
}
else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase))
{
- if (text.Substring(i).ToLower().Replace("", string.Empty).Length > 0)
+ if (text.Substring(i).ToLowerInvariant().Replace("", string.Empty).Length > 0)
{
if (lastText.EndsWith(' ') && !sb.StartsWith(' '))
{
diff --git a/src/Forms/ExtractDateTimeInfo.cs b/src/Forms/ExtractDateTimeInfo.cs
index 6f8d28d34..b213ecf52 100644
--- a/src/Forms/ExtractDateTimeInfo.cs
+++ b/src/Forms/ExtractDateTimeInfo.cs
@@ -72,7 +72,7 @@ namespace Nikse.SubtitleEdit.Forms
DateTime start;
double durationInSeconds;
- string ext = Path.GetExtension(VideoFileName).ToLower();
+ string ext = Path.GetExtension(VideoFileName).ToLowerInvariant();
if (ext == ".mp4" || ext == ".m4v" || ext == ".3gp")
{
MP4Parser mp4Parser = new MP4Parser(VideoFileName);
diff --git a/src/Forms/GoogleOrMicrosoftTranslate.cs b/src/Forms/GoogleOrMicrosoftTranslate.cs
index dc1d07f8f..e233336b8 100644
--- a/src/Forms/GoogleOrMicrosoftTranslate.cs
+++ b/src/Forms/GoogleOrMicrosoftTranslate.cs
@@ -63,7 +63,7 @@ namespace Nikse.SubtitleEdit.Forms
string temp = s.Replace("[", string.Empty).Replace("]", string.Empty);
if (temp.Length > 4)
{
- temp = temp.Substring(temp.Length - 5, 2).ToLower();
+ temp = temp.Substring(temp.Length - 5, 2).ToLowerInvariant();
if (temp != defaultToLanguage)
{
diff --git a/src/Forms/GoogleTranslate.cs b/src/Forms/GoogleTranslate.cs
index b0e010bd6..4e1410883 100644
--- a/src/Forms/GoogleTranslate.cs
+++ b/src/Forms/GoogleTranslate.cs
@@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (text.Length > 1)
{
- text = char.ToUpper(text[0]) + text.Substring(1).ToLower();
+ text = char.ToUpper(text[0]) + text.Substring(1).ToLowerInvariant();
}
Text = text;
@@ -161,7 +161,7 @@ namespace Nikse.SubtitleEdit.Forms
string temp = s.Replace("[", string.Empty).Replace("]", string.Empty);
if (temp.Length > 4)
{
- temp = temp.Substring(temp.Length - 5, 2).ToLower();
+ temp = temp.Substring(temp.Length - 5, 2).ToLowerInvariant();
if (temp != defaultFromLanguage && installedLanguages.Any(p => p.Culture.TwoLetterISOLanguageName.Contains(temp)))
{
uiCultureTargetLanguage = temp;
@@ -685,7 +685,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (!string.IsNullOrEmpty(videoFileName))
{
- return Path.GetFileNameWithoutExtension(videoFileName) + "." + _targetTwoLetterIsoLanguageName.ToLower() + subtitleFormat.Extension;
+ return Path.GetFileNameWithoutExtension(videoFileName) + "." + _targetTwoLetterIsoLanguageName.ToLowerInvariant() + subtitleFormat.Extension;
}
if (!string.IsNullOrEmpty(oldFileName))
@@ -699,7 +699,7 @@ namespace Nikse.SubtitleEdit.Forms
s = s.Remove(s.Length - 3);
}
}
- return s + "." + _targetTwoLetterIsoLanguageName.ToLower() + subtitleFormat.Extension;
+ return s + "." + _targetTwoLetterIsoLanguageName.ToLowerInvariant() + subtitleFormat.Extension;
}
}
return null;
diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs
index a9d162223..c475331cd 100644
--- a/src/Forms/Main.cs
+++ b/src/Forms/Main.cs
@@ -7835,9 +7835,9 @@ namespace Nikse.SubtitleEdit.Forms
var moreLanguages = new List();
foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
{
- var twoLetterLower = x.TwoLetterISOLanguageName.ToLower();
+ var twoLetterLower = x.TwoLetterISOLanguageName.ToLowerInvariant();
if (!languages.Contains(twoLetterLower) &&
- !languages.Contains(x.ThreeLetterISOLanguageName.ToLower()) &&
+ !languages.Contains(x.ThreeLetterISOLanguageName.ToLowerInvariant()) &&
twoLetterLower != "iv")
{
moreLanguages.Add(x);
@@ -9483,7 +9483,7 @@ namespace Nikse.SubtitleEdit.Forms
{
int start = textBoxListViewText.SelectionStart;
int length = textBoxListViewText.SelectionLength;
- textBoxListViewText.SelectedText = textBoxListViewText.SelectedText.ToLower();
+ textBoxListViewText.SelectedText = textBoxListViewText.SelectedText.ToLowerInvariant();
textBoxListViewText.SelectionStart = start;
textBoxListViewText.SelectionLength = length;
e.SuppressKeyPress = true;
@@ -9492,7 +9492,7 @@ namespace Nikse.SubtitleEdit.Forms
{
int start = textBoxListViewText.SelectionStart;
int length = textBoxListViewText.SelectionLength;
- textBoxListViewText.SelectedText = textBoxListViewText.SelectedText.ToUpper();
+ textBoxListViewText.SelectedText = textBoxListViewText.SelectedText.ToUpperInvariant();
textBoxListViewText.SelectionStart = start;
textBoxListViewText.SelectionLength = length;
e.SuppressKeyPress = true;
@@ -22241,7 +22241,7 @@ namespace Nikse.SubtitleEdit.Forms
{
int start = textBoxListViewTextAlternate.SelectionStart;
int length = textBoxListViewTextAlternate.SelectionLength;
- textBoxListViewTextAlternate.SelectedText = textBoxListViewTextAlternate.SelectedText.ToLower();
+ textBoxListViewTextAlternate.SelectedText = textBoxListViewTextAlternate.SelectedText.ToLowerInvariant();
textBoxListViewTextAlternate.SelectionStart = start;
textBoxListViewTextAlternate.SelectionLength = length;
e.SuppressKeyPress = true;
@@ -22253,7 +22253,7 @@ namespace Nikse.SubtitleEdit.Forms
{
int start = textBoxListViewTextAlternate.SelectionStart;
int length = textBoxListViewTextAlternate.SelectionLength;
- textBoxListViewTextAlternate.SelectedText = textBoxListViewTextAlternate.SelectedText.ToUpper();
+ textBoxListViewTextAlternate.SelectedText = textBoxListViewTextAlternate.SelectedText.ToUpperInvariant();
textBoxListViewTextAlternate.SelectionStart = start;
textBoxListViewTextAlternate.SelectionLength = length;
e.SuppressKeyPress = true;
diff --git a/src/Forms/Ocr/VobSubOcr.cs b/src/Forms/Ocr/VobSubOcr.cs
index 5a2d75545..f4c55d119 100644
--- a/src/Forms/Ocr/VobSubOcr.cs
+++ b/src/Forms/Ocr/VobSubOcr.cs
@@ -1025,7 +1025,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
// try to match language from vob to Tesseract language
if (comboBoxTesseractLanguages.SelectedIndex >= 0 && comboBoxTesseractLanguages.Items.Count > 1 && languageString != null)
{
- languageString = languageString.ToLower();
+ languageString = languageString.ToLowerInvariant();
for (int i = 0; i < comboBoxTesseractLanguages.Items.Count; i++)
{
var tl = comboBoxTesseractLanguages.Items[i] as TesseractLanguage;
@@ -3108,14 +3108,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
if (_nocrLastLowercaseHeight > 3 && targetItem.NikseBitmap.Height - _nocrLastLowercaseHeight < 2)
{
- result.Text = result.Text.ToLower();
+ result.Text = result.Text.ToLowerInvariant();
}
}
else if (result.Text == "v" || result.Text == "w" || result.Text == "u" || result.Text == "s" || result.Text == "z" || result.Text == "o" || result.Text == "x" || result.Text == "ø" || result.Text == "c")
{
if (_nocrLastUppercaseHeight > 3 && _nocrLastUppercaseHeight - targetItem.NikseBitmap.Height < 2)
{
- result.Text = result.Text.ToUpper();
+ result.Text = result.Text.ToUpperInvariant();
}
}
@@ -3171,14 +3171,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
if (_nocrLastLowercaseHeight > 3 && targetItem.NikseBitmap.Height - _nocrLastLowercaseHeight < 2)
{
- result.Text = result.Text.ToLower();
+ result.Text = result.Text.ToLowerInvariant();
}
}
else if (result.Text == "v" || result.Text == "w" || result.Text == "u" || result.Text == "s" || result.Text == "z" || result.Text == "o" || result.Text == "x" || result.Text == "ø" || result.Text == "c")
{
if (_nocrLastUppercaseHeight > 3 && _nocrLastUppercaseHeight - targetItem.NikseBitmap.Height < 2)
{
- result.Text = result.Text.ToUpper();
+ result.Text = result.Text.ToUpperInvariant();
}
}
@@ -3229,14 +3229,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
if (p.NOcrLastLowercaseHeight > 3 && targetItem.NikseBitmap.Height - p.NOcrLastLowercaseHeight < 2)
{
- result.Text = result.Text.ToLower();
+ result.Text = result.Text.ToLowerInvariant();
}
}
else if (result.Text == "v" || result.Text == "w" || result.Text == "u" || result.Text == "s" || result.Text == "z" || result.Text == "o" || result.Text == "x" || result.Text == "ø" || result.Text == "c")
{
if (p.NOcrLastUppercaseHeight > 3 && p.NOcrLastUppercaseHeight - targetItem.NikseBitmap.Height < 2)
{
- result.Text = result.Text.ToUpper();
+ result.Text = result.Text.ToUpperInvariant();
}
}
@@ -3460,14 +3460,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
{
if (_binOcrLastLowercaseHeight > 3 && h - _binOcrLastLowercaseHeight < 2)
{
- text = text.ToLower();
+ text = text.ToLowerInvariant();
}
}
else if (text == "v" || text == "w" || text == "u" || text == "s" || text == "z" || text == "o" || text == "x" || text == "ø" || text == "c")
{
if (_binOcrLastUppercaseHeight > 3 && _binOcrLastUppercaseHeight - h < 2)
{
- text = text.ToUpper();
+ text = text.ToUpperInvariant();
}
}
}
@@ -8738,7 +8738,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
string text = listBoxUnknownWords.SelectedItems[0].ToString();
if (text.Contains(':'))
{
- text = text.Substring(text.IndexOf(':') + 1).Trim().ToLower();
+ text = text.Substring(text.IndexOf(':') + 1).Trim().ToLowerInvariant();
using (var form = new AddToUserDic())
{
form.Initialize(comboBoxDictionaries.Text, text);
diff --git a/src/Forms/Settings.cs b/src/Forms/Settings.cs
index 33b7c5e6c..cc4133e8c 100644
--- a/src/Forms/Settings.cs
+++ b/src/Forms/Settings.cs
@@ -1984,7 +1984,7 @@ namespace Nikse.SubtitleEdit.Forms
}
string language = GetCurrentWordListLanguage();
- string text = textBoxUserWord.Text.RemoveControlCharacters().Trim().ToLower();
+ string text = textBoxUserWord.Text.RemoveControlCharacters().Trim().ToLowerInvariant();
if (!string.IsNullOrEmpty(language) && text.Length > 0 && !_userWordList.Contains(text))
{
Utilities.AddToUserDictionary(text, language);
@@ -2505,7 +2505,7 @@ namespace Nikse.SubtitleEdit.Forms
string shortcut = GetShortcut(e.Node.Text);
- string[] parts = shortcut.ToLower().Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] parts = shortcut.ToLowerInvariant().Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string k in parts)
{
if (k.Equals("CONTROL", StringComparison.OrdinalIgnoreCase))
diff --git a/src/Forms/SpellCheck.cs b/src/Forms/SpellCheck.cs
index 0113a19e9..2398f07a7 100644
--- a/src/Forms/SpellCheck.cs
+++ b/src/Forms/SpellCheck.cs
@@ -445,10 +445,10 @@ namespace Nikse.SubtitleEdit.Forms
break;
case SpellCheckAction.SkipAll:
_noOfSkippedWords++;
- _skipAllList.Add(ChangeWord.ToUpper());
+ _skipAllList.Add(ChangeWord.ToUpperInvariant());
if (ChangeWord.EndsWith('\'') || ChangeWord.StartsWith('\''))
{
- _skipAllList.Add(ChangeWord.ToUpper().Trim('\''));
+ _skipAllList.Add(ChangeWord.ToUpperInvariant().Trim('\''));
}
break;
@@ -599,8 +599,8 @@ namespace Nikse.SubtitleEdit.Forms
{
_noOfNames++;
}
- else if (_skipAllList.Contains(_currentWord.ToUpper())
- || (_currentWord.StartsWith('\'') || _currentWord.EndsWith('\'')) && _skipAllList.Contains(_currentWord.Trim('\'').ToUpper()))
+ else if (_skipAllList.Contains(_currentWord.ToUpperInvariant())
+ || (_currentWord.StartsWith('\'') || _currentWord.EndsWith('\'')) && _skipAllList.Contains(_currentWord.Trim('\'').ToUpperInvariant()))
{
_noOfSkippedWords++;
}
@@ -745,7 +745,7 @@ namespace Nikse.SubtitleEdit.Forms
}
else
{
- if (_currentWord.ToUpper() != "LT'S" && _currentWord.ToUpper() != "SOX'S" && !_currentWord.ToUpper().StartsWith("HTTP", StringComparison.Ordinal)) // TODO: Get fixed nhunspell
+ if (_currentWord.ToUpperInvariant() != "LT'S" && _currentWord.ToUpperInvariant() != "SOX'S" && !_currentWord.ToUpperInvariant().StartsWith("HTTP", StringComparison.Ordinal)) // TODO: Get fixed nhunspell
{
suggestions = DoSuggest(_currentWord); // TODO: 0.9.6 fails on "Lt'S"
}
@@ -784,9 +784,9 @@ namespace Nikse.SubtitleEdit.Forms
}
if (AutoFixNames && _currentWord.Length > 1)
{
- if (_currentWord.Length > 3 && suggestions.Contains(_currentWord.ToUpper()))
+ if (_currentWord.Length > 3 && suggestions.Contains(_currentWord.ToUpperInvariant()))
{ // does not work well with two letter words like "da" and "de" which get auto-corrected to "DA" and "DE"
- ChangeWord = _currentWord.ToUpper();
+ ChangeWord = _currentWord.ToUpperInvariant();
DoAction(SpellCheckAction.ChangeAll);
return;
}
@@ -1166,10 +1166,10 @@ namespace Nikse.SubtitleEdit.Forms
case SpellCheckAction.Skip:
break;
case SpellCheckAction.SkipAll:
- _skipAllList.Remove(undo.UndoWord.ToUpper());
+ _skipAllList.Remove(undo.UndoWord.ToUpperInvariant());
if (undo.UndoWord.EndsWith('\'') || undo.UndoWord.StartsWith('\''))
{
- _skipAllList.Remove(undo.UndoWord.ToUpper().Trim('\''));
+ _skipAllList.Remove(undo.UndoWord.ToUpperInvariant().Trim('\''));
}
break;
diff --git a/src/Forms/Statistics.cs b/src/Forms/Statistics.cs
index 86fe3e1dd..320213b89 100644
--- a/src/Forms/Statistics.cs
+++ b/src/Forms/Statistics.cs
@@ -137,7 +137,7 @@ https://github.com/SubtitleEdit/subtitleedit
var sb = new StringBuilder();
int sourceLength = _subtitle.ToText(_format).Length;
- var allTextToLower = allText.ToString().ToLower();
+ var allTextToLower = allText.ToString().ToLowerInvariant();
sb.AppendLine(string.Format(_l.NumberOfLinesX, _subtitle.Paragraphs.Count));
sb.AppendLine(string.Format(_l.LengthInFormatXinCharactersY, _format.FriendlyName, sourceLength));
diff --git a/src/Forms/Styles/SubStationAlphaStyles.cs b/src/Forms/Styles/SubStationAlphaStyles.cs
index d553f83ca..81048074b 100644
--- a/src/Forms/Styles/SubStationAlphaStyles.cs
+++ b/src/Forms/Styles/SubStationAlphaStyles.cs
@@ -367,15 +367,15 @@ namespace Nikse.SubtitleEdit.Forms.Styles
var sb = new StringBuilder();
foreach (var line in _header.Split(Utilities.NewLineChars, StringSplitOptions.None))
{
- string s = line.Trim().ToLower();
+ string s = line.Trim().ToLowerInvariant();
if (s.StartsWith("format:", StringComparison.Ordinal))
{
if (line.Length > 10)
{
- var format = line.ToLower().Substring(8).Split(',');
+ var format = line.ToLowerInvariant().Substring(8).Split(',');
for (int i = 0; i < format.Length; i++)
{
- string f = format[i].Trim().ToLower();
+ string f = format[i].Trim().ToLowerInvariant();
if (f == "name")
{
nameIndex = i;
@@ -847,8 +847,8 @@ namespace Nikse.SubtitleEdit.Forms.Styles
var sb = new StringBuilder();
foreach (var line in _header.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
{
- var lineIsStyle = line.ToLower().RemoveChar(' ').StartsWith("style:" + name.ToLower().RemoveChar(' ') + ",", StringComparison.Ordinal) &&
- line.ToLower().Contains(name.ToLower());
+ var lineIsStyle = line.ToLowerInvariant().RemoveChar(' ').StartsWith("style:" + name.ToLowerInvariant().RemoveChar(' ') + ",", StringComparison.Ordinal) &&
+ line.ToLowerInvariant().Contains(name.ToLowerInvariant());
if (!lineIsStyle)
{
sb.AppendLine(line);
diff --git a/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs b/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs
index b2bc70984..e24ca352e 100644
--- a/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs
+++ b/src/Forms/Styles/SubStationAlphaStylesBatchConvert.cs
@@ -134,15 +134,15 @@ namespace Nikse.SubtitleEdit.Forms.Styles
var sb = new StringBuilder();
foreach (var line in _header.Split(Utilities.NewLineChars, StringSplitOptions.None))
{
- string s = line.Trim().ToLower();
+ string s = line.Trim().ToLowerInvariant();
if (s.StartsWith("format:", StringComparison.Ordinal))
{
if (line.Length > 10)
{
- var format = line.ToLower().Substring(8).Split(',');
+ var format = line.ToLowerInvariant().Substring(8).Split(',');
for (int i = 0; i < format.Length; i++)
{
- string f = format[i].Trim().ToLower();
+ string f = format[i].Trim().ToLowerInvariant();
if (f == "name")
{
nameIndex = i;
@@ -746,8 +746,8 @@ namespace Nikse.SubtitleEdit.Forms.Styles
scriptInfoOn = false;
}
- string s = line.ToLower();
- if (s.StartsWith(tag.ToLower() + ":"))
+ string s = line.ToLowerInvariant();
+ if (s.StartsWith(tag.ToLowerInvariant() + ":"))
{
if (!remove)
{
diff --git a/src/Forms/SubStationAlphaProperties.cs b/src/Forms/SubStationAlphaProperties.cs
index f1307cfbd..7c741ebf6 100644
--- a/src/Forms/SubStationAlphaProperties.cs
+++ b/src/Forms/SubStationAlphaProperties.cs
@@ -255,8 +255,8 @@ namespace Nikse.SubtitleEdit.Forms
scriptInfoOn = false;
}
- string s = line.ToLower();
- if (s.StartsWith(tag.ToLower() + ":", StringComparison.Ordinal))
+ string s = line.ToLowerInvariant();
+ if (s.StartsWith(tag.ToLowerInvariant() + ":", StringComparison.Ordinal))
{
if (!remove)
{
diff --git a/src/Forms/TimedTextNewLanguage.cs b/src/Forms/TimedTextNewLanguage.cs
index 310318d73..6270cb345 100644
--- a/src/Forms/TimedTextNewLanguage.cs
+++ b/src/Forms/TimedTextNewLanguage.cs
@@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Forms
for (int i = 0; i < moreLanguages.Count; i++)
{
var language = moreLanguages[i];
- var code = language.TwoLetterISOLanguageName.ToLower();
+ var code = language.TwoLetterISOLanguageName.ToLowerInvariant();
comboBoxLanguage.Items.Add(new LanguageComboBoxItem(code, language.EnglishName + " / " + language.NativeName));
if (code == currentLanguage)
{
diff --git a/src/Forms/VisualSync.cs b/src/Forms/VisualSync.cs
index 50ea0d423..d734f5e02 100644
--- a/src/Forms/VisualSync.cs
+++ b/src/Forms/VisualSync.cs
@@ -597,7 +597,7 @@ namespace Nikse.SubtitleEdit.Forms
{
using (var findSubtitle = new FindSubtitleLine())
{
- findSubtitle.Initialize(_paragraphs, " " + "(" + _language.StartScene.ToLower() + ")");
+ findSubtitle.Initialize(_paragraphs, " " + "(" + _language.StartScene.ToLowerInvariant() + ")");
findSubtitle.ShowDialog();
if (findSubtitle.SelectedIndex >= 0)
{
@@ -610,7 +610,7 @@ namespace Nikse.SubtitleEdit.Forms
{
using (var findSubtitle = new FindSubtitleLine())
{
- findSubtitle.Initialize(_paragraphs, " " + "(" + _language.EndScene.ToLower() + ")");
+ findSubtitle.Initialize(_paragraphs, " " + "(" + _language.EndScene.ToLowerInvariant() + ")");
findSubtitle.ShowDialog();
if (findSubtitle.SelectedIndex >= 0)
{
diff --git a/src/Logic/CommandLineConvert.cs b/src/Logic/CommandLineConvert.cs
index 812471ea3..144e25b83 100644
--- a/src/Logic/CommandLineConvert.cs
+++ b/src/Logic/CommandLineConvert.cs
@@ -937,7 +937,7 @@ namespace Nikse.SubtitleEdit.Logic
}
else
{
- return argument.Substring(1).ToLower();
+ return argument.Substring(1).ToLowerInvariant();
}
}
}
diff --git a/src/Logic/OCR/OcrFixEngine.cs b/src/Logic/OCR/OcrFixEngine.cs
index 8866d994d..0dad0fb86 100644
--- a/src/Logic/OCR/OcrFixEngine.cs
+++ b/src/Logic/OCR/OcrFixEngine.cs
@@ -238,7 +238,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
bool isEnglish = threeLetterIsoLanguageName.Equals("eng", StringComparison.OrdinalIgnoreCase);
foreach (string name in _nameList)
{
- _nameListUppercase.Add(name.ToUpper());
+ _nameListUppercase.Add(name.ToUpperInvariant());
if (isEnglish)
{
if (!name.EndsWith('s'))
@@ -1407,7 +1407,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
}
string wordWithCasingChanged = GetWordWithDominatedCasing(word);
- if (DoSpell(word.ToLower()))
+ if (DoSpell(word.ToLowerInvariant()))
{
guesses.Insert(0, wordWithCasingChanged);
}
@@ -1484,7 +1484,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
}
else
{
- if (word.ToUpper() != "LT'S" && word.ToUpper() != "SOX'S") // TODO: Get fixed nhunspell
+ if (word.ToUpperInvariant() != "LT'S" && word.ToUpperInvariant() != "SOX'S") // TODO: Get fixed nhunspell
{
suggestions = DoSuggest(word); // 0.9.6 fails on "Lt'S"
}
@@ -1560,10 +1560,10 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
}
if (uppercase > lowercase)
{
- return word.ToUpper();
+ return word.ToUpperInvariant();
}
- return word.ToLower();
+ return word.ToLowerInvariant();
}
///
@@ -1584,8 +1584,8 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
case OcrSpellCheck.Action.AddToUserDictionary:
if (_userWordListXmlFileName != null)
{
- Utilities.AddToUserDictionary(_spellCheck.Word.Trim().ToLower(), _fiveLetterWordListLanguageName);
- _userWordList.Add(_spellCheck.Word.Trim().ToLower());
+ Utilities.AddToUserDictionary(_spellCheck.Word.Trim().ToLowerInvariant(), _fiveLetterWordListLanguageName);
+ _userWordList.Add(_spellCheck.Word.Trim().ToLowerInvariant());
}
result.Word = _spellCheck.Word;
result.Fixed = true;
@@ -1611,7 +1611,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
else
{
_nameList.Add(s);
- _nameListUppercase.Add(s.ToUpper());
+ _nameListUppercase.Add(s.ToUpperInvariant());
if (_fiveLetterWordListLanguageName.StartsWith("en", StringComparison.Ordinal))
{
if (!s.EndsWith('s'))
@@ -1677,7 +1677,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
break;
case OcrSpellCheck.Action.SkipAll:
_wordSkipList.Add(_spellCheck.Word);
- _wordSkipList.Add(_spellCheck.Word.ToUpper());
+ _wordSkipList.Add(_spellCheck.Word.ToUpperInvariant());
if (_spellCheck.Word.Length > 1)
{
_wordSkipList.Add(char.ToUpper(_spellCheck.Word[0]) + _spellCheck.Word.Substring(1));
@@ -1734,15 +1734,15 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
if (ar[0].Length > 3 && ar[1].Length > 3)
{
string a = ar[0];
- if (a == a.ToUpper())
+ if (a == a.ToUpperInvariant())
{
- a = a[0] + a.Substring(1).ToLower();
+ a = a[0] + a.Substring(1).ToLowerInvariant();
}
string b = ar[0];
- if (b == b.ToUpper())
+ if (b == b.ToUpperInvariant())
{
- b = b[0] + b.Substring(1).ToLower();
+ b = b[0] + b.Substring(1).ToLowerInvariant();
}
if ((DoSpell(a) || IsWordKnownOrNumber(a, word)) &&
@@ -1781,12 +1781,12 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
return true;
}
- if (_userWordList.Contains(word.ToLower()))
+ if (_userWordList.Contains(word.ToLowerInvariant()))
{
return true;
}
- if (_userWordList.Contains(word.Trim('\'').ToLower()))
+ if (_userWordList.Contains(word.Trim('\'').ToLowerInvariant()))
{
return true;
}
diff --git a/src/Logic/UiUtil.cs b/src/Logic/UiUtil.cs
index 5b5aeacfd..d8c8e3664 100644
--- a/src/Logic/UiUtil.cs
+++ b/src/Logic/UiUtil.cs
@@ -350,7 +350,7 @@ namespace Nikse.SubtitleEdit.Logic
{
foreach (Keys val in Enum.GetValues(typeof(Keys)))
{
- string k = val.ToString().ToLower();
+ string k = val.ToString().ToLowerInvariant();
if (!AllKeys.ContainsKey(k))
{
AllKeys.Add(k, val);
@@ -372,7 +372,7 @@ namespace Nikse.SubtitleEdit.Logic
}
}
- string[] parts = keysInString.ToLower().Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] parts = keysInString.ToLowerInvariant().Split(new[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
var resultKeys = Keys.None;
foreach (string k in parts)
{
diff --git a/src/Logic/VideoPlayers/QuartsPlayer.cs b/src/Logic/VideoPlayers/QuartsPlayer.cs
index 819256cfc..43ff69e0d 100644
--- a/src/Logic/VideoPlayers/QuartsPlayer.cs
+++ b/src/Logic/VideoPlayers/QuartsPlayer.cs
@@ -139,7 +139,7 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
{
const int wsChild = 0x40000000;
- string ext = System.IO.Path.GetExtension(videoFileName).ToLower();
+ string ext = System.IO.Path.GetExtension(videoFileName).ToLowerInvariant();
bool isAudio = ext == ".mp3" || ext == ".wav" || ext == ".wma" || ext == ".ogg" || ext == ".mpa" || ext == ".m4a" || ext == ".ape" || ext == ".aiff" || ext == ".flac" || ext == ".aac" || ext == ".ac3" || ext == ".mka";
OnVideoLoaded = onVideoLoaded;