Remove redundant string casts

This commit is contained in:
_aLfa_ 2014-09-14 19:47:13 +02:00
parent 1a1ca8bd67
commit c7e058b27b
29 changed files with 68 additions and 69 deletions

View File

@ -1481,7 +1481,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
if (sb.Length > 0)
{
lastText.Append(sb.ToString());
lastText.Append(sb);
TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint);
}
if (path.PointCount > 0)

View File

@ -98,7 +98,7 @@ namespace Nikse.SubtitleEdit.Forms
if (showTimecodes)
{
if (timeCodeSrt)
sb.Append(p.StartTime.ToString() + timeCodeSeperator + p.EndTime.ToString());
sb.Append(p.StartTime + timeCodeSeperator + p.EndTime);
else if (timeCodeHHMMSSFF)
sb.Append(p.StartTime.ToHHMMSSFF() + timeCodeSeperator + p.EndTime.ToHHMMSSFF());
else

View File

@ -4489,7 +4489,7 @@ namespace Nikse.SubtitleEdit.Forms
// build log
textBoxFixedIssues.Text = string.Empty;
if (_newLog.Length >= 0)
textBoxFixedIssues.AppendText(_newLog.ToString() + Environment.NewLine);
textBoxFixedIssues.AppendText(_newLog + Environment.NewLine);
textBoxFixedIssues.AppendText(_appliedLog.ToString());
subtitleListView1.EndUpdate();
}

View File

@ -202,7 +202,7 @@ namespace Nikse.SubtitleEdit.Forms
foreach (Paragraph p in _subtitle.Paragraphs)
{
string text = string.Format("{1} {0} |", p.Text.Replace("|", _newlineString), _splitterString);
if (Utilities.UrlEncode(sb.ToString() + text).Length >= textMaxSize)
if (Utilities.UrlEncode(sb + text).Length >= textMaxSize)
{
FillTranslatedText(DoTranslate(sb.ToString()), start, index - 1);
sb = new StringBuilder();
@ -898,7 +898,7 @@ namespace Nikse.SubtitleEdit.Forms
string text = string.Format("{1}{0}|", p.Text, _splitterString);
if (!overQuota)
{
if ((Utilities.UrlEncode(sb.ToString() + text)).Length >= textMaxSize)
if ((Utilities.UrlEncode(sb + text)).Length >= textMaxSize)
{
try
{

View File

@ -393,7 +393,7 @@ namespace Nikse.SubtitleEdit.Forms
int index = 0;
foreach (Paragraph p in _subtitle.Paragraphs)
{
if (tc == p.StartTime.ToString() + " --> " + p.EndTime.ToString())
if (tc == p.StartTime + " --> " + p.EndTime)
{
SubtitleListview1.SelectNone();
SubtitleListview1.Items[0].Selected = false;
@ -8503,7 +8503,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (_subtitleListViewIndex >= 0)
{
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.StarTimeAdjustedX, "#" + (_subtitleListViewIndex + 1).ToString() + ": " + timeUpDownStartTime.TimeCode.ToString()));
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.StarTimeAdjustedX, "#" + (_subtitleListViewIndex + 1) + ": " + timeUpDownStartTime.TimeCode));
int firstSelectedIndex = FirstSelectedIndex;
Paragraph oldParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
@ -8656,7 +8656,7 @@ namespace Nikse.SubtitleEdit.Forms
Paragraph p = _subtitle.GetParagraphOrDefault(FirstSelectedIndex);
if (p != null)
{
string tc = p.StartTime.ToString() + " --> " + p.EndTime.ToString();
string tc = p.StartTime + " --> " + p.EndTime;
int start = textBoxSource.Text.IndexOf(tc);
if (start > 0)
{
@ -8720,7 +8720,7 @@ namespace Nikse.SubtitleEdit.Forms
int index = 0;
foreach (Paragraph p in _subtitle.Paragraphs)
{
if (tc == p.StartTime.ToString() + " --> " + p.EndTime.ToString())
if (tc == p.StartTime + " --> " + p.EndTime)
{
SubtitleListview1.SelectIndexAndEnsureVisible(index, true);
break;
@ -9538,7 +9538,7 @@ namespace Nikse.SubtitleEdit.Forms
catch (Exception exception)
{
var tc = new TimeCode(p.StartMilliseconds);
lastError = tc.ToString() + ": " + exception.Message + ": " + exception.StackTrace;
lastError = tc + ": " + exception.Message + ": " + exception.StackTrace;
noOfErrors++;
}
finally
@ -11576,7 +11576,7 @@ namespace Nikse.SubtitleEdit.Forms
if (_subtitle.Paragraphs[index].StartTime.TotalMilliseconds + 100 > tc.TotalMilliseconds || offset > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
return;
MakeHistoryForUndo(_language.BeforeSetEndTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc.ToString());
MakeHistoryForUndo(_language.BeforeSetEndTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc);
numericUpDownDuration.ValueChanged -= NumericUpDownDurationValueChanged;
_subtitle.Paragraphs[index].EndTime.TotalSeconds = videoPosition;
@ -13816,7 +13816,7 @@ namespace Nikse.SubtitleEdit.Forms
videoPositionInMilliseconds -= Configuration.Settings.General.SetStartEndHumanDelay;
var tc = new TimeCode(videoPositionInMilliseconds);
MakeHistoryForUndo(_language.BeforeInsertSubtitleAtVideoPosition + " " + tc.ToString());
MakeHistoryForUndo(_language.BeforeInsertSubtitleAtVideoPosition + " " + tc);
// find index where to insert
int index = 0;
@ -14006,7 +14006,7 @@ namespace Nikse.SubtitleEdit.Forms
public void ShowEarlierOrLater(double adjustMilliseconds, SelectionChoice selection)
{
var tc = new TimeCode(adjustMilliseconds);
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater + ": " + tc.ToString());
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater + ": " + tc);
if (adjustMilliseconds < 0)
{
if (selection == SelectionChoice.AllLines)
@ -14465,7 +14465,7 @@ namespace Nikse.SubtitleEdit.Forms
var tc = TimeCode.FromSeconds(videoPosition);
timeUpDownStartTime.TimeCode = tc;
MakeHistoryForUndo(_language.BeforeSetStartTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc.ToString());
MakeHistoryForUndo(_language.BeforeSetStartTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc);
double offset = _subtitle.Paragraphs[index].StartTime.TotalMilliseconds - tc.TotalMilliseconds;
@ -14533,7 +14533,7 @@ namespace Nikse.SubtitleEdit.Forms
string oldDuration = _subtitle.Paragraphs[index].Duration.ToString();
var temp = new Paragraph(_subtitle.Paragraphs[index]);
temp.EndTime.TotalMilliseconds = TimeCode.FromSeconds(videoPosition).TotalMilliseconds;
MakeHistoryForUndo(string.Format(_language.DisplayTimeAdjustedX, "#" + _subtitle.Paragraphs[index].Number + ": " + oldDuration + " -> " + temp.Duration.ToString()));
MakeHistoryForUndo(string.Format(_language.DisplayTimeAdjustedX, "#" + _subtitle.Paragraphs[index].Number + ": " + oldDuration + " -> " + temp.Duration));
_makeHistoryPaused = true;
if (_subtitle.Paragraphs[index].StartTime.IsMaxTime)
@ -17388,7 +17388,7 @@ namespace Nikse.SubtitleEdit.Forms
double totalMillisecondsEnd = mediaPlayer.CurrentPosition * 1000.0;
var tc = new TimeCode(totalMillisecondsEnd - durationTotalMilliseconds);
MakeHistoryForUndo(_language.BeforeSetEndAndVideoPosition + " " + tc.ToString());
MakeHistoryForUndo(_language.BeforeSetEndAndVideoPosition + " " + tc);
_makeHistoryPaused = true;
if (p.StartTime.IsMaxTime)

View File

@ -85,7 +85,7 @@ namespace Nikse.SubtitleEdit.Forms
{
try
{
comboBoxDrive.Items.Add(drive.ToString() + " " + drive.VolumeLabel);
comboBoxDrive.Items.Add(drive + " " + drive.VolumeLabel);
}
catch
{

View File

@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (listViewBackups.SelectedItems.Count == 1)
{
string argument = @"/select, " + listViewBackups.SelectedItems[0].Tag.ToString();
string argument = @"/select, " + listViewBackups.SelectedItems[0].Tag;
System.Diagnostics.Process.Start("explorer.exe", argument);
}
else

View File

@ -63,7 +63,7 @@ namespace Nikse.SubtitleEdit.Forms
subtitleListView1.Fill(subtitle);
_guess = subtitle.Paragraphs[index].StartTime.TimeSpan;
subtitleListView1.Items[index].Selected = true;
Text = string.Format(Configuration.Settings.Language.SetSyncPoint.Title, subtitle.Paragraphs[index].Number.ToString() + ": " + subtitle.Paragraphs[index].ToString());
Text = string.Format(Configuration.Settings.Language.SetSyncPoint.Title, subtitle.Paragraphs[index].Number.ToString() + ": " + subtitle.Paragraphs[index]);
labelSubtitle.Text = string.Empty;
labelVideoFileName.Text = Configuration.Settings.Language.General.NoVideoLoaded;

View File

@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Forms
if (s.Length > 1 && hashtable.ContainsKey(s))
{
int hits = int.Parse(hashtable[s].ToString());
int hits = int.Parse(hashtable[s]);
hits++;
hashtable[s] = hits.ToString();
}
@ -209,7 +209,7 @@ namespace Nikse.SubtitleEdit.Forms
if (hashtable.ContainsKey(s))
{
int hits = int.Parse(hashtable[s].ToString());
int hits = int.Parse(hashtable[s]);
hits++;
hashtable[s] = hits.ToString();
}

View File

@ -86,9 +86,9 @@ namespace Nikse.SubtitleEdit.Forms
var start = new TimeCode(sub.StartMilliseconds);
var end = new TimeCode(sub.EndMilliseconds);
if (string.IsNullOrEmpty(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine))
listBoxSubtitles.Items.Add(string.Format("{0}: {1} --> {2}, {3} image(s)", i, start.ToString(), end.ToString(), sub.NumberOfImages));
listBoxSubtitles.Items.Add(string.Format("{0}: {1} --> {2}, {3} image(s)", i, start, end, sub.NumberOfImages));
else
listBoxSubtitles.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine, i, start.ToString(), end.ToString(), sub.NumberOfImages));
listBoxSubtitles.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine, i, start, end, sub.NumberOfImages));
}
if (list.Count > 0)
listBoxSubtitles.SelectedIndex = 0;

View File

@ -3894,7 +3894,7 @@ namespace Nikse.SubtitleEdit.Forms
int correctWords;
int wordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(line, out correctWords);
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length == 0)
{
_ocrFixEngine.AutoGuessesUsed.Clear();
_ocrFixEngine.UnknownWordsFound.Clear();
@ -3932,7 +3932,7 @@ namespace Nikse.SubtitleEdit.Forms
{
_tesseractOcrAutoFixes++;
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
LogOcrFix(listViewIndex, textWithOutFixes.ToString(), line);
LogOcrFix(listViewIndex, textWithOutFixes, line);
}
return line;
@ -4103,7 +4103,7 @@ namespace Nikse.SubtitleEdit.Forms
int correctWords;
int wordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(line, out correctWords);
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length == 0)
{
_ocrFixEngine.AutoGuessesUsed.Clear();
_ocrFixEngine.UnknownWordsFound.Clear();
@ -4141,7 +4141,7 @@ namespace Nikse.SubtitleEdit.Forms
{
_tesseractOcrAutoFixes++;
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
LogOcrFix(listViewIndex, textWithOutFixes.ToString(), line);
LogOcrFix(listViewIndex, textWithOutFixes, line);
}
return line;
@ -4408,7 +4408,7 @@ namespace Nikse.SubtitleEdit.Forms
int correctWords;
int wordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(line, out correctWords);
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length == 0)
{
_ocrFixEngine.AutoGuessesUsed.Clear();
_ocrFixEngine.UnknownWordsFound.Clear();
@ -4446,7 +4446,7 @@ namespace Nikse.SubtitleEdit.Forms
{
_tesseractOcrAutoFixes++;
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
LogOcrFix(listViewIndex, textWithOutFixes.ToString(), line);
LogOcrFix(listViewIndex, textWithOutFixes, line);
}
return line;
@ -4766,7 +4766,7 @@ namespace Nikse.SubtitleEdit.Forms
line.Append(temp);
}
paragraph.Append(line.ToString());
paragraph.Append(line);
paragraph.Append(appendString);
}
line = new StringBuilder();
@ -4791,7 +4791,7 @@ namespace Nikse.SubtitleEdit.Forms
line.Append("</i>");
isItalic = false;
}
line.Append(word.ToString());
line.Append(word);
line.Append(appendString);
wordNonItalics++;
}
@ -5841,9 +5841,9 @@ namespace Nikse.SubtitleEdit.Forms
// fix italics
textWithOutFixes = FixItalics(textWithOutFixes);
int numberOfWords = textWithOutFixes.ToString().Split((" " + Environment.NewLine).ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
int numberOfWords = textWithOutFixes.Split((" " + Environment.NewLine).ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
string line = textWithOutFixes.ToString().Trim();
string line = textWithOutFixes.Trim();
if (_ocrFixEngine.IsDictionaryLoaded)
{
if (checkBoxAutoFixCommonErrors.Checked)
@ -5900,7 +5900,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2)
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length < 2)
{
if (_bluRaySubtitles != null && !line.Contains("<i>"))
{
@ -5963,7 +5963,7 @@ namespace Nikse.SubtitleEdit.Forms
if (checkBoxTesseractItalicsOn.Checked)
{
if (line.Contains("<i>") || wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2)
if (line.Contains("<i>") || wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length < 2)
{
_ocrFixEngine.AutoGuessesUsed.Clear();
_ocrFixEngine.UnknownWordsFound.Clear();
@ -6275,7 +6275,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2)
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length < 2)
{
_ocrFixEngine.AutoGuessesUsed.Clear();
_ocrFixEngine.UnknownWordsFound.Clear();
@ -6404,11 +6404,11 @@ namespace Nikse.SubtitleEdit.Forms
subtitleListView1.SetBackgroundColor(index, Color.LightGreen);
}
if (textWithOutFixes.ToString().Trim() != line.Trim())
if (textWithOutFixes.Trim() != line.Trim())
{
_tesseractOcrAutoFixes++;
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
LogOcrFix(index, textWithOutFixes.ToString(), line);
LogOcrFix(index, textWithOutFixes, line);
}
if (_vobSubMergedPackist != null)
@ -6460,7 +6460,7 @@ namespace Nikse.SubtitleEdit.Forms
private string TesseractResizeAndRetry(Bitmap bitmap)
{
string result = Tesseract3DoOcrViaExe(ResizeBitmap(bitmap, bitmap.Width * 3, bitmap.Height * 2), _languageId, null);
if (result.ToString().Trim().Length == 0)
if (result.Trim().Length == 0)
result = Tesseract3DoOcrViaExe(ResizeBitmap(bitmap, bitmap.Width * 4, bitmap.Height * 2), _languageId, "-psm 7");
return result.TrimEnd();
}
@ -6768,7 +6768,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (comboBoxOcrMethod.SelectedIndex == 4)
{
_binaryOcrDbFileName = Configuration.OcrFolder + comboBoxCharacterDatabase.SelectedItem.ToString() + ".db";
_binaryOcrDbFileName = Configuration.OcrFolder + comboBoxCharacterDatabase.SelectedItem + ".db";
}
LoadImageCompareBitmaps();

View File

@ -116,7 +116,7 @@ namespace Nikse.SubtitleEdit.Forms
if (p.Text.Length > 1)
p.Text = p.Text.Insert(p.Text.Length / 2, sb.ToString());
else
p.Text = sb.ToString() + p.Text;
p.Text = sb + p.Text;
}
}
else
@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms
if (p.Text.Length > 1)
p.Text = p.Text.Insert(p.Text.Length / 2, sb.ToString());
else
p.Text = sb.ToString() + p.Text;
p.Text = sb + p.Text;
j++;
}
}

View File

@ -247,7 +247,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
if (styleFound)
{
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
subtitle.Header = sb.ToString();
}
else
@ -336,7 +336,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
if (stylexmlCount > 0)
{
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
subtitle.Header = sb.ToString();
}
else

View File

@ -265,7 +265,6 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
private static string EncodeText(string s)
{
s = s.ToString();
s = s.Replace("<b>", string.Empty).Replace("<B>", string.Empty).Replace("</b>", string.Empty).Replace("</B>", string.Empty);
s = s.Replace("<u>", string.Empty).Replace("<U>", string.Empty).Replace("</u>", string.Empty).Replace("</U>", string.Empty);
s = Utilities.RemoveHtmlFontTag(s);

View File

@ -372,7 +372,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
else if (html.Length > 0 && html.ToString().StartsWith("<Font "))
{
XmlDocument temp = new XmlDocument();
temp.LoadXml("<root>" + html.ToString() + "</root>");
temp.LoadXml("<root>" + html + "</root>");
XmlNode fontNode = xml.CreateElement("Font");
fontNode.InnerXml = temp.DocumentElement.SelectSingleNode("Font").InnerXml;
foreach (XmlAttribute a in temp.DocumentElement.SelectSingleNode("Font").Attributes)
@ -521,7 +521,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
string lastVPosition = string.Empty;
foreach (XmlNode innerNode in node.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "Text":
if (innerNode.Attributes["VPosition"] != null)
@ -584,7 +584,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
else if (alignRight)
pre = "{\\an3}";
}
string temp = pre + pText.ToString();
string temp = pre + pText;
pText = new StringBuilder();
pText.Append(temp);
}

View File

@ -566,7 +566,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
string lastVPosition = string.Empty;
foreach (XmlNode innerNode in node.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "Text":
if (innerNode.Attributes["Vposition"] != null)
@ -629,7 +629,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
else if (alignRight)
pre = "{\\an3}";
}
string temp = pre + pText.ToString();
string temp = pre + pText;
pText = new StringBuilder();
pText.Append(temp);
}

View File

@ -566,7 +566,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
string lastVPosition = string.Empty;
foreach (XmlNode innerNode in node.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "Text":
if (innerNode.Attributes["Vposition"] != null)
@ -629,7 +629,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
else if (alignRight)
pre = "{\\an3}";
}
string temp = pre + pText.ToString();
string temp = pre + pText;
pText = new StringBuilder();
pText.Append(temp);
}

View File

@ -79,7 +79,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
Paragraph p = null;
subtitle.Paragraphs.Clear();
var arr = text.ToString().Trim().Split("#".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var arr = text.Trim().Split("#".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var currentText = new StringBuilder();
foreach (string line in arr)
{

View File

@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var p = new Paragraph();
foreach (XmlNode innerNode in node.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "text":
p.Text = innerNode.InnerText.Replace("\\N", Environment.NewLine);

View File

@ -112,7 +112,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
StringBuilder pText = new StringBuilder();
foreach (XmlNode innerNode in node.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "br":
pText.AppendLine();

View File

@ -510,7 +510,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
lineSb.Append(pre + s + singlePost);
count++;
}
text = lineSb.ToString() + post;
text = lineSb + post;
subtitle.Paragraphs.Add(new Paragraph(startFrame, endFrame, text));
}
}

View File

@ -157,7 +157,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
StringBuilder pText = new StringBuilder();
foreach (XmlNode innerNode in text.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "br":
pText.AppendLine();

View File

@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
StringBuilder pText = new StringBuilder();
foreach (XmlNode innerNode in node.ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "key":
lastKey = innerNode.InnerText;

View File

@ -1225,7 +1225,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
StringBuilder sb = new StringBuilder();
for (int i = 0; i < LatinLetters.Count; i++)
sb.Append(LatinLetters[i]);
string latinLetters = sb.ToString() + "ABCDEFGHIJKLMNOPPQRSTUVWXYZÆØÅÄÖÜabcdefghijklmnopqrstuvwxyzæøäåü(1234567890, .!?-\r\n'\")";
string latinLetters = sb + "ABCDEFGHIJKLMNOPPQRSTUVWXYZÆØÅÄÖÜabcdefghijklmnopqrstuvwxyzæøäåü(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
{
if (!latinLetters.Contains(ch.ToString()))
@ -1253,7 +1253,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb = new StringBuilder();
for (int i = 0; i < ArabicLetters.Count; i++)
sb.Append(ArabicLetters[i]);
string arabicLetters = sb.ToString() + "(1234567890, .!?-\r\n'\")";
string arabicLetters = sb + "(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
{
if (!arabicLetters.Contains(ch.ToString()))
@ -1269,7 +1269,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb = new StringBuilder();
for (int i = 0; i < HebrewLetters.Count; i++)
sb.Append(HebrewLetters[i]);
string hebrewLetters = sb.ToString() + "(1234567890, .!?-\r\n'\")";
string hebrewLetters = sb + "(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
{
if (!hebrewLetters.Contains(ch.ToString()))
@ -1285,7 +1285,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb = new StringBuilder();
for (int i = 0; i < CyrillicLetters.Count; i++)
sb.Append(CyrillicLetters[i]);
string cyrillicLetters = sb.ToString() + "(1234567890, .!?-\r\n'\")";
string cyrillicLetters = sb + "(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
{
if (!cyrillicLetters.Contains(ch.ToString()))

View File

@ -194,7 +194,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
if (styleFound)
{
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
subtitle.Header = sb.ToString();
}
else
@ -284,7 +284,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
if (stylexmlCount > 0)
{
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
subtitle.Header = sb.ToString();
}
else

View File

@ -301,7 +301,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var pText = new StringBuilder();
foreach (XmlNode innerNode in node.SelectSingleNode("Text").ChildNodes)
{
switch (innerNode.Name.ToString())
switch (innerNode.Name)
{
case "br":
pText.AppendLine();

View File

@ -221,7 +221,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
lineSb.Append(s);
count++;
}
text = lineSb.ToString() + post;
text = lineSb + post;
subtitle.Paragraphs.Add(new Paragraph(startTime, endTime, text));
}

View File

@ -510,7 +510,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
lineSb.Append(pre + s + singlePost);
count++;
}
text = lineSb.ToString() + post;
text = lineSb + post;
subtitle.Paragraphs.Add(new Paragraph(startFrame, endFrame, text));
}
}

View File

@ -3794,7 +3794,7 @@ namespace Nikse.SubtitleEdit.Logic
else if (numbersOn)
{
numbersOn = false;
s = s.Remove(i - numbers.Length, numbers.Length).Insert(i - numbers.Length, numbers.ToString());
s = s.Remove(i - numbers.Length, numbers.Length).Insert(i - numbers.Length, numbers);
numbers = string.Empty;
}
else if (reverseChars.Contains(s.Substring(i, 1)))
@ -3806,7 +3806,7 @@ namespace Nikse.SubtitleEdit.Logic
if (numbersOn)
{
int i = s.Length;
s = s.Remove(i - numbers.Length, numbers.Length).Insert(i - numbers.Length, numbers.ToString());
s = s.Remove(i - numbers.Length, numbers.Length).Insert(i - numbers.Length, numbers);
numbers = string.Empty;
}