diff --git a/src/Core/FastFileStream.cs b/src/Core/FastFileStream.cs index c80a504a3..7f9024148 100644 --- a/src/Core/FastFileStream.cs +++ b/src/Core/FastFileStream.cs @@ -101,4 +101,4 @@ namespace Nikse.SubtitleEdit.Core return base.ReadByte(); } } -} +} \ No newline at end of file diff --git a/src/Core/StringExtensions.cs b/src/Core/StringExtensions.cs index 19e4e86fb..bc9dc98f1 100644 --- a/src/Core/StringExtensions.cs +++ b/src/Core/StringExtensions.cs @@ -167,4 +167,4 @@ namespace Nikse.SubtitleEdit.Core return false; } } -} +} \ No newline at end of file diff --git a/src/Forms/HardSubExtract.cs b/src/Forms/HardSubExtract.cs index 19221bf8c..796b11c9c 100644 --- a/src/Forms/HardSubExtract.cs +++ b/src/Forms/HardSubExtract.cs @@ -10,7 +10,7 @@ namespace Nikse.SubtitleEdit.Forms { public partial class HardSubExtract : Form { - // HardExtractCapture cam = null; + // HardExtractCapture cam = null; private string _videoFileName; private LibVlcDynamic _libVlc; private VideoInfo _videoInfo; @@ -45,7 +45,6 @@ namespace Nikse.SubtitleEdit.Forms Utilities.InitializeVideoPlayerAndContainer(_videoFileName, _videoInfo, mediaPlayer, VideoLoaded, null); Configuration.Settings.General.VideoPlayer = oldPlayer; _libVlc = mediaPlayer.VideoPlayer as LibVlcDynamic; - } else { @@ -276,27 +275,29 @@ namespace Nikse.SubtitleEdit.Forms DialogResult result = saveFileDialog1.ShowDialog(this); if (result == DialogResult.OK) { - Bitmap bmp = pictureBox2.Image as Bitmap; - if (bmp == null) + using (var bmp = pictureBox2.Image as Bitmap) { - MessageBox.Show("No image!"); - return; - } + if (bmp == null) + { + MessageBox.Show("No image!"); + return; + } - try - { - if (saveFileDialog1.FilterIndex == 0) - bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png); - else if (saveFileDialog1.FilterIndex == 1) - bmp.Save(saveFileDialog1.FileName); - else if (saveFileDialog1.FilterIndex == 2) - bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Gif); - else - bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Tiff); - } - catch (Exception exception) - { - MessageBox.Show(exception.Message); + try + { + if (saveFileDialog1.FilterIndex == 0) + bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png); + else if (saveFileDialog1.FilterIndex == 1) + bmp.Save(saveFileDialog1.FileName); + else if (saveFileDialog1.FilterIndex == 2) + bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Gif); + else + bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Tiff); + } + catch (Exception exception) + { + MessageBox.Show(exception.Message); + } } } } diff --git a/src/Forms/ModifySelection.cs b/src/Forms/ModifySelection.cs index d04b1af30..388705d08 100644 --- a/src/Forms/ModifySelection.cs +++ b/src/Forms/ModifySelection.cs @@ -260,4 +260,4 @@ namespace Nikse.SubtitleEdit.Forms } } -} +} \ No newline at end of file diff --git a/src/Forms/NetworkLogAndInfo.cs b/src/Forms/NetworkLogAndInfo.cs index d966bd742..0953077cd 100644 --- a/src/Forms/NetworkLogAndInfo.cs +++ b/src/Forms/NetworkLogAndInfo.cs @@ -36,4 +36,4 @@ namespace Nikse.SubtitleEdit.Forms DialogResult = DialogResult.Cancel; } } -} +} \ No newline at end of file diff --git a/src/Forms/NuendoProperties.cs b/src/Forms/NuendoProperties.cs index 088514a96..1688b0aca 100644 --- a/src/Forms/NuendoProperties.cs +++ b/src/Forms/NuendoProperties.cs @@ -7,7 +7,6 @@ namespace Nikse.SubtitleEdit.Forms { public partial class NuendoProperties : PositionAndSizeForm { - public string CharacterListFile { get; set; } public NuendoProperties() @@ -78,9 +77,7 @@ namespace Nikse.SubtitleEdit.Forms } } } - catch - { - } + catch { } } lineNumber++; } @@ -88,4 +85,4 @@ namespace Nikse.SubtitleEdit.Forms } } -} +} \ No newline at end of file diff --git a/src/Forms/SplitSubtitle.cs b/src/Forms/SplitSubtitle.cs index dcf9402e1..c65f7a9ff 100644 --- a/src/Forms/SplitSubtitle.cs +++ b/src/Forms/SplitSubtitle.cs @@ -161,4 +161,4 @@ namespace Nikse.SubtitleEdit.Forms } } -} +} \ No newline at end of file diff --git a/src/Forms/Statistics.cs b/src/Forms/Statistics.cs index 913931a9e..23b196657 100644 --- a/src/Forms/Statistics.cs +++ b/src/Forms/Statistics.cs @@ -347,4 +347,4 @@ https://github.com/SubtitleEdit/subtitleedit } } -} +} \ No newline at end of file diff --git a/src/Forms/SubStationAlphaProperties.cs b/src/Forms/SubStationAlphaProperties.cs index 77b56ac6d..716b34d38 100644 --- a/src/Forms/SubStationAlphaProperties.cs +++ b/src/Forms/SubStationAlphaProperties.cs @@ -261,4 +261,4 @@ namespace Nikse.SubtitleEdit.Forms } } -} +} \ No newline at end of file diff --git a/src/Forms/VideoPlayerUndocked.cs b/src/Forms/VideoPlayerUndocked.cs index e2cfc3f45..fba3b7789 100644 --- a/src/Forms/VideoPlayerUndocked.cs +++ b/src/Forms/VideoPlayerUndocked.cs @@ -167,4 +167,4 @@ namespace Nikse.SubtitleEdit.Forms this.Refresh(); } } -} +} \ No newline at end of file diff --git a/src/Logic/Enums/FindType.cs b/src/Logic/Enums/FindType.cs index c26a60b49..b680716de 100644 --- a/src/Logic/Enums/FindType.cs +++ b/src/Logic/Enums/FindType.cs @@ -6,4 +6,4 @@ CaseSensitive, RegEx } -} +} \ No newline at end of file diff --git a/src/Logic/Enums/SelectionChoice.cs b/src/Logic/Enums/SelectionChoice.cs index e2e76285d..a58071c39 100644 --- a/src/Logic/Enums/SelectionChoice.cs +++ b/src/Logic/Enums/SelectionChoice.cs @@ -6,4 +6,4 @@ AllLines, SelectionAndForward, } -} +} \ No newline at end of file diff --git a/src/Logic/Enums/SpellCheckAction.cs b/src/Logic/Enums/SpellCheckAction.cs index 9a4617492..5133c0e50 100644 --- a/src/Logic/Enums/SpellCheckAction.cs +++ b/src/Logic/Enums/SpellCheckAction.cs @@ -12,4 +12,4 @@ AddToNamesEtc, ChangeWholeText } -} +} \ No newline at end of file diff --git a/src/Logic/Enums/SubtitleSortCriteria.cs b/src/Logic/Enums/SubtitleSortCriteria.cs index 578088fd0..6f58c0b57 100644 --- a/src/Logic/Enums/SubtitleSortCriteria.cs +++ b/src/Logic/Enums/SubtitleSortCriteria.cs @@ -14,4 +14,4 @@ WordsPerMinute, Style, } -} +} \ No newline at end of file diff --git a/src/Logic/Forms/FixCommonErrorsHelper.cs b/src/Logic/Forms/FixCommonErrorsHelper.cs index bae947490..8c2318a31 100644 --- a/src/Logic/Forms/FixCommonErrorsHelper.cs +++ b/src/Logic/Forms/FixCommonErrorsHelper.cs @@ -6,7 +6,6 @@ namespace Nikse.SubtitleEdit.Logic.Forms { public static class FixCommonErrorsHelper { - public static string FixEllipsesStartHelper(string text) { if (string.IsNullOrEmpty(text) || text.Trim().Length < 4 || !(text.Contains("..", StringComparison.Ordinal) || text.Contains(". .", StringComparison.Ordinal))) @@ -463,4 +462,4 @@ namespace Nikse.SubtitleEdit.Logic.Forms } } -} +} \ No newline at end of file diff --git a/src/Logic/Forms/RemoveTextForHI.cs b/src/Logic/Forms/RemoveTextForHI.cs index c223b1063..56ce18741 100644 --- a/src/Logic/Forms/RemoveTextForHI.cs +++ b/src/Logic/Forms/RemoveTextForHI.cs @@ -684,15 +684,15 @@ namespace Nikse.SubtitleEdit.Logic.Forms if (temp.TrimEnd().EndsWith(Environment.NewLine + "-")) temp = temp.TrimEnd().TrimEnd('-').TrimEnd(); } - else if (index == 2 && temp.StartsWith("- —")) + else if (index == 2 && temp.StartsWith("- —", StringComparison.Ordinal)) { temp = temp.Remove(2, 2); } - else if (index == 2 && temp.StartsWith("- —")) + else if (index == 2 && temp.StartsWith("- —", StringComparison.Ordinal)) { temp = temp.Remove(2, 1); } - else if (index == 0 && temp.StartsWith(" —")) + else if (index == 0 && temp.StartsWith(" —", StringComparison.Ordinal)) { temp = temp.Remove(0, 2); } @@ -771,12 +771,12 @@ namespace Nikse.SubtitleEdit.Logic.Forms } } - if (index > 3 && index - 2 < temp.Length && temp.Substring(index - 2).StartsWith(", —")) + if (index > 3 && index - 2 < temp.Length && temp.Substring(index - 2).StartsWith(", —", StringComparison.Ordinal)) { temp = temp.Remove(index - 2, 1); index--; } - else if (index > 3 && index - 2 < temp.Length && temp.Substring(index - 2).StartsWith(", —")) + else if (index > 3 && index - 2 < temp.Length && temp.Substring(index - 2).StartsWith(", —", StringComparison.Ordinal)) { temp = temp.Remove(index - 2, 1); index--; @@ -789,7 +789,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms if (!string.IsNullOrEmpty(temp) && temp.StartsWith('-')) temp = temp.Remove(0, 1).Trim(); } - else if (index == 3 && !string.IsNullOrEmpty(temp) && temp.StartsWith("-")) + else if (index == 3 && !string.IsNullOrEmpty(temp) && temp.StartsWith("-", StringComparison.Ordinal)) { temp = temp.Remove(3, 1); } diff --git a/src/Logic/Forms/SplitLongLinesHelper.cs b/src/Logic/Forms/SplitLongLinesHelper.cs index 6fac78f7c..dce8b9ecf 100644 --- a/src/Logic/Forms/SplitLongLinesHelper.cs +++ b/src/Logic/Forms/SplitLongLinesHelper.cs @@ -6,7 +6,6 @@ namespace Nikse.SubtitleEdit.Logic.Forms { public static class SplitLongLinesHelper { - public static bool QualifiesForSplit(string text, int singleLineMaxCharacters, int totalLineMaxCharacters) { string s = HtmlUtil.RemoveHtmlTags(text.Trim(), true); @@ -20,7 +19,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms return true; } - var tempText = text.Replace(Environment.NewLine, " ").Replace(" ", " "); + var tempText = Utilities.UnbreakLine(text); if (Utilities.CountTagInText(tempText, '-') == 2 && (text.StartsWith('-') || text.StartsWith("-"))) { var idx = tempText.IndexOfAny(new[] { ". -", "! -", "? -" }, StringComparison.Ordinal); @@ -35,7 +34,6 @@ namespace Nikse.SubtitleEdit.Logic.Forms } } } - return false; } @@ -93,24 +91,24 @@ namespace Nikse.SubtitleEdit.Logic.Forms newParagraph1.Text = newParagraph1.Text.Remove(0, 1).Trim(); newParagraph2.Text = newParagraph2.Text.Remove(0, 1).Trim(); } - else if (newParagraph1.Text.StartsWith("-") && newParagraph2.Text.StartsWith('-')) + else if (newParagraph1.Text.StartsWith("-", StringComparison.Ordinal) && newParagraph2.Text.StartsWith('-')) { newParagraph1.Text = newParagraph1.Text.Remove(3, 1).Trim(); - if (newParagraph1.Text.StartsWith(" ")) + if (newParagraph1.Text.StartsWith(" ", StringComparison.Ordinal)) newParagraph1.Text = newParagraph1.Text.Remove(3, 1).Trim(); newParagraph2.Text = newParagraph2.Text.Remove(0, 1).Trim(); } } else { - if (newParagraph1.Text.EndsWith("")) + if (newParagraph1.Text.EndsWith("", StringComparison.Ordinal)) { const string post = ""; newParagraph1.Text = newParagraph1.Text.Remove(newParagraph1.Text.Length - post.Length); } //newParagraph1.Text += comboBoxLineContinuationEnd.Text.TrimEnd() + post; - if (newParagraph2.Text.StartsWith("")) + if (newParagraph2.Text.StartsWith("", StringComparison.Ordinal)) { const string pre = ""; newParagraph2.Text = newParagraph2.Text.Remove(0, pre.Length); diff --git a/src/Logic/SpellCheck/Hunspell.cs b/src/Logic/SpellCheck/Hunspell.cs index c66604ed2..bd711b3b6 100644 --- a/src/Logic/SpellCheck/Hunspell.cs +++ b/src/Logic/SpellCheck/Hunspell.cs @@ -22,9 +22,7 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck public abstract bool Spell(string word); public abstract List Suggest(string word); - public virtual void Dispose() - { - } + public virtual void Dispose() { } } -} +} \ No newline at end of file diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index c7427b406..71f94afd8 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -3210,4 +3210,4 @@ namespace Nikse.SubtitleEdit.Logic } } -} +} \ No newline at end of file diff --git a/src/Logic/WaveToVisualizer.cs b/src/Logic/WaveToVisualizer.cs index 4368b1193..691fabbd7 100644 --- a/src/Logic/WaveToVisualizer.cs +++ b/src/Logic/WaveToVisualizer.cs @@ -636,4 +636,4 @@ namespace Nikse.SubtitleEdit.Logic } } -} +} \ No newline at end of file