mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Merge pull request #885 from ivandrofly/patch-6
Clean up + Minor Refact
This commit is contained in:
commit
7178c3a9a2
@ -101,4 +101,4 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return base.ReadByte();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -167,4 +167,4 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,4 +260,4 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -36,4 +36,4 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -161,4 +161,4 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -347,4 +347,4 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -261,4 +261,4 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -167,4 +167,4 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@
|
||||
CaseSensitive,
|
||||
RegEx
|
||||
}
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@
|
||||
AllLines,
|
||||
SelectionAndForward,
|
||||
}
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@
|
||||
AddToNamesEtc,
|
||||
ChangeWholeText
|
||||
}
|
||||
}
|
||||
}
|
@ -14,4 +14,4 @@
|
||||
WordsPerMinute,
|
||||
Style,
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -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("<i>-"))
|
||||
else if (index == 3 && !string.IsNullOrEmpty(temp) && temp.StartsWith("<i>-", StringComparison.Ordinal))
|
||||
{
|
||||
temp = temp.Remove(3, 1);
|
||||
}
|
||||
|
@ -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("<i>-")))
|
||||
{
|
||||
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("<i>-") && newParagraph2.Text.StartsWith('-'))
|
||||
else if (newParagraph1.Text.StartsWith("<i>-", StringComparison.Ordinal) && newParagraph2.Text.StartsWith('-'))
|
||||
{
|
||||
newParagraph1.Text = newParagraph1.Text.Remove(3, 1).Trim();
|
||||
if (newParagraph1.Text.StartsWith("<i> "))
|
||||
if (newParagraph1.Text.StartsWith("<i> ", StringComparison.Ordinal))
|
||||
newParagraph1.Text = newParagraph1.Text.Remove(3, 1).Trim();
|
||||
newParagraph2.Text = newParagraph2.Text.Remove(0, 1).Trim();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newParagraph1.Text.EndsWith("</i>"))
|
||||
if (newParagraph1.Text.EndsWith("</i>", StringComparison.Ordinal))
|
||||
{
|
||||
const string post = "</i>";
|
||||
newParagraph1.Text = newParagraph1.Text.Remove(newParagraph1.Text.Length - post.Length);
|
||||
}
|
||||
//newParagraph1.Text += comboBoxLineContinuationEnd.Text.TrimEnd() + post;
|
||||
|
||||
if (newParagraph2.Text.StartsWith("<i>"))
|
||||
if (newParagraph2.Text.StartsWith("<i>", StringComparison.Ordinal))
|
||||
{
|
||||
const string pre = "<i>";
|
||||
newParagraph2.Text = newParagraph2.Text.Remove(0, pre.Length);
|
||||
|
@ -22,9 +22,7 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
public abstract bool Spell(string word);
|
||||
public abstract List<string> Suggest(string word);
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
public virtual void Dispose() { }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -3210,4 +3210,4 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -636,4 +636,4 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user