mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
more clean-up
This commit is contained in:
parent
0ebf82c3c7
commit
ff3e2d4cc8
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.VideoFormats;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
@ -276,10 +277,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
i++;
|
||||
if (track.name != null && track.Mdia != null && track.Mdia.Mdhd != null && track.Mdia.Mdhd.LanguageString != null)
|
||||
audioTrackNames.Add(i + ": " + track.name + " - " + track.Mdia.Mdhd.LanguageString);
|
||||
else if (track.name != null)
|
||||
audioTrackNames.Add(i + ": " + track.name);
|
||||
if (track.Name != null && track.Mdia != null && track.Mdia.Mdhd != null && track.Mdia.Mdhd.LanguageString != null)
|
||||
audioTrackNames.Add(i + ": " + track.Name + " - " + track.Mdia.Mdhd.LanguageString);
|
||||
else if (track.Name != null)
|
||||
audioTrackNames.Add(i + ": " + track.Name);
|
||||
else
|
||||
audioTrackNames.Add(i.ToString());
|
||||
}
|
||||
|
2
src/Forms/BatchConvert.Designer.cs
generated
2
src/Forms/BatchConvert.Designer.cs
generated
@ -1,6 +1,6 @@
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
partial class BatchConvert
|
||||
sealed partial class BatchConvert
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@ -1,17 +1,19 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VideoFormats;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public partial class BatchConvert : Form
|
||||
public sealed partial class BatchConvert : Form
|
||||
{
|
||||
public class ThreadDoWorkParameter
|
||||
{
|
||||
@ -50,23 +52,21 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
string _assStyle;
|
||||
string _ssaStyle;
|
||||
Nikse.SubtitleEdit.Logic.Forms.RemoveTextForHI _removeForHI;
|
||||
Logic.Forms.RemoveTextForHI _removeForHI;
|
||||
ChangeCasing _changeCasing = new ChangeCasing();
|
||||
ChangeCasingNames _changeCasingNames = new ChangeCasingNames();
|
||||
bool _converting = false;
|
||||
int _count = 0;
|
||||
int _converted = 0;
|
||||
int _errors = 0;
|
||||
bool _converting;
|
||||
int _count;
|
||||
int _converted;
|
||||
int _errors;
|
||||
IList<SubtitleFormat> _allFormats = SubtitleFormat.AllSubtitleFormats;
|
||||
bool _abort = false;
|
||||
Main _main;
|
||||
bool _abort;
|
||||
ListViewItem _matroskaListViewItem;
|
||||
|
||||
public BatchConvert(Icon icon, Main main)
|
||||
public BatchConvert(Icon icon)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Icon = (Icon)icon.Clone();
|
||||
_main = main;
|
||||
Icon = (Icon)icon.Clone();
|
||||
|
||||
progressBar1.Visible = false;
|
||||
labelStatus.Text = string.Empty;
|
||||
@ -124,20 +124,20 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
timeUpDownAdjust.MaskedTextBox.Text = "000000000";
|
||||
|
||||
comboBoxFrameRateFrom.Items.Add((23.976).ToString());
|
||||
comboBoxFrameRateFrom.Items.Add((24.0).ToString());
|
||||
comboBoxFrameRateFrom.Items.Add((25.0).ToString());
|
||||
comboBoxFrameRateFrom.Items.Add((29.97).ToString());
|
||||
comboBoxFrameRateFrom.Items.Add((23.976).ToString(CultureInfo.InvariantCulture));
|
||||
comboBoxFrameRateFrom.Items.Add((24.0).ToString(CultureInfo.InvariantCulture));
|
||||
comboBoxFrameRateFrom.Items.Add((25.0).ToString(CultureInfo.InvariantCulture));
|
||||
comboBoxFrameRateFrom.Items.Add((29.97).ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
comboBoxFrameRateTo.Items.Add((23.976).ToString());
|
||||
comboBoxFrameRateTo.Items.Add((24.0).ToString());
|
||||
comboBoxFrameRateTo.Items.Add((25.0).ToString());
|
||||
comboBoxFrameRateTo.Items.Add((29.97).ToString());
|
||||
comboBoxFrameRateTo.Items.Add((23.976).ToString(CultureInfo.InvariantCulture));
|
||||
comboBoxFrameRateTo.Items.Add((24.0).ToString(CultureInfo.InvariantCulture));
|
||||
comboBoxFrameRateTo.Items.Add((25.0).ToString(CultureInfo.InvariantCulture));
|
||||
comboBoxFrameRateTo.Items.Add((29.97).ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
|
||||
FixLargeFonts();
|
||||
|
||||
foreach (SubtitleFormat f in SubtitleFormat.AllSubtitleFormats)
|
||||
foreach (var f in SubtitleFormat.AllSubtitleFormats)
|
||||
{
|
||||
if (!f.IsVobSubIndexFile)
|
||||
comboBoxSubtitleFormats.Items.Add(f.Name);
|
||||
@ -159,7 +159,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
comboBoxEncoding.SelectedIndex = encodingSelectedIndex;
|
||||
|
||||
if (string.IsNullOrEmpty(Configuration.Settings.Tools.BatchConvertOutputFolder) || !System.IO.Directory.Exists(Configuration.Settings.Tools.BatchConvertOutputFolder))
|
||||
if (string.IsNullOrEmpty(Configuration.Settings.Tools.BatchConvertOutputFolder) || !Directory.Exists(Configuration.Settings.Tools.BatchConvertOutputFolder))
|
||||
textBoxOutputFolder.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
|
||||
else
|
||||
textBoxOutputFolder.Text = Configuration.Settings.Tools.BatchConvertOutputFolder;
|
||||
@ -199,15 +199,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
checkBoxOverwriteOriginalFiles.Visible = false;
|
||||
}
|
||||
|
||||
var hiSettings = new Nikse.SubtitleEdit.Logic.Forms.RemoveTextForHISettings();
|
||||
hiSettings.LoadFromConfiguration();
|
||||
_removeForHI = new Nikse.SubtitleEdit.Logic.Forms.RemoveTextForHI(hiSettings);
|
||||
_removeForHI = new Logic.Forms.RemoveTextForHI(new Logic.Forms.RemoveTextForHISettings());
|
||||
}
|
||||
|
||||
private void FixLargeFonts()
|
||||
{
|
||||
Graphics graphics = this.CreateGraphics();
|
||||
SizeF textSize = graphics.MeasureString(buttonCancel.Text, this.Font);
|
||||
Graphics graphics = CreateGraphics();
|
||||
SizeF textSize = graphics.MeasureString(buttonCancel.Text, Font);
|
||||
if (textSize.Height > buttonCancel.Height - 4)
|
||||
{
|
||||
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
|
||||
@ -224,14 +222,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonOpenOutputFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (System.IO.Directory.Exists(textBoxOutputFolder.Text))
|
||||
System.Diagnostics.Process.Start(textBoxOutputFolder.Text);
|
||||
else
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.SplitSubtitle.FolderNotFoundX, textBoxOutputFolder.Text));
|
||||
}
|
||||
|
||||
private void buttonInputBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
buttonInputBrowse.Enabled = false;
|
||||
@ -254,16 +244,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
FileInfo fi = new FileInfo(fileName);
|
||||
var fi = new FileInfo(fileName);
|
||||
var item = new ListViewItem(fileName);
|
||||
item.SubItems.Add(Utilities.FormatBytesToDisplayFileSize(fi.Length));
|
||||
|
||||
SubtitleFormat format = null;
|
||||
Encoding encoding;
|
||||
var sub = new Subtitle();
|
||||
var _subtitle = new Subtitle();
|
||||
if (fi.Length < 1024 * 1024) // max 1 mb
|
||||
{
|
||||
Encoding encoding;
|
||||
format = sub.LoadSubtitle(fileName, out encoding, null);
|
||||
|
||||
if (format == null)
|
||||
@ -362,7 +351,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else if (Path.GetExtension(fileName).ToLower() == ".mkv" || Path.GetExtension(fileName).ToLower() == ".mks")
|
||||
{
|
||||
Matroska mkv = new Matroska();
|
||||
var mkv = new Matroska();
|
||||
bool isValid = false;
|
||||
bool hasConstantFrameRate = false;
|
||||
double frameRate = 0;
|
||||
@ -524,12 +513,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
BackgroundWorker worker1 = new BackgroundWorker();
|
||||
BackgroundWorker worker2 = new BackgroundWorker();
|
||||
BackgroundWorker worker3 = new BackgroundWorker();
|
||||
worker1.DoWork += new DoWorkEventHandler(DoThreadWork);
|
||||
worker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ThreadWorkerCompleted);
|
||||
worker2.DoWork += new DoWorkEventHandler(DoThreadWork);
|
||||
worker2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ThreadWorkerCompleted);
|
||||
worker3.DoWork += new DoWorkEventHandler(DoThreadWork);
|
||||
worker3.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ThreadWorkerCompleted);
|
||||
worker1.DoWork += DoThreadWork;
|
||||
worker1.RunWorkerCompleted += ThreadWorkerCompleted;
|
||||
worker2.DoWork += DoThreadWork;
|
||||
worker2.RunWorkerCompleted += ThreadWorkerCompleted;
|
||||
worker3.DoWork += DoThreadWork;
|
||||
worker3.RunWorkerCompleted += ThreadWorkerCompleted;
|
||||
|
||||
listViewInputFiles.BeginUpdate();
|
||||
foreach (ListViewItem item in listViewInputFiles.Items)
|
||||
@ -542,7 +531,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
ListViewItem item = listViewInputFiles.Items[index];
|
||||
string fileName = item.Text;
|
||||
string friendlyName = item.SubItems[1].Text;
|
||||
|
||||
try
|
||||
{
|
||||
@ -670,7 +658,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
}
|
||||
|
||||
List<Nikse.SubtitleEdit.Logic.BluRaySup.BluRaySupParser.PcsData> bluRaySubtitles = new List<Nikse.SubtitleEdit.Logic.BluRaySup.BluRaySupParser.PcsData>();
|
||||
var bluRaySubtitles = new List<BluRaySupParser.PcsData>();
|
||||
bool isVobSub = false;
|
||||
bool isMatroska = false;
|
||||
if (format == null && fileName.ToLower().EndsWith(".sup") && Main.IsBluRaySupFile(fileName))
|
||||
@ -923,7 +911,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
p.Subtitle = Nikse.SubtitleEdit.Logic.Forms.SplitLongLinesHelper.SplitLongLinesInSubtitle(p.Subtitle, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.General.SubtitleLineMaximumLength);
|
||||
p.Subtitle = Logic.Forms.SplitLongLinesHelper.SplitLongLinesInSubtitle(p.Subtitle, Configuration.Settings.General.SubtitleLineMaximumLength * 2, Configuration.Settings.General.SubtitleLineMaximumLength);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@ -975,7 +963,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
bool success;
|
||||
if (checkBoxOverwriteOriginalFiles.Checked)
|
||||
{
|
||||
success = Main.BatchConvertSave(p.ToFormat, null, GetCurrentEncoding(), System.IO.Path.GetDirectoryName(p.FileName), _count, ref _converted, ref _errors, _allFormats, p.FileName, p.Subtitle, p.SourceFormat, true, string.Empty);
|
||||
success = Main.BatchConvertSave(p.ToFormat, null, GetCurrentEncoding(), Path.GetDirectoryName(p.FileName), _count, ref _converted, ref _errors, _allFormats, p.FileName, p.Subtitle, p.SourceFormat, true, string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1037,13 +1025,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void LinkLabelOpenOutputFolderLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
if (System.IO.Directory.Exists(textBoxOutputFolder.Text))
|
||||
if (Directory.Exists(textBoxOutputFolder.Text))
|
||||
System.Diagnostics.Process.Start(textBoxOutputFolder.Text);
|
||||
else
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.SplitSubtitle.FolderNotFoundX, textBoxOutputFolder.Text));
|
||||
}
|
||||
|
||||
private void ContextMenuStripFilesOpening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
private void ContextMenuStripFilesOpening(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (listViewInputFiles.Items.Count == 0 || _converting)
|
||||
{
|
||||
|
@ -1,4 +1,12 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Controls;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Logic.Enums;
|
||||
using Nikse.SubtitleEdit.Logic.Networking;
|
||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VideoFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VobSub;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
@ -6,13 +14,6 @@ using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Controls;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Logic.Enums;
|
||||
using Nikse.SubtitleEdit.Logic.Networking;
|
||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VobSub;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
@ -2226,7 +2227,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (ext == ".mkv" || ext == ".mks")
|
||||
{
|
||||
Matroska mkv = new Matroska();
|
||||
var mkv = new Matroska();
|
||||
bool isValid = false;
|
||||
bool hasConstantFrameRate = false;
|
||||
double frameRate = 0;
|
||||
@ -2743,7 +2744,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// check for RTF file
|
||||
if (fileName.ToLower().EndsWith(".rtf") && !s.Trim().StartsWith("{\\rtf"))
|
||||
{
|
||||
var rtBox = new System.Windows.Forms.RichTextBox();
|
||||
var rtBox = new RichTextBox();
|
||||
rtBox.Rtf = s;
|
||||
s = rtBox.Text;
|
||||
}
|
||||
@ -3700,11 +3701,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
return NuendoProperties.LoadCharacters(Configuration.Settings.SubtitleSettings.NuendoCharacterListFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBoxSubtitleFormatsEnter(object sender, EventArgs e)
|
||||
{
|
||||
@ -8120,7 +8118,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (frames >= 99)
|
||||
numericUpDownDuration.Value = (decimal)(seconds + ((Math.Round((Configuration.Settings.General.CurrentFrameRate - 1))) / 100.0));
|
||||
else
|
||||
numericUpDownDuration.Value = (decimal)(seconds + 1);
|
||||
numericUpDownDuration.Value = seconds + 1;
|
||||
numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged;
|
||||
}
|
||||
}
|
||||
@ -8980,13 +8978,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public static Subtitle LoadMatroskaSSa(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName, SubtitleFormat format, List<SubtitleSequence> sub)
|
||||
{
|
||||
Subtitle subtitle = new Subtitle();
|
||||
var subtitle = new Subtitle();
|
||||
subtitle.Header = matroskaSubtitleInfo.CodecPrivate;
|
||||
var lines = new List<string>();
|
||||
foreach (string l in subtitle.Header.Trim().Replace(Environment.NewLine, "\n").Split('\n'))
|
||||
lines.Add(l);
|
||||
StringBuilder footer = new StringBuilder();
|
||||
Subtitle comments = new Subtitle();
|
||||
var footer = new StringBuilder();
|
||||
var comments = new Subtitle();
|
||||
if (!string.IsNullOrEmpty(matroskaSubtitleInfo.CodecPrivate))
|
||||
{
|
||||
bool footerOn = false;
|
||||
@ -9289,7 +9287,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, fileName);
|
||||
if (_loading)
|
||||
{
|
||||
formSubOcr.Icon = (Icon)this.Icon.Clone();
|
||||
formSubOcr.Icon = (Icon)Icon.Clone();
|
||||
formSubOcr.ShowInTaskbar = true;
|
||||
formSubOcr.ShowIcon = true;
|
||||
}
|
||||
@ -13338,7 +13336,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private Paragraph InsertNewTextAtVideoPosition()
|
||||
{
|
||||
// current movie pos
|
||||
// current movie Position
|
||||
double videoPositionInMilliseconds = mediaPlayer.CurrentPosition * 1000.0;
|
||||
if (!mediaPlayer.IsPaused)
|
||||
videoPositionInMilliseconds -= Configuration.Settings.General.SetStartEndHumanDelay;
|
||||
@ -14365,7 +14363,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
System.Reflection.Assembly assembly;
|
||||
try
|
||||
{
|
||||
assembly = System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(pluginFileName));
|
||||
assembly = System.Reflection.Assembly.Load(File.ReadAllBytes(pluginFileName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -14380,9 +14378,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
object pluginObject = Activator.CreateInstance(pluginType);
|
||||
|
||||
// IPlugin
|
||||
System.Reflection.PropertyInfo[] pis = pluginType.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
|
||||
Type[] tt = pluginType.GetInterfaces();
|
||||
System.Reflection.PropertyInfo[] pis2 = tt[0].GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
|
||||
Type t = null;
|
||||
foreach (Type t2 in tt)
|
||||
{
|
||||
@ -14476,7 +14472,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
GetPropertiesAndDoAction(pluginFileName, out name, out text, out version, out description, out actionType, out shortcut, out mi);
|
||||
if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(actionType) && mi != null)
|
||||
{
|
||||
ToolStripMenuItem item = new ToolStripMenuItem();
|
||||
var item = new ToolStripMenuItem();
|
||||
item.Name = "Plugin" + toolsPluginCount.ToString();
|
||||
item.Text = text;
|
||||
item.Tag = pluginFileName;
|
||||
@ -14484,7 +14480,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrEmpty(shortcut))
|
||||
item.ShortcutKeys = Utilities.GetKeys(shortcut);
|
||||
|
||||
if (string.Compare(actionType, "File", true) == 0)
|
||||
if (String.Compare(actionType, "File", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if (filePluginCount == 0)
|
||||
{
|
||||
@ -14496,7 +14492,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
fileToolStripMenuItem.DropDownItems.Insert(fileToolStripMenuItem.DropDownItems.Count - 2, item);
|
||||
filePluginCount++;
|
||||
}
|
||||
else if (string.Compare(actionType, "Tool", true) == 0)
|
||||
else if (String.Compare(actionType, "Tool", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if (toolsPluginCount == 0)
|
||||
{
|
||||
@ -14508,7 +14504,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
toolsToolStripMenuItem.DropDownItems.Add(item);
|
||||
toolsPluginCount++;
|
||||
}
|
||||
else if (string.Compare(actionType, "Sync", true) == 0)
|
||||
else if (String.Compare(actionType, "Sync", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if (syncPluginCount == 0)
|
||||
{
|
||||
@ -14520,7 +14516,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
toolStripMenuItemSyncronization.DropDownItems.Add(item);
|
||||
syncPluginCount++;
|
||||
}
|
||||
else if (string.Compare(actionType, "Translate", true) == 0)
|
||||
else if (String.Compare(actionType, "Translate", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if (syncPluginCount == 0)
|
||||
{
|
||||
@ -14533,7 +14529,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
syncPluginCount++;
|
||||
}
|
||||
|
||||
else if (string.Compare(actionType, "SpellCheck", true) == 0)
|
||||
else if (String.Compare(actionType, "SpellCheck", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if (syncPluginCount == 0)
|
||||
{
|
||||
@ -14883,7 +14879,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void addParagraphHereToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
audioVisualizer.ClearSelection();
|
||||
Paragraph newParagraph = new Paragraph(audioVisualizer.NewSelectionParagraph);
|
||||
var newParagraph = new Paragraph(audioVisualizer.NewSelectionParagraph);
|
||||
if (newParagraph == null)
|
||||
return;
|
||||
|
||||
@ -15230,7 +15226,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var vobSubOcr = new VobSubOcr();
|
||||
if (showInTaskbar)
|
||||
{
|
||||
vobSubOcr.Icon = (Icon)this.Icon.Clone();
|
||||
vobSubOcr.Icon = (Icon)Icon.Clone();
|
||||
vobSubOcr.ShowInTaskbar = true;
|
||||
vobSubOcr.ShowIcon = true;
|
||||
}
|
||||
@ -16710,7 +16706,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// //TODO: search for start via wave file (must only be minor adjustment)
|
||||
//}
|
||||
|
||||
// current movie pos
|
||||
// current movie Position
|
||||
double durationTotalMilliseconds = p.Duration.TotalMilliseconds;
|
||||
double totalMillisecondsEnd = mediaPlayer.CurrentPosition * 1000.0;
|
||||
|
||||
@ -18118,7 +18114,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void toolStripMenuItemStatistics_Click(object sender, EventArgs e)
|
||||
{
|
||||
Statistics stats = new Statistics(_subtitle, _fileName, GetCurrentSubtitleFormat());
|
||||
var stats = new Statistics(_subtitle, _fileName, GetCurrentSubtitleFormat());
|
||||
_formPositionsAndSizes.SetPositionAndSize(stats);
|
||||
stats.ShowDialog(this);
|
||||
_formPositionsAndSizes.SavePositionAndSize(stats);
|
||||
@ -18657,7 +18653,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void toolStripMenuItemBatchConvert_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Visible = false;
|
||||
var form = new BatchConvert(this.Icon, this);
|
||||
var form = new BatchConvert(this.Icon);
|
||||
_formPositionsAndSizes.SetPositionAndSize(form);
|
||||
form.ShowDialog(this);
|
||||
_formPositionsAndSizes.SavePositionAndSize(form);
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.VideoFormats;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
|
@ -138,8 +138,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (_subtitle == null)
|
||||
return;
|
||||
|
||||
_removeTextForHILib.settings = GetSettings();
|
||||
_removeTextForHILib._warnings = new List<int>();
|
||||
_removeTextForHILib.Settings = GetSettings();
|
||||
_removeTextForHILib.Warnings = new List<int>();
|
||||
listViewFixes.BeginUpdate();
|
||||
listViewFixes.Items.Clear();
|
||||
int count = 0;
|
||||
@ -153,7 +153,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
prevText = prev.Text;
|
||||
prevIndex++;
|
||||
|
||||
_removeTextForHILib._warningIndex = prevIndex;
|
||||
_removeTextForHILib.WarningIndex = prevIndex;
|
||||
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text, prevText);
|
||||
bool hit = p.Text.Replace(" ", string.Empty) != newText.Replace(" ", string.Empty);
|
||||
if (hit)
|
||||
@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void AddToListView(Paragraph p, string newText)
|
||||
{
|
||||
var item = new ListViewItem(string.Empty) {Tag = p, Checked = true};
|
||||
if (_removeTextForHILib._warnings != null && _removeTextForHILib._warnings.Contains(_removeTextForHILib._warningIndex))
|
||||
if (_removeTextForHILib.Warnings != null && _removeTextForHILib.Warnings.Contains(_removeTextForHILib.WarningIndex))
|
||||
{
|
||||
item.UseItemStyleForSubItems = true;
|
||||
item.BackColor = Color.PeachPuff;
|
||||
@ -211,7 +211,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (prev != null)
|
||||
prevText = prev.Text;
|
||||
|
||||
_removeTextForHILib.settings = GetSettings();
|
||||
_removeTextForHILib.Settings = GetSettings();
|
||||
string newText = _removeTextForHILib.RemoveTextFromHearImpaired(p.Text, prevText);
|
||||
if (string.IsNullOrEmpty(newText))
|
||||
{
|
||||
|
4
src/Forms/VisualSync.Designer.cs
generated
4
src/Forms/VisualSync.Designer.cs
generated
@ -156,7 +156,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.buttonGotoStartSubtitlePosition.Name = "buttonGotoStartSubtitlePosition";
|
||||
this.buttonGotoStartSubtitlePosition.Size = new System.Drawing.Size(90, 21);
|
||||
this.buttonGotoStartSubtitlePosition.TabIndex = 4;
|
||||
this.buttonGotoStartSubtitlePosition.Text = "Goto sub pos";
|
||||
this.buttonGotoStartSubtitlePosition.Text = "Goto sub Position";
|
||||
this.buttonGotoStartSubtitlePosition.UseVisualStyleBackColor = true;
|
||||
this.buttonGotoStartSubtitlePosition.Click += new System.EventHandler(this.ButtonGotoStartSubtitlePositionClick);
|
||||
//
|
||||
@ -262,7 +262,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.buttonGotoEndSubtitlePosition.Name = "buttonGotoEndSubtitlePosition";
|
||||
this.buttonGotoEndSubtitlePosition.Size = new System.Drawing.Size(90, 21);
|
||||
this.buttonGotoEndSubtitlePosition.TabIndex = 4;
|
||||
this.buttonGotoEndSubtitlePosition.Text = "Goto sub pos";
|
||||
this.buttonGotoEndSubtitlePosition.Text = "Goto sub Position";
|
||||
this.buttonGotoEndSubtitlePosition.UseVisualStyleBackColor = true;
|
||||
this.buttonGotoEndSubtitlePosition.Click += new System.EventHandler(this.ButtonGotoEndSubtitlePositionClick);
|
||||
//
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@ -7,15 +8,15 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
{
|
||||
public class RemoveTextForHI
|
||||
{
|
||||
public RemoveTextForHISettings settings { get; set; }
|
||||
public RemoveTextForHISettings Settings { get; set; }
|
||||
|
||||
private List<string> _interjectionList;
|
||||
public List<int> _warnings;
|
||||
public int _warningIndex;
|
||||
public List<int> Warnings;
|
||||
public int WarningIndex;
|
||||
|
||||
public RemoveTextForHI(RemoveTextForHISettings removeTextForHISettings)
|
||||
{
|
||||
settings = removeTextForHISettings;
|
||||
Settings = removeTextForHISettings;
|
||||
}
|
||||
|
||||
public string RemoveHearImpairedtagsInsideLine(string newText)
|
||||
@ -62,10 +63,10 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
public string RemoveColon(string text, string prevText)
|
||||
{
|
||||
if (!settings.RemoveTextBeforeColon)
|
||||
if (!Settings.RemoveTextBeforeColon)
|
||||
return text;
|
||||
|
||||
if (text.IndexOf(":") < 0)
|
||||
if (text.IndexOf(":", StringComparison.Ordinal) < 0)
|
||||
return text;
|
||||
|
||||
// House 7x01 line 52: and she would like you to do three things:
|
||||
@ -81,11 +82,11 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
bool removedInSecondLine = false;
|
||||
foreach (string s in parts)
|
||||
{
|
||||
int indexOfColon = s.IndexOf(":");
|
||||
int indexOfColon = s.IndexOf(":", StringComparison.Ordinal);
|
||||
if (indexOfColon > 0)
|
||||
{
|
||||
string pre = s.Substring(0, indexOfColon);
|
||||
if (settings.RemoveTextBeforeColonOnlyUppercase && pre.Replace("<i>", string.Empty) != pre.Replace("<i>", string.Empty).ToUpper())
|
||||
if (Settings.RemoveTextBeforeColonOnlyUppercase && pre.Replace("<i>", string.Empty) != pre.Replace("<i>", string.Empty).ToUpper())
|
||||
{
|
||||
newText = newText + Environment.NewLine + s;
|
||||
newText = newText.Trim();
|
||||
@ -134,7 +135,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
if (s.StartsWith("Previously on") || s.StartsWith("<i>Previously on"))
|
||||
remove = false;
|
||||
|
||||
if (remove && settings.ColonSeparateLine)
|
||||
if (remove && Settings.ColonSeparateLine)
|
||||
{
|
||||
if (indexOfColon == s.Length - 1 || s.Substring(indexOfColon + 1).StartsWith(Environment.NewLine))
|
||||
remove = true;
|
||||
@ -192,18 +193,16 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
{
|
||||
if (s2.Contains(":"))
|
||||
{
|
||||
int colonIndex = s2.IndexOf(":");
|
||||
int colonIndex = s2.IndexOf(":", StringComparison.Ordinal);
|
||||
string start = s2.Substring(0, colonIndex);
|
||||
|
||||
bool doContinue = true;
|
||||
if (settings.RemoveTextBeforeColonOnlyUppercase && start != start.ToUpper())
|
||||
doContinue = false;
|
||||
bool doContinue = !Settings.RemoveTextBeforeColonOnlyUppercase && start != start.ToUpper();
|
||||
if (doContinue)
|
||||
{
|
||||
|
||||
int periodIndex = start.LastIndexOf(". ");
|
||||
int questIndex = start.LastIndexOf("? ");
|
||||
int exclaIndex = start.LastIndexOf("! ");
|
||||
int periodIndex = start.LastIndexOf(". ", StringComparison.Ordinal);
|
||||
int questIndex = start.LastIndexOf("? ", StringComparison.Ordinal);
|
||||
int exclaIndex = start.LastIndexOf("! ", StringComparison.Ordinal);
|
||||
int endIndex = periodIndex;
|
||||
if (endIndex == -1 || questIndex > endIndex)
|
||||
endIndex = questIndex;
|
||||
@ -285,7 +284,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
newText = st.Pre + "- " + st.StrippedText + st.Post;
|
||||
}
|
||||
|
||||
int indexOfNewLine = newText.IndexOf(Environment.NewLine);
|
||||
int indexOfNewLine = newText.IndexOf(Environment.NewLine, StringComparison.Ordinal);
|
||||
string second = newText.Substring(indexOfNewLine).Trim();
|
||||
indexOfDialogChar = second.IndexOf('-');
|
||||
if (indexOfDialogChar < 0 || indexOfDialogChar > 6)
|
||||
@ -302,7 +301,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
if (st.Pre.Contains("-"))
|
||||
newText = st.Pre.Replace("-", string.Empty) + st.StrippedText + st.Post;
|
||||
}
|
||||
else if (Utilities.CountTagInText(newText, Environment.NewLine) == 1 && removedInFirstLine == false && removedInSecondLine == true)
|
||||
else if (Utilities.CountTagInText(newText, Environment.NewLine) == 1 && removedInFirstLine == false && removedInSecondLine)
|
||||
{
|
||||
string noTags = Utilities.RemoveHtmlTags(newText, true).Trim();
|
||||
bool insertDash = noTags.StartsWith("-") && Utilities.CountTagInText(noTags, "-") == 1;
|
||||
@ -321,7 +320,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
public string RemoveTextFromHearImpaired(string text, string prevText)
|
||||
{
|
||||
if (settings.RemoveWhereContains && settings.RemoveIfTextContains.Length > 0 && text.Contains(settings.RemoveIfTextContains))
|
||||
if (Settings.RemoveWhereContains && Settings.RemoveIfTextContains.Length > 0 && text.Contains(Settings.RemoveIfTextContains))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
@ -330,10 +329,10 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
text = RemoveColon(text, prevText);
|
||||
string pre = " >-\"'‘`´♪¿¡.…—";
|
||||
string post = " -\"'`´♪.!?:…—";
|
||||
if (settings.RemoveTextBetweenCustomTags)
|
||||
if (Settings.RemoveTextBetweenCustomTags)
|
||||
{
|
||||
pre = pre.Replace(settings.CustomStart, string.Empty);
|
||||
post = post.Replace(settings.CustomEnd, string.Empty);
|
||||
pre = pre.Replace(Settings.CustomStart, string.Empty);
|
||||
post = post.Replace(Settings.CustomEnd, string.Empty);
|
||||
}
|
||||
var st = new StripableText(text, pre, post);
|
||||
var sb = new StringBuilder();
|
||||
@ -395,7 +394,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
text = RemoveColon(text, prevText);
|
||||
text = RemoveLineIfAllUppercase(text);
|
||||
text = RemoveHearImpairedtagsInsideLine(text);
|
||||
if (settings.RemoveInterjections)
|
||||
if (Settings.RemoveInterjections)
|
||||
text = RemoveInterjections(text);
|
||||
|
||||
st = new StripableText(text, " >-\"'‘`´♪¿¡.…—", " -\"'`´♪.!?:…—");
|
||||
@ -416,11 +415,11 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
{
|
||||
StripableText temp = new StripableText(text);
|
||||
temp.StrippedText = temp.StrippedText.Replace(Environment.NewLine, " ");
|
||||
int splitIndex = temp.StrippedText.LastIndexOf("!");
|
||||
int splitIndex = temp.StrippedText.LastIndexOf("!", StringComparison.Ordinal);
|
||||
if (splitIndex == -1)
|
||||
splitIndex = temp.StrippedText.LastIndexOf("?");
|
||||
splitIndex = temp.StrippedText.LastIndexOf("?", StringComparison.Ordinal);
|
||||
if (splitIndex == -1)
|
||||
splitIndex = temp.StrippedText.LastIndexOf(".");
|
||||
splitIndex = temp.StrippedText.LastIndexOf(".", StringComparison.Ordinal);
|
||||
if (splitIndex > 0)
|
||||
{
|
||||
text = temp.Pre + temp.StrippedText.Insert(splitIndex + 1, Environment.NewLine) + temp.Post;
|
||||
@ -468,13 +467,13 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
text = text.Insert(4, " ");
|
||||
if (text.Contains(Environment.NewLine + "-"))
|
||||
{
|
||||
int index = text.IndexOf(Environment.NewLine + "-");
|
||||
int index = text.IndexOf(Environment.NewLine + "-", StringComparison.Ordinal);
|
||||
if (index + 4 < text.Length && text[index + Environment.NewLine.Length + 1] != ' ' && text[index + Environment.NewLine.Length + 1] != '-')
|
||||
text = text.Insert(index + Environment.NewLine.Length + 1, " ");
|
||||
}
|
||||
if (text.Contains(Environment.NewLine + "<i>-"))
|
||||
{
|
||||
int index = text.IndexOf(Environment.NewLine + "<i>-");
|
||||
int index = text.IndexOf(Environment.NewLine + "<i>-", StringComparison.Ordinal);
|
||||
if (index + 5 < text.Length && text[index + Environment.NewLine.Length + 4] != ' ' && text[index + Environment.NewLine.Length + 4] != '-')
|
||||
text = text.Insert(index + Environment.NewLine.Length + 4, " ");
|
||||
}
|
||||
@ -484,10 +483,10 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
private void AddWarning()
|
||||
{
|
||||
if (_warnings == null || _warningIndex < 0)
|
||||
if (Warnings == null || WarningIndex < 0)
|
||||
return;
|
||||
|
||||
_warnings.Add(_warningIndex);
|
||||
Warnings.Add(WarningIndex);
|
||||
}
|
||||
|
||||
private bool IsHIDescription(string text)
|
||||
@ -537,7 +536,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
{
|
||||
oldText = oldText.ToLower();
|
||||
newText = newText.ToLower();
|
||||
int start = oldText.IndexOf(newText);
|
||||
int start = oldText.IndexOf(newText, StringComparison.Ordinal);
|
||||
string result;
|
||||
if (start > 0)
|
||||
result = oldText.Substring(0, oldText.Length - newText.Length);
|
||||
@ -674,9 +673,9 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
temp = temp.Remove(0, 1);
|
||||
doRepeat = true;
|
||||
}
|
||||
if (temp.Length > 0 && s[0].ToString() != s[0].ToString().ToLower())
|
||||
if (temp.Length > 0 && s[0].ToString(CultureInfo.InvariantCulture) != s[0].ToString(CultureInfo.InvariantCulture).ToLower())
|
||||
{
|
||||
temp = temp.Remove(0, 1).Insert(0, temp[0].ToString().ToUpper());
|
||||
temp = temp.Remove(0, 1).Insert(0, temp[0].ToString(CultureInfo.InvariantCulture).ToUpper());
|
||||
doRepeat = true;
|
||||
}
|
||||
temp = pre + temp;
|
||||
@ -721,26 +720,26 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
{
|
||||
string newText = text;
|
||||
string s = text;
|
||||
if (s.StartsWith("[") && s.IndexOf("]") > 0 && settings.RemoveTextBetweenSquares)
|
||||
newText = s.Remove(0, s.IndexOf("]") + 1);
|
||||
else if (s.StartsWith("{") && s.IndexOf("}") > 0 && settings.RemoveTextBetweenBrackets)
|
||||
newText = s.Remove(0, s.IndexOf("}") + 1);
|
||||
else if (s.StartsWith("?") && s.IndexOf("?", 1) > 0 && settings.RemoveTextBetweenQuestionMarks)
|
||||
newText = s.Remove(0, s.IndexOf("?", 1) + 1);
|
||||
else if (s.StartsWith("(") && s.IndexOf(")") > 0 && settings.RemoveTextBetweenParentheses)
|
||||
newText = s.Remove(0, s.IndexOf(")") + 1);
|
||||
else if (s.StartsWith("[") && s.IndexOf("]:") > 0 && settings.RemoveTextBetweenSquares)
|
||||
newText = s.Remove(0, s.IndexOf("]:") + 2);
|
||||
else if (s.StartsWith("{") && s.IndexOf("}:") > 0 && settings.RemoveTextBetweenBrackets)
|
||||
newText = s.Remove(0, s.IndexOf("}:") + 2);
|
||||
else if (s.StartsWith("?") && s.IndexOf("?:", 1) > 0 && settings.RemoveTextBetweenQuestionMarks)
|
||||
newText = s.Remove(0, s.IndexOf("?:") + 2);
|
||||
else if (s.StartsWith("(") && s.IndexOf("):") > 0 && settings.RemoveTextBetweenParentheses)
|
||||
newText = s.Remove(0, s.IndexOf("):") + 2);
|
||||
else if (settings.RemoveTextBetweenCustomTags &&
|
||||
s.Length > 0 && settings.CustomEnd.Length > 0 && settings.CustomStart.Length > 0 &&
|
||||
s.StartsWith(settings.CustomStart) && s.LastIndexOf(settings.CustomEnd) > 0)
|
||||
newText = s.Remove(0, s.LastIndexOf(settings.CustomEnd) + settings.CustomEnd.Length);
|
||||
if (s.StartsWith("[") && s.IndexOf("]", StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenSquares)
|
||||
newText = s.Remove(0, s.IndexOf("]", StringComparison.Ordinal) + 1);
|
||||
else if (s.StartsWith("{") && s.IndexOf("}", StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenBrackets)
|
||||
newText = s.Remove(0, s.IndexOf("}", StringComparison.Ordinal) + 1);
|
||||
else if (s.StartsWith("?") && s.IndexOf("?", 1, StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenQuestionMarks)
|
||||
newText = s.Remove(0, s.IndexOf("?", 1, StringComparison.Ordinal) + 1);
|
||||
else if (s.StartsWith("(") && s.IndexOf(")", StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenParentheses)
|
||||
newText = s.Remove(0, s.IndexOf(")", StringComparison.Ordinal) + 1);
|
||||
else if (s.StartsWith("[") && s.IndexOf("]:", StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenSquares)
|
||||
newText = s.Remove(0, s.IndexOf("]:", StringComparison.Ordinal) + 2);
|
||||
else if (s.StartsWith("{") && s.IndexOf("}:", StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenBrackets)
|
||||
newText = s.Remove(0, s.IndexOf("}:", StringComparison.Ordinal) + 2);
|
||||
else if (s.StartsWith("?") && s.IndexOf("?:", 1, StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenQuestionMarks)
|
||||
newText = s.Remove(0, s.IndexOf("?:", StringComparison.Ordinal) + 2);
|
||||
else if (s.StartsWith("(") && s.IndexOf("):", StringComparison.Ordinal) > 0 && Settings.RemoveTextBetweenParentheses)
|
||||
newText = s.Remove(0, s.IndexOf("):", StringComparison.Ordinal) + 2);
|
||||
else if (Settings.RemoveTextBetweenCustomTags &&
|
||||
s.Length > 0 && Settings.CustomEnd.Length > 0 && Settings.CustomStart.Length > 0 &&
|
||||
s.StartsWith(Settings.CustomStart) && s.LastIndexOf(Settings.CustomEnd, StringComparison.Ordinal) > 0)
|
||||
newText = s.Remove(0, s.LastIndexOf(Settings.CustomEnd, StringComparison.Ordinal) + Settings.CustomEnd.Length);
|
||||
if (newText != text)
|
||||
newText = newText.TrimStart(' ');
|
||||
return newText;
|
||||
@ -748,33 +747,33 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
public string RemoveHearImpairedTags(string text)
|
||||
{
|
||||
if (settings.RemoveTextBetweenSquares)
|
||||
if (Settings.RemoveTextBetweenSquares)
|
||||
{
|
||||
text = RemoveTextBetweenTags("[", "]:", text);
|
||||
text = RemoveTextBetweenTags("[", "]", text);
|
||||
}
|
||||
|
||||
if (settings.RemoveTextBetweenBrackets)
|
||||
if (Settings.RemoveTextBetweenBrackets)
|
||||
{
|
||||
text = RemoveTextBetweenTags("{", "}:", text);
|
||||
text = RemoveTextBetweenTags("{", "}", text);
|
||||
}
|
||||
|
||||
if (settings.RemoveTextBetweenQuestionMarks)
|
||||
if (Settings.RemoveTextBetweenQuestionMarks)
|
||||
{
|
||||
text = RemoveTextBetweenTags("?", "?:", text);
|
||||
text = RemoveTextBetweenTags("?", "?", text);
|
||||
}
|
||||
|
||||
if (settings.RemoveTextBetweenParentheses)
|
||||
if (Settings.RemoveTextBetweenParentheses)
|
||||
{
|
||||
text = RemoveTextBetweenTags("(", "):", text);
|
||||
text = RemoveTextBetweenTags("(", ")", text);
|
||||
}
|
||||
|
||||
if (settings.RemoveTextBetweenCustomTags && settings.CustomStart.Length > 0 && settings.CustomEnd.Length > 0)
|
||||
if (Settings.RemoveTextBetweenCustomTags && Settings.CustomStart.Length > 0 && Settings.CustomEnd.Length > 0)
|
||||
{
|
||||
text = RemoveTextBetweenTags(settings.CustomStart, settings.CustomEnd, text);
|
||||
text = RemoveTextBetweenTags(Settings.CustomStart, Settings.CustomEnd, text);
|
||||
}
|
||||
|
||||
return text;
|
||||
@ -787,7 +786,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
public bool HasHearImpariedTagsAtStart(string text)
|
||||
{
|
||||
if (settings.OnlyIfInSeparateLine)
|
||||
if (Settings.OnlyIfInSeparateLine)
|
||||
return StartAndEndsWithHearImpariedTags(text);
|
||||
|
||||
return HasHearImpairedText(text);
|
||||
@ -795,7 +794,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
public bool HasHearImpariedTagsAtEnd(string text)
|
||||
{
|
||||
if (settings.OnlyIfInSeparateLine)
|
||||
if (Settings.OnlyIfInSeparateLine)
|
||||
return StartAndEndsWithHearImpariedTags(text);
|
||||
|
||||
return HasHearImpairedText(text);
|
||||
@ -803,17 +802,17 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
private bool StartAndEndsWithHearImpariedTags(string text)
|
||||
{
|
||||
return (text.StartsWith("[") && text.EndsWith("]") && !text.Trim('[').Contains("[") && settings.RemoveTextBetweenSquares) ||
|
||||
(text.StartsWith("{") && text.EndsWith("}") && !text.Trim('{').Contains("{") && settings.RemoveTextBetweenBrackets) ||
|
||||
(text.StartsWith("?") && text.EndsWith("?") && !text.Trim('?').Contains("?") && settings.RemoveTextBetweenQuestionMarks) ||
|
||||
(text.StartsWith("(") && text.EndsWith(")") && !text.Trim('(').Contains("(") && settings.RemoveTextBetweenParentheses) ||
|
||||
(text.StartsWith("[") && text.EndsWith("]:") && !text.Trim('[').Contains("[") && settings.RemoveTextBetweenSquares) ||
|
||||
(text.StartsWith("{") && text.EndsWith("}:") && !text.Trim('{').Contains("{") && settings.RemoveTextBetweenBrackets) ||
|
||||
(text.StartsWith("?") && text.EndsWith("?:") && !text.Trim('?').Contains("?") && settings.RemoveTextBetweenQuestionMarks) ||
|
||||
(text.StartsWith("(") && text.EndsWith("):") && !text.Trim('(').Contains("(") && settings.RemoveTextBetweenParentheses) ||
|
||||
(settings.RemoveTextBetweenCustomTags &&
|
||||
settings.CustomStart.Length > 0 && settings.CustomEnd.Length > 0 &&
|
||||
text.StartsWith(settings.CustomStart) && text.EndsWith(settings.CustomEnd));
|
||||
return (text.StartsWith("[") && text.EndsWith("]") && !text.Trim('[').Contains("[") && Settings.RemoveTextBetweenSquares) ||
|
||||
(text.StartsWith("{") && text.EndsWith("}") && !text.Trim('{').Contains("{") && Settings.RemoveTextBetweenBrackets) ||
|
||||
(text.StartsWith("?") && text.EndsWith("?") && !text.Trim('?').Contains("?") && Settings.RemoveTextBetweenQuestionMarks) ||
|
||||
(text.StartsWith("(") && text.EndsWith(")") && !text.Trim('(').Contains("(") && Settings.RemoveTextBetweenParentheses) ||
|
||||
(text.StartsWith("[") && text.EndsWith("]:") && !text.Trim('[').Contains("[") && Settings.RemoveTextBetweenSquares) ||
|
||||
(text.StartsWith("{") && text.EndsWith("}:") && !text.Trim('{').Contains("{") && Settings.RemoveTextBetweenBrackets) ||
|
||||
(text.StartsWith("?") && text.EndsWith("?:") && !text.Trim('?').Contains("?") && Settings.RemoveTextBetweenQuestionMarks) ||
|
||||
(text.StartsWith("(") && text.EndsWith("):") && !text.Trim('(').Contains("(") && Settings.RemoveTextBetweenParentheses) ||
|
||||
(Settings.RemoveTextBetweenCustomTags &&
|
||||
Settings.CustomStart.Length > 0 && Settings.CustomEnd.Length > 0 &&
|
||||
text.StartsWith(Settings.CustomStart) && text.EndsWith(Settings.CustomEnd));
|
||||
}
|
||||
|
||||
private static string RemoveTextBetweenTags(string startTag, string endTag, string text)
|
||||
@ -826,17 +825,17 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
return text;
|
||||
}
|
||||
|
||||
int start = text.IndexOf(startTag);
|
||||
int start = text.IndexOf(startTag, StringComparison.Ordinal);
|
||||
if (start == -1 || start == text.Length - 1)
|
||||
return text;
|
||||
|
||||
int end = text.IndexOf(endTag, start + 1);
|
||||
int end = text.IndexOf(endTag, start + 1, StringComparison.Ordinal);
|
||||
while (start >= 0 && end > start)
|
||||
{
|
||||
text = text.Remove(start, (end - start) + 1);
|
||||
start = text.IndexOf(startTag);
|
||||
start = text.IndexOf(startTag, StringComparison.Ordinal);
|
||||
if (start >= 0 && start < text.Length - 1)
|
||||
end = text.IndexOf(endTag, start);
|
||||
end = text.IndexOf(endTag, start, StringComparison.Ordinal);
|
||||
else
|
||||
end = -1;
|
||||
}
|
||||
@ -845,7 +844,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
public string RemoveLineIfAllUppercase(string text)
|
||||
{
|
||||
if (!settings.RemoveIfAllUppercase)
|
||||
if (!Settings.RemoveIfAllUppercase)
|
||||
return text;
|
||||
|
||||
string[] lines = text.Replace(Environment.NewLine, "\n").Replace("\r", "\n").Split('\n');
|
||||
@ -853,7 +852,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
foreach (string line in lines)
|
||||
{
|
||||
string lineNoHtml = Utilities.RemoveHtmlTags(line);
|
||||
string tmp = lineNoHtml.TrimEnd(new char[] { '.', '!', '?', ':', }).Trim();
|
||||
string tmp = lineNoHtml.TrimEnd(new[] { '.', '!', '?', ':', }).Trim();
|
||||
if (lineNoHtml != lineNoHtml.ToLower() && lineNoHtml == lineNoHtml.ToUpper())
|
||||
{
|
||||
if (tmp == "YES" || tmp == "NO" || tmp == "WHY" || tmp == "HI" || tmp.Length == 1)
|
||||
|
@ -19,7 +19,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
public string CustomStart { get; set; }
|
||||
public string CustomEnd { get; set; }
|
||||
|
||||
public void LoadFromConfiguration()
|
||||
public RemoveTextForHISettings()
|
||||
{
|
||||
OnlyIfInSeparateLine = Configuration.Settings.RemoveTextForHearingImpaired.RemoveTextBetweenOnlySeperateLines;
|
||||
RemoveIfAllUppercase = Configuration.Settings.RemoveTextForHearingImpaired.RemoveIfAllUppercase;
|
||||
|
@ -1386,7 +1386,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
AutoContinueInXSeconds = "Auto continue in {0} seconds",
|
||||
StillTypingAutoContinueStopped = "Still typing... auto continue stopped",
|
||||
|
||||
InsertNewSubtitleAtVideoPosition = "&Insert new subtitle at video pos",
|
||||
InsertNewSubtitleAtVideoPosition = "&Insert new subtitle at video Position",
|
||||
Auto = "Auto",
|
||||
PlayFromJustBeforeText = "Play from just before &text",
|
||||
Pause = "Pause",
|
||||
@ -1687,12 +1687,12 @@ can edit in same subtitle file (collaboration)",
|
||||
ShowLineBreaksAs = "Show line breaks in list view as",
|
||||
MainListViewDoubleClickAction = "Double-clicking line in main window list view will",
|
||||
MainListViewNothing = "Nothing",
|
||||
MainListViewVideoGoToPositionAndPause= "Go to video pos and pause",
|
||||
MainListViewVideoGoToPositionAndPlay = "Go to video pos and play",
|
||||
MainListViewVideoGoToPositionAndPause= "Go to video Position and pause",
|
||||
MainListViewVideoGoToPositionAndPlay = "Go to video Position and play",
|
||||
MainListViewEditText = "Go to edit text box",
|
||||
MainListViewVideoGoToPositionMinus1SecAndPause = "Go to video pos - 1 sec and pause",
|
||||
MainListViewVideoGoToPositionMinusHalfSecAndPause = "Go to video pos - 0.5 sec and pause",
|
||||
MainListViewVideoGoToPositionMinus1SecAndPlay = "Go to video pos - 1 sec and play",
|
||||
MainListViewVideoGoToPositionMinus1SecAndPause = "Go to video Position - 1 sec and pause",
|
||||
MainListViewVideoGoToPositionMinusHalfSecAndPause = "Go to video Position - 0.5 sec and pause",
|
||||
MainListViewVideoGoToPositionMinus1SecAndPlay = "Go to video Position - 1 sec and play",
|
||||
MainListViewEditTextAndPause = "Go to edit text box, and pause at video position",
|
||||
AutoBackup = "Auto-backup",
|
||||
AutoBackupEveryMinute = "Every minute",
|
||||
@ -2109,7 +2109,7 @@ can edit in same subtitle file (collaboration)",
|
||||
ThreeSecondsBack = "< 3 secs",
|
||||
PlayXSecondsAndBack = "Play {0} secs and back",
|
||||
FindText = "Find text",
|
||||
GoToSubPosition = "Go to sub pos",
|
||||
GoToSubPosition = "Go to sub Position",
|
||||
KeepChangesTitle = "Keep changes?",
|
||||
KeepChangesMessage = @"Changes have been made to subtitle in 'Visual sync'.
|
||||
|
||||
|
@ -5,10 +5,10 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
{
|
||||
public class Box
|
||||
{
|
||||
internal byte[] buffer;
|
||||
internal ulong pos;
|
||||
internal string name;
|
||||
internal UInt64 size;
|
||||
internal byte[] Buffer;
|
||||
internal ulong Position;
|
||||
internal string Name;
|
||||
internal UInt64 Size;
|
||||
|
||||
public uint GetUInt(byte[] buffer, int index)
|
||||
{
|
||||
@ -17,19 +17,19 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
public uint GetUInt(int index)
|
||||
{
|
||||
return (uint)((buffer[index] << 24) + (buffer[index + 1] << 16) + (buffer[index + 2] << 8) + buffer[index + 3]);
|
||||
return (uint)((Buffer[index] << 24) + (Buffer[index + 1] << 16) + (Buffer[index + 2] << 8) + Buffer[index + 3]);
|
||||
}
|
||||
|
||||
public UInt64 GetUInt64(int index)
|
||||
{
|
||||
return (UInt64)buffer[index] << 56 | (UInt64)buffer[index + 1] << 48 | (UInt64)buffer[index + 2] << 40 | (UInt64)buffer[index+3] << 32 |
|
||||
(UInt64)buffer[index + 4] << 24 | (UInt64)buffer[index + 5] << 16 | (UInt64)buffer[index + 6] << 8 | (UInt64)buffer[index+7];
|
||||
return (UInt64)Buffer[index] << 56 | (UInt64)Buffer[index + 1] << 48 | (UInt64)Buffer[index + 2] << 40 | (UInt64)Buffer[index+3] << 32 |
|
||||
(UInt64)Buffer[index + 4] << 24 | (UInt64)Buffer[index + 5] << 16 | (UInt64)Buffer[index + 6] << 8 | Buffer[index+7];
|
||||
}
|
||||
|
||||
public UInt64 GetUInt64(byte[] buffer, int index)
|
||||
{
|
||||
return (UInt64)buffer[index] << 56 | (UInt64)buffer[index + 1] << 48 | (UInt64)buffer[index + 2] << 40 | (UInt64)buffer[index + 3] << 32 |
|
||||
(UInt64)buffer[index + 4] << 24 | (UInt64)buffer[index + 5] << 16 | (UInt64)buffer[index + 6] << 8 | (UInt64)buffer[index + 7];
|
||||
(UInt64)buffer[index + 4] << 24 | (UInt64)buffer[index + 5] << 16 | (UInt64)buffer[index + 6] << 8 | buffer[index + 7];
|
||||
}
|
||||
|
||||
public int GetWord(byte[] buffer, int index)
|
||||
@ -39,12 +39,12 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
public int GetWord(int index)
|
||||
{
|
||||
return (buffer[index] << 8) + buffer[index + 1];
|
||||
return (Buffer[index] << 8) + Buffer[index + 1];
|
||||
}
|
||||
|
||||
public string GetString(int index, int count)
|
||||
{
|
||||
return Encoding.UTF8.GetString(buffer, index, count);
|
||||
return Encoding.UTF8.GetString(Buffer, index, count);
|
||||
}
|
||||
|
||||
public string GetString(byte[] buffer, int index, int count)
|
||||
@ -56,25 +56,25 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
internal bool InitializeSizeAndName(System.IO.FileStream fs)
|
||||
{
|
||||
buffer = new byte[8];
|
||||
var bytesRead = fs.Read(buffer, 0, buffer.Length);
|
||||
if (bytesRead < buffer.Length)
|
||||
Buffer = new byte[8];
|
||||
var bytesRead = fs.Read(Buffer, 0, Buffer.Length);
|
||||
if (bytesRead < Buffer.Length)
|
||||
return false;
|
||||
size = GetUInt(0);
|
||||
name = GetString(4, 4);
|
||||
Size = GetUInt(0);
|
||||
Name = GetString(4, 4);
|
||||
|
||||
if (size == 0)
|
||||
if (Size == 0)
|
||||
{
|
||||
size = (UInt64)(fs.Length - fs.Position);
|
||||
Size = (UInt64)(fs.Length - fs.Position);
|
||||
}
|
||||
if (size == 1)
|
||||
if (Size == 1)
|
||||
{
|
||||
bytesRead = fs.Read(buffer, 0, buffer.Length);
|
||||
if (bytesRead < buffer.Length)
|
||||
bytesRead = fs.Read(Buffer, 0, Buffer.Length);
|
||||
if (bytesRead < Buffer.Length)
|
||||
return false;
|
||||
size = GetUInt64(0) - 8;
|
||||
Size = GetUInt64(0) - 8;
|
||||
}
|
||||
pos = ((ulong)(fs.Position)) + size - 8;
|
||||
Position = ((ulong)(fs.Position)) + Size - 8;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
@ -15,10 +16,10 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
public Mdhd(FileStream fs, ulong size)
|
||||
{
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
Buffer = new byte[size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
int languageIndex = 20;
|
||||
int version = buffer[0];
|
||||
int version = Buffer[0];
|
||||
if (version == 0)
|
||||
{
|
||||
CreationTime = GetUInt(4);
|
||||
@ -38,13 +39,13 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
}
|
||||
|
||||
// language code = skip first byte, 5 bytes + 5 bytes + 5 bytes (add 0x60 to get ascii value)
|
||||
int languageByte = ((buffer[languageIndex] << 1) >> 3) + 0x60;
|
||||
int languageByte2 = ((buffer[languageIndex] & 0x3) << 3) + (buffer[languageIndex + 1] >> 5) + 0x60;
|
||||
int languageByte3 = (buffer[languageIndex + 1] & 0x1f) + 0x60;
|
||||
int languageByte = ((Buffer[languageIndex] << 1) >> 3) + 0x60;
|
||||
int languageByte2 = ((Buffer[languageIndex] & 0x3) << 3) + (Buffer[languageIndex + 1] >> 5) + 0x60;
|
||||
int languageByte3 = (Buffer[languageIndex + 1] & 0x1f) + 0x60;
|
||||
char x = (char)languageByte;
|
||||
char x2 = (char)languageByte2;
|
||||
char x3 = (char)languageByte3;
|
||||
Iso639ThreeLetterCode = x.ToString() + x2.ToString() + x3.ToString();
|
||||
Iso639ThreeLetterCode = x.ToString(CultureInfo.InvariantCulture) + x2.ToString(CultureInfo.InvariantCulture) + x3.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public string LanguageString
|
||||
|
@ -37,32 +37,32 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
public Mdia(FileStream fs, ulong maximumLength)
|
||||
{
|
||||
pos = (ulong)fs.Position;
|
||||
Position = (ulong)fs.Position;
|
||||
while (fs.Position < (long)maximumLength)
|
||||
{
|
||||
if (!InitializeSizeAndName(fs))
|
||||
return;
|
||||
|
||||
if (name == "minf" && IsTextSubtitle || IsVobSubSubtitle || IsClosedCaption)
|
||||
if (Name == "minf" && IsTextSubtitle || IsVobSubSubtitle || IsClosedCaption)
|
||||
{
|
||||
UInt32 timeScale = 90000;
|
||||
if (Mdhd != null)
|
||||
timeScale = Mdhd.TimeScale;
|
||||
Minf = new Minf(fs, pos, timeScale, HandlerType, this);
|
||||
Minf = new Minf(fs, Position, timeScale, HandlerType, this);
|
||||
}
|
||||
else if (name == "hdlr")
|
||||
else if (Name == "hdlr")
|
||||
{
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
Buffer = new byte[Size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
HandlerType = GetString(8, 4);
|
||||
if (size > 25)
|
||||
HandlerName = GetString(24, buffer.Length - (24 + 5)); // TODO: how to find this?
|
||||
if (Size > 25)
|
||||
HandlerName = GetString(24, Buffer.Length - (24 + 5)); // TODO: how to find this?
|
||||
}
|
||||
else if (name == "mdhd")
|
||||
else if (Name == "mdhd")
|
||||
{
|
||||
Mdhd = new Mdhd(fs, size);
|
||||
Mdhd = new Mdhd(fs, Size);
|
||||
}
|
||||
fs.Seek((long)pos, SeekOrigin.Begin);
|
||||
fs.Seek((long)Position, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,16 +10,16 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
public Minf(FileStream fs, ulong maximumLength, UInt32 timeScale, string handlerType, Mdia mdia)
|
||||
{
|
||||
pos = (ulong)fs.Position;
|
||||
Position = (ulong)fs.Position;
|
||||
while (fs.Position < (long)maximumLength)
|
||||
{
|
||||
if (!InitializeSizeAndName(fs))
|
||||
return;
|
||||
|
||||
if (name == "stbl")
|
||||
Stbl = new Stbl(fs, pos, timeScale, handlerType, mdia);
|
||||
if (Name == "stbl")
|
||||
Stbl = new Stbl(fs, Position, timeScale, handlerType, mdia);
|
||||
|
||||
fs.Seek((long)pos, SeekOrigin.Begin);
|
||||
fs.Seek((long)Position, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,18 +11,18 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
public Moov(FileStream fs, ulong maximumLength)
|
||||
{
|
||||
Tracks = new List<Trak>();
|
||||
pos = (ulong) fs.Position;
|
||||
Position = (ulong) fs.Position;
|
||||
while (fs.Position < (long)maximumLength)
|
||||
{
|
||||
if (!InitializeSizeAndName(fs))
|
||||
return;
|
||||
|
||||
if (name == "trak")
|
||||
Tracks.Add(new Trak(fs, pos));
|
||||
else if (name == "mvhd")
|
||||
Mvhd = new Mvhd(fs, pos);
|
||||
if (Name == "trak")
|
||||
Tracks.Add(new Trak(fs, Position));
|
||||
else if (Name == "mvhd")
|
||||
Mvhd = new Mvhd(fs);
|
||||
|
||||
fs.Seek((long)pos, SeekOrigin.Begin);
|
||||
fs.Seek((long)Position, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
public readonly uint Duration;
|
||||
public readonly uint TimeScale;
|
||||
|
||||
public Mvhd(FileStream fs, ulong maximumLength)
|
||||
public Mvhd(FileStream fs)
|
||||
{
|
||||
buffer = new byte[20];
|
||||
int bytesRead = fs.Read(buffer, 0, buffer.Length);
|
||||
if (bytesRead < buffer.Length)
|
||||
Buffer = new byte[20];
|
||||
int bytesRead = fs.Read(Buffer, 0, Buffer.Length);
|
||||
if (bytesRead < Buffer.Length)
|
||||
return;
|
||||
|
||||
CreationTime = GetUInt(4);
|
||||
|
@ -17,17 +17,17 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
public Stbl(FileStream fs, ulong maximumLength, UInt32 timeScale, string handlerType, Mdia mdia)
|
||||
{
|
||||
_mdia = mdia;
|
||||
pos = (ulong)fs.Position;
|
||||
Position = (ulong)fs.Position;
|
||||
while (fs.Position < (long)maximumLength)
|
||||
{
|
||||
if (!InitializeSizeAndName(fs))
|
||||
return;
|
||||
|
||||
if (name == "stco") // 32-bit
|
||||
if (Name == "stco") // 32-bit
|
||||
{
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
int version = buffer[0];
|
||||
Buffer = new byte[Size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
int version = Buffer[0];
|
||||
uint totalEntries = GetUInt(4);
|
||||
|
||||
uint lastOffset = 0;
|
||||
@ -39,11 +39,11 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
lastOffset = offset;
|
||||
}
|
||||
}
|
||||
else if (name == "co64") // 64-bit
|
||||
else if (Name == "co64") // 64-bit
|
||||
{
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
int version = buffer[0];
|
||||
Buffer = new byte[Size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
int version = Buffer[0];
|
||||
uint totalEntries = GetUInt(4);
|
||||
|
||||
ulong lastOffset = 0;
|
||||
@ -55,28 +55,28 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
lastOffset = offset;
|
||||
}
|
||||
}
|
||||
else if (name == "stsz") // sample sizes
|
||||
else if (Name == "stsz") // sample sizes
|
||||
{
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
int version = buffer[0];
|
||||
Buffer = new byte[Size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
int version = Buffer[0];
|
||||
uint uniformSizeOfEachSample = GetUInt(4);
|
||||
uint numberOfSampleSizes = GetUInt(8);
|
||||
for (int i = 0; i < numberOfSampleSizes; i++)
|
||||
{
|
||||
if (12 + i * 4 + 4 < buffer.Length)
|
||||
if (12 + i * 4 + 4 < Buffer.Length)
|
||||
{
|
||||
uint sampleSize = GetUInt(12 + i * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name == "stts") // sample table time to sample map
|
||||
else if (Name == "stts") // sample table time to sample map
|
||||
{
|
||||
//https://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW1
|
||||
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
int version = buffer[0];
|
||||
Buffer = new byte[Size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
int version = Buffer[0];
|
||||
uint numberOfSampleTimes = GetUInt(4);
|
||||
double totalTime = 0;
|
||||
if (_mdia.IsClosedCaption)
|
||||
@ -87,7 +87,7 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
uint sampleDelta = GetUInt(12 + i * 8);
|
||||
for (int j = 0; j < sampleCount; j++)
|
||||
{
|
||||
totalTime += (double)(sampleDelta / (double)timeScale);
|
||||
totalTime += sampleDelta / (double)timeScale;
|
||||
if (StartTimeCodes.Count > 0)
|
||||
EndTimeCodes[EndTimeCodes.Count - 1] = totalTime - 0.001;
|
||||
StartTimeCodes.Add(totalTime);
|
||||
@ -102,7 +102,7 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
uint sampleCount = GetUInt(8 + i * 8);
|
||||
uint sampleDelta = GetUInt(12 + i * 8);
|
||||
totalTime += (double)(sampleDelta / (double)timeScale);
|
||||
totalTime += sampleDelta / (double)timeScale;
|
||||
if (StartTimeCodes.Count <= EndTimeCodes.Count)
|
||||
StartTimeCodes.Add(totalTime);
|
||||
else
|
||||
@ -110,15 +110,15 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name == "stsc") // sample table sample to chunk map
|
||||
else if (Name == "stsc") // sample table sample to chunk map
|
||||
{
|
||||
buffer = new byte[size - 4];
|
||||
fs.Read(buffer, 0, buffer.Length);
|
||||
int version = buffer[0];
|
||||
Buffer = new byte[Size - 4];
|
||||
fs.Read(Buffer, 0, Buffer.Length);
|
||||
int version = Buffer[0];
|
||||
uint numberOfSampleTimes = GetUInt(4);
|
||||
for (int i = 0; i < numberOfSampleTimes; i++)
|
||||
{
|
||||
if (16 + i * 12 + 4 < buffer.Length)
|
||||
if (16 + i * 12 + 4 < Buffer.Length)
|
||||
{
|
||||
uint firstChunk = GetUInt(8 + i * 12);
|
||||
uint samplesPerChunk = GetUInt(12 + i * 12);
|
||||
@ -127,14 +127,14 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
}
|
||||
}
|
||||
|
||||
fs.Seek((long)pos, SeekOrigin.Begin);
|
||||
fs.Seek((long)Position, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadText(FileStream fs, ulong offset, string handlerType)
|
||||
{
|
||||
fs.Seek((long)offset, SeekOrigin.Begin);
|
||||
byte[] data = new byte[4];
|
||||
var data = new byte[4];
|
||||
fs.Read(data, 0, 2);
|
||||
uint textSize = (uint)GetWord(data, 0);
|
||||
|
||||
@ -175,7 +175,7 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
}
|
||||
string hex = sb.ToString();
|
||||
int errorCount = 0;
|
||||
text = Nikse.SubtitleEdit.Logic.SubtitleFormats.ScenaristClosedCaptions.GetSccText(hex, ref errorCount);
|
||||
text = SubtitleFormats.ScenaristClosedCaptions.GetSccText(hex, ref errorCount);
|
||||
if (text.StartsWith("n") && text.Length > 1)
|
||||
text = "<i>" + text.Substring(1) + "</i>";
|
||||
if (text.StartsWith("-n"))
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
{
|
||||
@ -12,14 +9,14 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
public readonly uint Width;
|
||||
public readonly uint Height;
|
||||
|
||||
public Tkhd(FileStream fs, ulong maximumLength)
|
||||
public Tkhd(FileStream fs)
|
||||
{
|
||||
buffer = new byte[84];
|
||||
int bytesRead = fs.Read(buffer, 0, buffer.Length);
|
||||
if (bytesRead < buffer.Length)
|
||||
Buffer = new byte[84];
|
||||
int bytesRead = fs.Read(Buffer, 0, Buffer.Length);
|
||||
if (bytesRead < Buffer.Length)
|
||||
return;
|
||||
|
||||
int version = buffer[0];
|
||||
int version = Buffer[0];
|
||||
int addToIndex64Bit = 0;
|
||||
if (version == 1)
|
||||
addToIndex64Bit = 8;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
{
|
||||
@ -11,19 +10,20 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
|
||||
|
||||
public Trak(FileStream fs, ulong maximumLength)
|
||||
{
|
||||
pos = (ulong)fs.Position;
|
||||
Position = (ulong)fs.Position;
|
||||
while (fs.Position < (long)maximumLength)
|
||||
{
|
||||
if (!InitializeSizeAndName(fs))
|
||||
return;
|
||||
|
||||
if (name == "mdia")
|
||||
Mdia = new Mdia(fs, pos);
|
||||
else if (name == "tkhd")
|
||||
Tkhd = new Tkhd(fs, pos);
|
||||
if (Name == "mdia")
|
||||
Mdia = new Mdia(fs, Position);
|
||||
else if (Name == "tkhd")
|
||||
Tkhd = new Tkhd(fs);
|
||||
|
||||
fs.Seek((long)pos, SeekOrigin.Begin);
|
||||
fs.Seek((long)Position, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -104,25 +104,25 @@ namespace Nikse.SubtitleEdit.Logic.Mp4
|
||||
private void ParseMp4(FileStream fs)
|
||||
{
|
||||
int count = 0;
|
||||
pos = 0;
|
||||
Position = 0;
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
bool moreBytes = true;
|
||||
while (moreBytes)
|
||||
{
|
||||
moreBytes = InitializeSizeAndName(fs);
|
||||
if (size < 8)
|
||||
if (Size < 8)
|
||||
return;
|
||||
|
||||
if (name == "moov")
|
||||
Moov = new Moov(fs, pos);
|
||||
if (Name == "moov")
|
||||
Moov = new Moov(fs, Position);
|
||||
|
||||
count++;
|
||||
if (count > 100)
|
||||
break;
|
||||
|
||||
if (pos > (ulong)fs.Length)
|
||||
if (Position > (ulong)fs.Length)
|
||||
break;
|
||||
fs.Seek((long)pos, SeekOrigin.Begin);
|
||||
fs.Seek((long)Position, SeekOrigin.Begin);
|
||||
}
|
||||
fs.Close();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
{
|
||||
if (Utilities.IsRunningOnLinux())
|
||||
return new LinuxHunspell(dictionary + ".aff", dictionary + ".dic");
|
||||
else if (Utilities.IsRunningOnMac())
|
||||
if (Utilities.IsRunningOnMac())
|
||||
return new MacHunspell(dictionary + ".aff", dictionary + ".dic");
|
||||
|
||||
// Finnish is uses Voikko (not available via hunspell)
|
||||
|
@ -39,10 +39,10 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
private delegate IntPtr VoikkoFreeCstrArray(IntPtr array);
|
||||
VoikkoFreeCstrArray _voikkoFreeCstrArray;
|
||||
|
||||
private IntPtr _libDLL = IntPtr.Zero;
|
||||
private IntPtr _libVoikko = IntPtr.Zero;
|
||||
private IntPtr _libDll = IntPtr.Zero;
|
||||
private readonly IntPtr _libVoikko = IntPtr.Zero;
|
||||
|
||||
private static string n2s(IntPtr ptr)
|
||||
private static string N2S(IntPtr ptr)
|
||||
{
|
||||
if (ptr == IntPtr.Zero)
|
||||
return null;
|
||||
@ -52,27 +52,27 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
for (byte* p = (byte*)ptr; *p != 0; p++)
|
||||
bytes.Add(*p);
|
||||
}
|
||||
return n2s(bytes.ToArray());
|
||||
return N2S(bytes.ToArray());
|
||||
}
|
||||
|
||||
private static string n2s(byte[] bytes)
|
||||
private static string N2S(byte[] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
return null;
|
||||
return Encoding.UTF8.GetString(bytes);
|
||||
}
|
||||
|
||||
private static byte[] s2n(string str)
|
||||
private static byte[] S2N(string str)
|
||||
{
|
||||
return s2encoding(str, Encoding.UTF8);
|
||||
return S2Encoding(str, Encoding.UTF8);
|
||||
}
|
||||
|
||||
private static byte[] s2ansi(string str)
|
||||
private static byte[] S2Ansi(string str)
|
||||
{
|
||||
return s2encoding(str, Encoding.Default);
|
||||
return S2Encoding(str, Encoding.Default);
|
||||
}
|
||||
|
||||
private static byte[] s2encoding(string str, Encoding encoding)
|
||||
private static byte[] S2Encoding(string str, Encoding encoding)
|
||||
{
|
||||
if (str == null)
|
||||
return null;
|
||||
@ -81,7 +81,7 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
|
||||
private object GetDllType(Type type, string name)
|
||||
{
|
||||
IntPtr address = GetProcAddress(_libDLL, name);
|
||||
IntPtr address = GetProcAddress(_libDll, name);
|
||||
if (address != IntPtr.Zero)
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer(address, type);
|
||||
@ -92,16 +92,16 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
/// <summary>
|
||||
/// Load dll dynamic + set pointers to needed methods
|
||||
/// </summary>
|
||||
/// <param name="dllFile">Voikko lib</param>
|
||||
/// <param name="baseFolder"></param>
|
||||
private void LoadLibVoikkoDynamic(string baseFolder)
|
||||
{
|
||||
string dllFile = System.IO.Path.Combine(baseFolder, "Voikkox86.dll");
|
||||
string dllFile = Path.Combine(baseFolder, "Voikkox86.dll");
|
||||
if (IntPtr.Size == 8)
|
||||
dllFile = System.IO.Path.Combine(baseFolder, "Voikkox64.dll");
|
||||
dllFile = Path.Combine(baseFolder, "Voikkox64.dll");
|
||||
if (!File.Exists(dllFile))
|
||||
throw new FileNotFoundException(dllFile);
|
||||
_libDLL = LoadLibrary(dllFile);
|
||||
if (_libDLL == IntPtr.Zero)
|
||||
_libDll = LoadLibrary(dllFile);
|
||||
if (_libDll == IntPtr.Zero)
|
||||
throw new FileLoadException("Unable to load " + dllFile);
|
||||
|
||||
_voikkoInit = (VoikkoInit)GetDllType(typeof(VoikkoInit), "voikkoInit");
|
||||
@ -119,7 +119,7 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
if (string.IsNullOrEmpty(word))
|
||||
return false;
|
||||
|
||||
return Convert.ToBoolean(_voikkoSpell(_libVoikko, s2n(word)));
|
||||
return Convert.ToBoolean(_voikkoSpell(_libVoikko, S2N(word)));
|
||||
}
|
||||
|
||||
public override List<string> Suggest(string word)
|
||||
@ -127,13 +127,13 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
var suggestions = new List<string>();
|
||||
if (string.IsNullOrEmpty(word))
|
||||
return suggestions;
|
||||
IntPtr voikkoSuggestCstr = _voikkoSuggest(_libVoikko, s2n(word));
|
||||
IntPtr voikkoSuggestCstr = _voikkoSuggest(_libVoikko, S2N(word));
|
||||
if (voikkoSuggestCstr == IntPtr.Zero)
|
||||
return suggestions;
|
||||
unsafe
|
||||
{
|
||||
for (byte** cStr = (byte**)voikkoSuggestCstr; *cStr != (byte*)0; cStr++)
|
||||
suggestions.Add(n2s(new IntPtr(*cStr)));
|
||||
suggestions.Add(N2S(new IntPtr(*cStr)));
|
||||
}
|
||||
_voikkoFreeCstrArray(voikkoSuggestCstr);
|
||||
return suggestions;
|
||||
@ -143,10 +143,10 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
{
|
||||
LoadLibVoikkoDynamic(baseFolder);
|
||||
|
||||
IntPtr error = new IntPtr();
|
||||
_libVoikko = _voikkoInit(ref error, s2n("fi"), s2ansi(dictionaryFolder));
|
||||
var error = new IntPtr();
|
||||
_libVoikko = _voikkoInit(ref error, S2N("fi"), S2Ansi(dictionaryFolder));
|
||||
if (_libVoikko == IntPtr.Zero && error != IntPtr.Zero)
|
||||
throw new Exception(n2s(error));
|
||||
throw new Exception(N2S(error));
|
||||
}
|
||||
|
||||
~VoikkoSpellCheck()
|
||||
@ -156,8 +156,8 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
if (_libVoikko != IntPtr.Zero)
|
||||
_voikkoTerminate(_libVoikko);
|
||||
|
||||
if (_libDLL != IntPtr.Zero)
|
||||
FreeLibrary(_libDLL);
|
||||
if (_libDll != IntPtr.Zero)
|
||||
FreeLibrary(_libDll);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ namespace Nikse.SubtitleEdit.Logic.SpellCheck
|
||||
{
|
||||
public class WindowsHunspell: Hunspell
|
||||
{
|
||||
private NHunspell.Hunspell _hunspell;
|
||||
private readonly NHunspell.Hunspell _hunspell;
|
||||
|
||||
public WindowsHunspell (string affDictionary, string dicDictionary)
|
||||
{
|
||||
|
@ -850,7 +850,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
|
||||
s = RemoveTag(s, "t(");
|
||||
s = RemoveTag(s, "move(");
|
||||
s = RemoveTag(s, "pos(");
|
||||
s = RemoveTag(s, "Position(");
|
||||
s = RemoveTag(s, "org(");
|
||||
s = RemoveTag(s, "fade(");
|
||||
s = RemoveTag(s, "fad(");
|
||||
|
@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0xC0, // vertical pos: C0=bottom, 0=top
|
||||
0xC0, // vertical Position: C0=bottom, 0=top
|
||||
2, //justification, 1=left, 2=center
|
||||
0,
|
||||
1, //1=normal font, 3=italic
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Nikse.SubtitleEdit.Controls;
|
||||
using Nikse.SubtitleEdit.Forms;
|
||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VideoFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VideoPlayers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,6 @@ namespace Test
|
||||
private Nikse.SubtitleEdit.Logic.Forms.RemoveTextForHI GetRemoveTextForHiLib()
|
||||
{
|
||||
var hiSettings = new Nikse.SubtitleEdit.Logic.Forms.RemoveTextForHISettings();
|
||||
hiSettings.LoadFromConfiguration();
|
||||
return new Nikse.SubtitleEdit.Logic.Forms.RemoveTextForHI(hiSettings);
|
||||
}
|
||||
|
||||
@ -76,12 +75,12 @@ namespace Test
|
||||
public void RemoveColonTest()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
string text = "Man over P.A.:\r\nGive back our homes.";
|
||||
string expected = "Give back our homes.";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
@ -94,12 +93,12 @@ namespace Test
|
||||
public void RemoveColonTest2a()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
string text = "GIOVANNI: <i>Number 9: I never look for a scapegoat.</i>";
|
||||
string expected = "<i>I never look for a scapegoat.</i>";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
@ -112,12 +111,12 @@ namespace Test
|
||||
public void RemoveColonTest2b()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = true;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = true;
|
||||
string text = "GIOVANNI: <i>Number 9: I never look for a scapegoat.</i>";
|
||||
string expected = "<i>Number 9: I never look for a scapegoat.</i>";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
@ -134,12 +133,12 @@ namespace Test
|
||||
public void RemoveHIInsideLine()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBetweenParentheses = true;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBetweenParentheses = true;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "Be quiet. (SHUSHING) It's okay.";
|
||||
string expected = "Be quiet. It's okay.";
|
||||
string actual = target.RemoveHearImpairedtagsInsideLine(text);
|
||||
@ -154,11 +153,11 @@ namespace Test
|
||||
public void RemoveHI1()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBetweenSquares = true;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBetweenSquares = true;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- Aw, save it. Storm?\r\n- [Storm]\r\nWe're outta here.";
|
||||
string expected = "- Aw, save it. Storm?\r\n- We're outta here.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
@ -173,11 +172,11 @@ namespace Test
|
||||
public void RemoveHI2()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBetweenSquares = true;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBetweenSquares = true;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "[Chuckles,\r\nCoughing]\r\nBut we lived through it.";
|
||||
string expected = "But we lived through it.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
@ -192,10 +191,10 @@ namespace Test
|
||||
public void RemoveHINot()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "is the body of a mutant kid\r\non the 6:00 news.";
|
||||
string expected = "is the body of a mutant kid\r\non the 6:00 news.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
@ -211,11 +210,11 @@ namespace Test
|
||||
public void RemoveHIMultilineItalic()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "<i>NARRATOR:" + Environment.NewLine +
|
||||
"Previously on NCIS</i>";
|
||||
string expected = "<i>Previously on NCIS</i>";
|
||||
@ -231,11 +230,11 @@ namespace Test
|
||||
public void RemoveHIMultilineBold()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "<b>NARRATOR:" + Environment.NewLine +
|
||||
"Previously on NCIS</b>";
|
||||
string expected = "<b>Previously on NCIS</b>";
|
||||
@ -251,11 +250,11 @@ namespace Test
|
||||
public void RemoveHISecondLineDelay()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- JOHN: Hey." + Environment.NewLine +
|
||||
"- ...hey.";
|
||||
string expected = "- Hey."+ Environment.NewLine +"- ...hey.";
|
||||
@ -268,10 +267,10 @@ namespace Test
|
||||
public void RemoveHIQuotes()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- Where?!" + Environment.NewLine + "- Ow!";
|
||||
string expected = "Where?!";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -283,11 +282,11 @@ namespace Test
|
||||
public void RemoveHIDouble()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBetweenSquares = true;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBetweenSquares = true;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "[MAN]Where?![MAN]";
|
||||
string expected = "Where?!";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
@ -299,12 +298,12 @@ namespace Test
|
||||
public void RemoveRemoveNameOfFirstLine()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "HECTOR: Hi." + Environment.NewLine + "-Oh, hey, Hector.";
|
||||
string expected = "- Hi." + Environment.NewLine + "- Oh, hey, Hector.";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
@ -316,12 +315,12 @@ namespace Test
|
||||
public void RemoveRemoveNameOfFirstLineBold()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "<b>HECTOR: Hi.</b>";
|
||||
string expected = "<b>Hi.</b>";
|
||||
string actual = target.RemoveTextFromHearImpaired(text, string.Empty);
|
||||
@ -333,11 +332,11 @@ namespace Test
|
||||
public void RemoveInterjections()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "-Ballpark." + Environment.NewLine + "-Hmm.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -349,11 +348,11 @@ namespace Test
|
||||
public void RemoveInterjections2()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "-Ballpark." + Environment.NewLine + "-Mm-hm.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -365,11 +364,11 @@ namespace Test
|
||||
public void RemoveInterjections3()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "-Mm-hm." + Environment.NewLine + "-Ballpark.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -381,11 +380,11 @@ namespace Test
|
||||
public void RemoveInterjections4()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- Mm-hm." + Environment.NewLine + "- Ballpark.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -397,11 +396,11 @@ namespace Test
|
||||
public void RemoveInterjections5()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- Ballpark." + Environment.NewLine + "- Hmm.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -413,11 +412,11 @@ namespace Test
|
||||
public void RemoveInterjections6a()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "Ballpark, mm-hm.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -429,11 +428,11 @@ namespace Test
|
||||
public void RemoveInterjections6b()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "Mm-hm, Ballpark.";
|
||||
string expected = "Ballpark.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -445,11 +444,11 @@ namespace Test
|
||||
public void RemoveInterjections6bItalic()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "<i>Mm-hm, Ballpark.</i>";
|
||||
string expected = "<i>Ballpark.</i>";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -461,11 +460,11 @@ namespace Test
|
||||
public void RemoveInterjections7()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "You like her, huh?";
|
||||
string expected = "You like her?";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -477,11 +476,11 @@ namespace Test
|
||||
public void RemoveInterjections8()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "You like her, huh!";
|
||||
string expected = "You like her!";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -493,11 +492,11 @@ namespace Test
|
||||
public void RemoveInterjections9()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "You like her, huh.";
|
||||
string expected = "You like her.";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -509,11 +508,11 @@ namespace Test
|
||||
public void RemoveInterjections10()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- You like her, huh." + Environment.NewLine + "- I do";
|
||||
string expected = "- You like her." + Environment.NewLine + "- I do";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -525,11 +524,11 @@ namespace Test
|
||||
public void RemoveInterjections10Italic()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "<i>- You like her, huh." + Environment.NewLine + "- I do</i>";
|
||||
string expected = "<i>- You like her." + Environment.NewLine + "- I do</i>";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -542,11 +541,11 @@ namespace Test
|
||||
public void RemoveInterjections11()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- Ballpark, mm-hm." + Environment.NewLine + "- Oh yes!";
|
||||
string expected = "- Ballpark." + Environment.NewLine + "- Yes!";
|
||||
string actual = target.RemoveInterjections(text);
|
||||
@ -558,12 +557,12 @@ namespace Test
|
||||
public void RemoveColonOnlyOnSeparateLine()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = true;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = true;
|
||||
string text = "HECTOR: Hi.";
|
||||
string expected = "HECTOR: Hi.";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
@ -575,12 +574,12 @@ namespace Test
|
||||
public void RemoveLineIfAllUppercase1()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = true;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = true;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "HECTOR " + Environment.NewLine + "Hi.";
|
||||
string expected = "Hi.";
|
||||
string actual = target.RemoveLineIfAllUppercase(text);
|
||||
@ -592,12 +591,12 @@ namespace Test
|
||||
public void RemoveLineIfAllUppercase2()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = true;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = true;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "Please, Mr Krook." + Environment.NewLine + "SHOP DOOR BELL CLANGS";
|
||||
string expected = "Please, Mr Krook.";
|
||||
string actual = target.RemoveLineIfAllUppercase(text);
|
||||
@ -609,13 +608,13 @@ namespace Test
|
||||
public void RemoveLineIfAllUppercase3()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = true;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.settings.RemoveTextBetweenParentheses = true;
|
||||
target.Settings.RemoveIfAllUppercase = true;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveTextBetweenParentheses = true;
|
||||
string text = "(<i>GOIN' BACK TO INDIANA</i>" + Environment.NewLine + "CONTINUES PLAYING)";
|
||||
string expected = "";
|
||||
string actual = target.RemoveLineIfAllUppercase(text);
|
||||
@ -627,13 +626,13 @@ namespace Test
|
||||
public void RemoveLineIfParentheses3()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = false;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.settings.RemoveTextBetweenParentheses = true;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveTextBetweenParentheses = true;
|
||||
string text = "(<i>GOIN' BACK TO INDIANA</i>" + Environment.NewLine + "CONTINUES PLAYING)";
|
||||
string expected = "";
|
||||
string actual = target.RemoveHearImpairedTags(text);
|
||||
@ -646,12 +645,12 @@ namespace Test
|
||||
public void RemoveTextBeforeColonSecondLine()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.settings.RemoveIfAllUppercase = false;
|
||||
target.settings.RemoveInterjections = false;
|
||||
target.settings.RemoveTextBeforeColon = true;
|
||||
target.settings.OnlyIfInSeparateLine = false;
|
||||
target.settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.settings.ColonSeparateLine = false;
|
||||
target.Settings.RemoveIfAllUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.ColonSeparateLine = false;
|
||||
string text = "- even if it was one week." + Environment.NewLine + "CANNING: Objection.";
|
||||
string expected = "- even if it was one week." + Environment.NewLine + "- Objection.";
|
||||
string actual = target.RemoveColon(text, string.Empty);
|
||||
|
Loading…
Reference in New Issue
Block a user