Minor refact

This commit is contained in:
Nikolaj Olsson 2017-04-17 11:15:57 +02:00
parent 790eb02b82
commit 497633c1be
3 changed files with 8 additions and 15 deletions

View File

@ -431,7 +431,7 @@ namespace Nikse.SubtitleEdit.Core
foreach (Paragraph paragraph in subtitle.Paragraphs)
{
string text = paragraph.Text.Trim();
if (text.StartsWith(prefix))
if (text.StartsWith(prefix, StringComparison.Ordinal))
paragraph.Text = text.Remove(0, prefix.Length);
}
}

View File

@ -3754,14 +3754,7 @@ namespace Nikse.SubtitleEdit.Forms
// Set default RTL or LTR
if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
{
if (Configuration.Settings.General.RightToLeftMode)
{
textBoxListViewTextAlternate.RightToLeft = RightToLeft.Yes;
}
else
{
textBoxListViewTextAlternate.RightToLeft = RightToLeft.No;
}
textBoxListViewTextAlternate.RightToLeft = Configuration.Settings.General.RightToLeftMode ? RightToLeft.Yes : RightToLeft.No;
}
if (Configuration.Settings.General.RightToLeftMode)
{
@ -12390,7 +12383,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (line.TrimStart().StartsWith('-') || line.TrimStart().StartsWith("<i>-", StringComparison.Ordinal) || line.TrimStart().StartsWith("<i> -", StringComparison.Ordinal))
sb.AppendLine(line);
else if (line.TrimStart().StartsWith("<i>") && line.Trim().Length > 3)
else if (line.TrimStart().StartsWith("<i>", StringComparison.Ordinal) && line.Trim().Length > 3)
sb.AppendLine("<i>- " + line.Substring(3).TrimStart());
else
sb.AppendLine("- " + line);

View File

@ -158,7 +158,7 @@ namespace Nikse.SubtitleEdit.Forms
for (int i = 0; i < 10; i++)
{
int idx = word.Index - i;
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text))
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text, StringComparison.Ordinal))
{
richTextBoxParagraph.SelectionStart = idx;
richTextBoxParagraph.SelectionLength = word.Text.Length;
@ -166,7 +166,7 @@ namespace Nikse.SubtitleEdit.Forms
break;
}
idx = word.Index + i;
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text))
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text, StringComparison.Ordinal))
{
richTextBoxParagraph.SelectionStart = idx;
richTextBoxParagraph.SelectionLength = word.Text.Length;
@ -593,7 +593,7 @@ namespace Nikse.SubtitleEdit.Forms
var suggestions = new List<string>();
if ((_currentWord == "Lt's" || _currentWord == "Lt'S") && _languageName.StartsWith("en_"))
if ((_currentWord == "Lt's" || _currentWord == "Lt'S") && _languageName.StartsWith("en_", StringComparison.Ordinal))
{
suggestions.Add("It's");
}
@ -610,7 +610,7 @@ namespace Nikse.SubtitleEdit.Forms
{
for (int i = 0; i < suggestions.Count; i++)
{
if (suggestions[i].StartsWith("L'") || suggestions[i].StartsWith("L"))
if (suggestions[i].StartsWith("L'", StringComparison.Ordinal) || suggestions[i].StartsWith("L", StringComparison.Ordinal))
suggestions[i] = @"l" + suggestions[i].Substring(1);
}
}
@ -658,7 +658,7 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
}
if (_prefix != null && _prefix == "''" && _currentWord.EndsWith("''"))
if (_prefix != null && _prefix == "''" && _currentWord.EndsWith("''", StringComparison.Ordinal))
{
_prefix = string.Empty;
_currentSpellCheckWord.Index += 2;