mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Minor refact + cleanup.
This commit is contained in:
parent
4976f33026
commit
203984a2c3
@ -432,7 +432,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
int count = 0;
|
||||
while (text.Contains("<font ") && count < 10)
|
||||
{
|
||||
int start = text.IndexOf(@"<font ", StringComparison.Ordinal);
|
||||
int start = text.IndexOf("<font ", StringComparison.Ordinal);
|
||||
int end = text.IndexOf('>', start);
|
||||
if (end > 0)
|
||||
{
|
||||
@ -1556,7 +1556,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
}
|
||||
else if (i == underlineIndex)
|
||||
{
|
||||
style.Underline = f == "-1"|| f == "1";
|
||||
style.Underline = f == "-1" || f == "1";
|
||||
}
|
||||
else if (i == outlineIndex)
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (!hasStyleHead && (subtitle.Header.Contains("[V4+ Styles]") || subtitle.Header.Contains("[V4 Styles]")))
|
||||
if (!hasStyleHead && (subtitle.Header.Contains("[V4+ Styles]") || subtitle.Header.Contains("[V4 Styles]")))
|
||||
{
|
||||
subtitle.Header = SubStationAlphaHeaderToTimedText(subtitle); // save new xml with styles in header
|
||||
convertedFromSubStationAlpha = true;
|
||||
@ -355,7 +355,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
string text = p.Text.RemoveControlCharactersButWhiteSpace();
|
||||
|
||||
string region = GetEffect(p, "region");
|
||||
if (text.StartsWith("{\\an8}") && string.IsNullOrEmpty(region))
|
||||
if (text.StartsWith("{\\an8}", StringComparison.Ordinal) && string.IsNullOrEmpty(region))
|
||||
{
|
||||
if (regions.Contains("top"))
|
||||
region = "top";
|
||||
@ -383,7 +383,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
skipCount--;
|
||||
}
|
||||
else if (line.Substring(i).StartsWith("<i>"))
|
||||
else if (line.Substring(i).StartsWith("<i>", StringComparison.Ordinal))
|
||||
{
|
||||
styles.Push(currentStyle);
|
||||
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
|
||||
@ -393,7 +393,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
currentStyle.Attributes.Append(attr);
|
||||
skipCount = 2;
|
||||
}
|
||||
else if (line.Substring(i).StartsWith("<b>"))
|
||||
else if (line.Substring(i).StartsWith("<b>", StringComparison.Ordinal))
|
||||
{
|
||||
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
|
||||
paragraph.AppendChild(currentStyle);
|
||||
@ -428,7 +428,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
skipCount = line.Length;
|
||||
}
|
||||
}
|
||||
else if (line.Substring(i).StartsWith("</i>") || line.Substring(i).StartsWith("</b>") || line.Substring(i).StartsWith("</font>"))
|
||||
else if (line.Substring(i).StartsWith("</i>", StringComparison.Ordinal) || line.Substring(i).StartsWith("</b>", StringComparison.Ordinal) || line.Substring(i).StartsWith("</font>", StringComparison.Ordinal))
|
||||
{
|
||||
currentStyle = xml.CreateTextNode(string.Empty);
|
||||
if (styles.Count > 0)
|
||||
@ -437,7 +437,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
currentStyle.InnerText = string.Empty;
|
||||
}
|
||||
paragraph.AppendChild(currentStyle);
|
||||
if (line.Substring(i).StartsWith("</font>"))
|
||||
if (line.Substring(i).StartsWith("</font>", StringComparison.Ordinal))
|
||||
skipCount = 6;
|
||||
else
|
||||
skipCount = 3;
|
||||
@ -576,7 +576,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
var arr = frameRateMultiplier.InnerText.Split();
|
||||
if (arr.Length == 2 && Utilities.IsInteger(arr[0]) && Utilities.IsInteger(arr[1]) && int.Parse(arr[1]) > 0)
|
||||
{
|
||||
fr = double.Parse(arr[0]) / double.Parse(arr[1]);
|
||||
fr = double.Parse(arr[0]) / double.Parse(arr[1]);
|
||||
if (fr > 20 && fr < 100)
|
||||
Configuration.Settings.General.CurrentFrameRate = fr;
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
string line1 = string.Empty;
|
||||
string line2 = string.Empty;
|
||||
string[] lines = p.Text.Replace(Environment.NewLine, "\r").Split('\r');
|
||||
string[] lines = p.Text.SplitToLines();
|
||||
if (lines.Length > 2)
|
||||
lines = Utilities.AutoBreakLine(p.Text).Replace(Environment.NewLine, "\r").Split('\r');
|
||||
lines = Utilities.AutoBreakLine(p.Text).SplitToLines();
|
||||
if (lines.Length == 1)
|
||||
{
|
||||
line2 = lines[0];
|
||||
|
@ -69,7 +69,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
sb.AppendLine(line);
|
||||
|
||||
string rtf = sb.ToString().Trim();
|
||||
if (!rtf.StartsWith("{\\rtf"))
|
||||
if (!rtf.StartsWith("{\\rtf", StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
lines = rtf.FromRtf().SplitToLines().ToList();
|
||||
|
@ -83,7 +83,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
sb.AppendLine(line);
|
||||
|
||||
string rtf = sb.ToString().Trim();
|
||||
if (!rtf.StartsWith("{\\rtf"))
|
||||
if (!rtf.StartsWith("{\\rtf", StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
lines = rtf.FromRtf().SplitToLines().ToList();
|
||||
|
@ -105,7 +105,7 @@ NOTE=
|
||||
else if (!string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
if (subtitle.Paragraphs.Count == 0 && (s.StartsWith("TITLE=", StringComparison.Ordinal) || s.StartsWith("TITLE=", StringComparison.Ordinal) || s.StartsWith("FILE=", StringComparison.Ordinal) || s.StartsWith("AUTHOR=", StringComparison.Ordinal) ||
|
||||
s.StartsWith("TYPE=VIDEO") || s.StartsWith("FORMAT=", StringComparison.Ordinal) || s.StartsWith("NOTE=", StringComparison.Ordinal)))
|
||||
s.StartsWith("TYPE=VIDEO", StringComparison.Ordinal) || s.StartsWith("FORMAT=", StringComparison.Ordinal) || s.StartsWith("NOTE=", StringComparison.Ordinal)))
|
||||
{
|
||||
}
|
||||
else
|
||||
|
@ -181,7 +181,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
return _batchMode;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_batchMode = value;
|
||||
|
Loading…
Reference in New Issue
Block a user