Move Html methods to HtmlUtil

This commit is contained in:
ivandrofly 2015-01-29 20:18:32 +00:00
parent 798ae0a9d9
commit d85b5927e9
137 changed files with 279 additions and 274 deletions

View File

@ -768,7 +768,7 @@ namespace Nikse.SubtitleEdit.Controls
{
using (var blackBrush = new SolidBrush(Color.Black))
{
var text = Utilities.RemoveHtmlTags(paragraph.Text, true);
var text = HtmlUtil.RemoveHtmlTags(paragraph.Text, true);
text = text.Replace(Environment.NewLine, " ");
int w = currentRegionRight - currentRegionLeft;

View File

@ -564,7 +564,7 @@ namespace Nikse.SubtitleEdit.Controls
if (_settings.Tools.ListViewSyntaxColorLongLines)
{
int noOfLines = paragraph.Text.Split(Environment.NewLine[0]).Length;
string s = Utilities.RemoveHtmlTags(paragraph.Text, true);
string s = HtmlUtil.RemoveHtmlTags(paragraph.Text, true);
foreach (string line in s.SplitToLines())
{
if (line.Length > Configuration.Settings.General.SubtitleLineMaximumLength)

View File

@ -2,6 +2,7 @@
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Nikse.SubtitleEdit.Logic;
namespace Nikse.SubtitleEdit.Core
{
@ -352,5 +353,32 @@ namespace Nikse.SubtitleEdit.Core
}
return encoded.ToString();
}
public static string RemoveHtmlTags(string s)
{
if (s == null)
return null;
if (s.Length < 3 || s.IndexOf('<') < 0)
return s;
if (s.IndexOf("< ", StringComparison.Ordinal) >= 0)
s = Utilities.FixInvalidItalicTags(s);
return HtmlUtil.RemoveOpenCloseTags(s, HtmlUtil.TagItalic, HtmlUtil.TagBold, HtmlUtil.TagUnderline, HtmlUtil.TagParagraph, HtmlUtil.TagFont, HtmlUtil.TagCyrillicI);
}
public static string RemoveHtmlTags(string s, bool alsoSsaTags)
{
if (s == null)
return null;
s = RemoveHtmlTags(s);
if (alsoSsaTags)
s = Utilities.RemoveSsaTags(s);
return s;
}
}
}

View File

@ -781,7 +781,7 @@ namespace Nikse.SubtitleEdit.Forms
}
if (checkBoxRemoveFormatting.Checked)
{
p.Text = Utilities.RemoveHtmlTags(p.Text);
p.Text = HtmlUtil.RemoveHtmlTags(p.Text);
if (p.Text.StartsWith('{') && p.Text.Length > 6 && p.Text[5] == '}')
p.Text = p.Text.Remove(0, 6);
if (p.Text.StartsWith('{') && p.Text.Length > 6 && p.Text[4] == '}')

View File

@ -207,7 +207,7 @@ namespace Nikse.SubtitleEdit.Forms
SizeF textSize = g.MeasureString("Hj!", font);
var lineHeight = (textSize.Height * 0.64f);
textSize = g.MeasureString(Utilities.RemoveHtmlTags(text), font);
textSize = g.MeasureString(HtmlUtil.RemoveHtmlTags(text), font);
g.Dispose();
bmp.Dispose();
int sizeX = (int)(textSize.Width * 0.8) + 40;

View File

@ -90,7 +90,7 @@ namespace Nikse.SubtitleEdit.Forms
{
string name = item.SubItems[1].Text;
string textNoTags = Utilities.RemoveHtmlTags(text);
string textNoTags = HtmlUtil.RemoveHtmlTags(text);
if (textNoTags != textNoTags.ToUpper())
{
if (item.Checked && text != null && text.Contains(name, StringComparison.OrdinalIgnoreCase) && name.Length > 1 && name != name.ToLower())
@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Forms
var sb = new StringBuilder();
foreach (Paragraph p in _subtitle.Paragraphs)
sb.AppendLine(p.Text);
string text = Utilities.RemoveHtmlTags(sb.ToString());
string text = HtmlUtil.RemoveHtmlTags(sb.ToString());
string textToLower = text.ToLower();
foreach (string name in namesEtcList)
{

View File

@ -100,7 +100,7 @@ namespace Nikse.SubtitleEdit.Forms
var arr = p.Text.SplitToLines();
foreach (string line in arr)
{
string s = Utilities.RemoveHtmlTags(line);
string s = HtmlUtil.RemoveHtmlTags(line);
if (s.Length > numericUpDownMaxCharacters.Value)
{
sb.AppendLine(string.Format(Configuration.Settings.Language.EbuSaveOptions.MaxLengthError, i, numericUpDownMaxCharacters.Value, s.Length - numericUpDownMaxCharacters.Value, s));

View File

@ -212,7 +212,7 @@ namespace Nikse.SubtitleEdit.Forms
private static double CalculateStepLength(string text, double duration)
{
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
return duration / text.Length;
}

View File

@ -76,7 +76,7 @@ namespace Nikse.SubtitleEdit.Forms
private static double CalculateStepLength(string text, double duration)
{
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
return duration / text.Length;
}

View File

@ -1513,7 +1513,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
private static int CalcWidthViaDraw(string text, MakeBitmapParameter parameter)
{
//text = Utilities.RemoveHtmlTags(text, true).Trim();
//text = HtmlUtil.RemoveHtmlTags(text, true).Trim();
text = text.Trim();
var path = new GraphicsPath();
var sb = new StringBuilder();
@ -1876,7 +1876,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
using (var bmpTemp = new Bitmap(1, 1))
using (var g = Graphics.FromImage(bmpTemp))
{
textSize = g.MeasureString(Utilities.RemoveHtmlTags(text), font);
textSize = g.MeasureString(HtmlUtil.RemoveHtmlTags(text), font);
}
int sizeX = (int)(textSize.Width * 1.8) + 150;
int sizeY = (int)(textSize.Height * 0.9) + 50;
@ -1967,7 +1967,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
parameter.SubtitleColor = Utilities.GetColorFromFontString(text, parameter.SubtitleColor);
}
text = Utilities.RemoveHtmlTags(text, true); //TODO: Perhaps check single color...
text = HtmlUtil.RemoveHtmlTags(text, true); //TODO: Perhaps check single color...
var brush = new SolidBrush(parameter.BorderColor);
int x = 3;
const int y = 3;
@ -3406,7 +3406,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
int indexOfEndBracket = p.Text.IndexOf('}');
if (p.Text.StartsWith("{\\") && indexOfEndBracket > 1 && indexOfEndBracket < 6)
p.Text = p.Text.Remove(0, indexOfEndBracket + 1);
p.Text = Utilities.RemoveHtmlTags(p.Text);
p.Text = HtmlUtil.RemoveHtmlTags(p.Text);
p.Text = p.Text.Replace("<" + BoxSingleLine + ">", string.Empty).Replace("</" + BoxSingleLine + ">", string.Empty);
p.Text = p.Text.Replace("<" + BoxMultiLine + ">", string.Empty).Replace("</" + BoxMultiLine + ">", string.Empty);

View File

@ -113,7 +113,7 @@ namespace Nikse.SubtitleEdit.Forms
string s = p.Text;
if (removeStyling)
{
s = Utilities.RemoveHtmlTags(s, true);
s = HtmlUtil.RemoveHtmlTags(s, true);
}
if (formatUnbreak)

View File

@ -798,11 +798,11 @@ namespace Nikse.SubtitleEdit.Forms
prev.Text = prev.Text.Replace(Environment.NewLine, " ");
p.Text = p.Text.Replace(Environment.NewLine, " ");
string stripped = Utilities.RemoveHtmlTags(prev.Text).TrimStart();
string stripped = HtmlUtil.RemoveHtmlTags(prev.Text).TrimStart();
if (!stripped.StartsWith("- ", StringComparison.Ordinal))
prev.Text = "- " + prev.Text.TrimStart();
stripped = Utilities.RemoveHtmlTags(p.Text).TrimStart();
stripped = HtmlUtil.RemoveHtmlTags(p.Text).TrimStart();
if (!stripped.StartsWith("- ", StringComparison.Ordinal))
p.Text = "- " + p.Text.TrimStart();
@ -1076,7 +1076,7 @@ namespace Nikse.SubtitleEdit.Forms
bool tooLong = false;
foreach (string line in lines)
{
if (Utilities.RemoveHtmlTags(line).Length > Configuration.Settings.General.SubtitleLineMaximumLength)
if (HtmlUtil.RemoveHtmlTags(line).Length > Configuration.Settings.General.SubtitleLineMaximumLength)
{
tooLong = true;
}
@ -1132,7 +1132,7 @@ namespace Nikse.SubtitleEdit.Forms
{
Paragraph p = Subtitle.Paragraphs[i];
string s = Utilities.RemoveHtmlTags(p.Text);
string s = HtmlUtil.RemoveHtmlTags(p.Text);
if (s.Replace(Environment.NewLine, " ").Replace(" ", " ").Length < Configuration.Settings.Tools.MergeLinesShorterThan && p.Text.Contains(Environment.NewLine))
{
s = Utilities.AutoBreakLine(p.Text, Language);
@ -1605,7 +1605,7 @@ namespace Nikse.SubtitleEdit.Forms
}
string oldText = p.Text;
var lines = Utilities.RemoveHtmlTags(p.Text).SplitToLines();
var lines = HtmlUtil.RemoveHtmlTags(p.Text).SplitToLines();
if (lines.Length == 2 && lines[0].TrimStart().StartsWith('-') && lines[1].TrimStart().StartsWith('-'))
{ // dialog
lines = p.Text.SplitToLines();
@ -1913,8 +1913,8 @@ namespace Nikse.SubtitleEdit.Forms
Paragraph next = Subtitle.GetParagraphOrDefault(i + 1);
string nextText = string.Empty;
if (next != null)
nextText = Utilities.RemoveHtmlTags(next.Text).TrimStart('-', '"', '„').TrimStart();
string tempNoHtml = Utilities.RemoveHtmlTags(p.Text).TrimEnd();
nextText = HtmlUtil.RemoveHtmlTags(next.Text).TrimStart('-', '"', '„').TrimStart();
string tempNoHtml = HtmlUtil.RemoveHtmlTags(p.Text).TrimEnd();
if (IsOneLineUrl(p.Text) || p.Text.Contains('♪') || p.Text.Contains('♫') || p.Text.EndsWith('\''))
{
@ -2176,7 +2176,7 @@ namespace Nikse.SubtitleEdit.Forms
string prevText = " .";
if (prev != null)
prevText = Utilities.RemoveHtmlTags(prev.Text);
prevText = HtmlUtil.RemoveHtmlTags(prev.Text);
bool isPrevEndOfLine = FixCommonErrorsHelper.IsPrevoiusTextEndOfParagraph(prevText);
if (prevText == " .")
@ -2254,7 +2254,7 @@ namespace Nikse.SubtitleEdit.Forms
}
char firstLetter = text[0];
string prevText = Utilities.RemoveHtmlTags(arr[0]);
string prevText = HtmlUtil.RemoveHtmlTags(arr[0]);
bool isPrevEndOfLine = FixCommonErrorsHelper.IsPrevoiusTextEndOfParagraph(prevText);
if ((!text.StartsWith("www.", StringComparison.Ordinal) && !text.StartsWith("http:", StringComparison.Ordinal) && !text.StartsWith("https:", StringComparison.Ordinal)) &&
(char.IsLower(firstLetter) || IsTurkishLittleI(firstLetter, encoding, language)) &&
@ -2298,7 +2298,7 @@ namespace Nikse.SubtitleEdit.Forms
prevText = " .";
if (prev != null && p.StartTime.TotalMilliseconds - 10000 < prev.EndTime.TotalMilliseconds)
prevText = Utilities.RemoveHtmlTags(prev.Text);
prevText = HtmlUtil.RemoveHtmlTags(prev.Text);
bool isPrevLineEndOfLine = FixCommonErrorsHelper.IsPrevoiusTextEndOfParagraph(prevText);
if (isPrevLineEndOfLine && arr[0].StartsWith("<i>- ", StringComparison.Ordinal) && arr[0].Length > 6)
{
@ -2484,7 +2484,7 @@ namespace Nikse.SubtitleEdit.Forms
if (last != null)
{
string lastText = Utilities.RemoveHtmlTags(last.Text);
string lastText = HtmlUtil.RemoveHtmlTags(last.Text);
if (lastText.EndsWith(':') || lastText.EndsWith(';'))
{
var st = new StripableText(p.Text);
@ -2882,8 +2882,8 @@ namespace Nikse.SubtitleEdit.Forms
newText = newText.Replace(musicSymbol, Configuration.Settings.Tools.MusicSymbol);
newText = newText.Replace(musicSymbol.ToUpper(), Configuration.Settings.Tools.MusicSymbol);
}
var noTagsText = Utilities.RemoveHtmlTags(newText);
if (newText != oldText && noTagsText != Utilities.RemoveHtmlTags(oldText))
var noTagsText = HtmlUtil.RemoveHtmlTags(newText);
if (newText != oldText && noTagsText != HtmlUtil.RemoveHtmlTags(oldText))
{
p.Text = newText;
fixCount++;
@ -3884,8 +3884,8 @@ namespace Nikse.SubtitleEdit.Forms
skip = true;
if (!skip && Utilities.CountTagInText(p.Text, mark) == Utilities.CountTagInText(p.Text, inverseMark) &&
Utilities.RemoveHtmlTags(p.Text).TrimStart(inverseMark[0]).Contains(inverseMark) == false &&
Utilities.RemoveHtmlTags(p.Text).TrimEnd(mark).Contains(mark) == false)
HtmlUtil.RemoveHtmlTags(p.Text).TrimStart(inverseMark[0]).Contains(inverseMark) == false &&
HtmlUtil.RemoveHtmlTags(p.Text).TrimEnd(mark).Contains(mark) == false)
{
skip = true;
}
@ -3954,11 +3954,11 @@ namespace Nikse.SubtitleEdit.Forms
}
var st = new StripableText(part);
if (j == 0 && mark == '!' && st.Pre == "¿" && Utilities.CountTagInText(p.Text, mark) == 1 && Utilities.RemoveHtmlTags(p.Text).EndsWith(mark))
if (j == 0 && mark == '!' && st.Pre == "¿" && Utilities.CountTagInText(p.Text, mark) == 1 && HtmlUtil.RemoveHtmlTags(p.Text).EndsWith(mark))
{
p.Text = inverseMark + p.Text;
}
else if (j == 0 && mark == '?' && st.Pre == "¡" && Utilities.CountTagInText(p.Text, mark) == 1 && Utilities.RemoveHtmlTags(p.Text).EndsWith(mark))
else if (j == 0 && mark == '?' && st.Pre == "¡" && Utilities.CountTagInText(p.Text, mark) == 1 && HtmlUtil.RemoveHtmlTags(p.Text).EndsWith(mark))
{
p.Text = inverseMark + p.Text;
}
@ -4663,7 +4663,7 @@ namespace Nikse.SubtitleEdit.Forms
labelSingleLine.Left = labelTextLineLengths.Left + labelTextLineLengths.Width - 6;
Utilities.GetLineLengths(labelSingleLine, text);
string s = Utilities.RemoveHtmlTags(text).Replace(Environment.NewLine, " ");
string s = HtmlUtil.RemoveHtmlTags(text).Replace(Environment.NewLine, " ");
buttonSplitLine.Visible = false;
if (s.Length < Configuration.Settings.General.SubtitleLineMaximumLength * 1.9)
{
@ -5022,7 +5022,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
double startFactor = (double)Utilities.RemoveHtmlTags(currentParagraph.Text).Length / Utilities.RemoveHtmlTags(oldText).Length;
double startFactor = (double)HtmlUtil.RemoveHtmlTags(currentParagraph.Text).Length / HtmlUtil.RemoveHtmlTags(oldText).Length;
if (startFactor < 0.20)
startFactor = 0.20;
if (startFactor > 0.80)

View File

@ -6479,7 +6479,7 @@ namespace Nikse.SubtitleEdit.Forms
Utilities.GetLineLengths(singleLine, text);
buttonSplitLine.Visible = false;
text = Utilities.RemoveHtmlTags(text, true);
text = HtmlUtil.RemoveHtmlTags(text, true);
string s = text.Replace(Environment.NewLine, string.Empty); // we don't count new line in total length... correct?
// remove unicode control characters
@ -6593,7 +6593,7 @@ namespace Nikse.SubtitleEdit.Forms
int indexOfEndBracket = p.Text.IndexOf('}');
if (p.Text.StartsWith("{\\") && indexOfEndBracket > 1 && indexOfEndBracket < 6)
p.Text = p.Text.Remove(0, indexOfEndBracket + 1).TrimStart();
p.Text = Utilities.RemoveHtmlTags(p.Text);
p.Text = HtmlUtil.RemoveHtmlTags(p.Text);
p.Text = RemoveUnicodeCharacters(p.Text);
if (isSsa)
p.Text = RemoveSsaStyle(p.Text);
@ -6604,7 +6604,7 @@ namespace Nikse.SubtitleEdit.Forms
Paragraph original = Utilities.GetOriginalParagraph(item.Index, p, _subtitleAlternate.Paragraphs);
if (original != null)
{
original.Text = Utilities.RemoveHtmlTags(original.Text);
original.Text = HtmlUtil.RemoveHtmlTags(original.Text);
original.Text = original.Text.Replace("♪", string.Empty);
if (isSsa)
original.Text = RemoveSsaStyle(original.Text);
@ -6947,7 +6947,7 @@ namespace Nikse.SubtitleEdit.Forms
idx = p.Text.LastIndexOf(Environment.NewLine, StringComparison.Ordinal);
// Check if the last line of the subtitle (the one that now contains the moved word) is longer than SubtitleLineMaximumLength.
if (Utilities.RemoveHtmlTags(p.Text.Substring((idx > 0 ? idx + Environment.NewLine.Length : 0))).Length > Configuration.Settings.General.SubtitleLineMaximumLength)
if (HtmlUtil.RemoveHtmlTags(p.Text.Substring((idx > 0 ? idx + Environment.NewLine.Length : 0))).Length > Configuration.Settings.General.SubtitleLineMaximumLength)
p.Text = Utilities.AutoBreakLine(p.Text);
}
@ -7057,7 +7057,7 @@ namespace Nikse.SubtitleEdit.Forms
idx = next.Text.IndexOf(Environment.NewLine, StringComparison.Ordinal);
// Check if the first line of the next subtitle (the one that now contains the moved word) is longer than SubtitleLineMaximumLength.
if (Utilities.RemoveHtmlTags(next.Text.Substring(0, (idx > 0 ? idx : next.Text.Length))).Length > Configuration.Settings.General.SubtitleLineMaximumLength)
if (HtmlUtil.RemoveHtmlTags(next.Text.Substring(0, (idx > 0 ? idx : next.Text.Length))).Length > Configuration.Settings.General.SubtitleLineMaximumLength)
next.Text = Utilities.AutoBreakLine(next.Text);
}
@ -7275,7 +7275,7 @@ namespace Nikse.SubtitleEdit.Forms
else
{
string s = currentParagraph.Text;
var arr = Utilities.RemoveHtmlTags(s, true).Replace(Environment.NewLine, "\n").Split('\n');
var arr = HtmlUtil.RemoveHtmlTags(s, true).Replace(Environment.NewLine, "\n").Split('\n');
if (arr.Length != 2 || arr[0].Length > Configuration.Settings.General.SubtitleLineMaximumLength || arr[1].Length > Configuration.Settings.General.SubtitleLineMaximumLength)
{
if (arr.Length == 2 && arr[0].StartsWith('-') && arr[1].StartsWith('-'))
@ -7354,9 +7354,9 @@ namespace Nikse.SubtitleEdit.Forms
newParagraph.Text = newParagraph.Text.Remove(3, 1);
double middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.Duration.TotalMilliseconds / 2);
if (!string.IsNullOrWhiteSpace(Utilities.RemoveHtmlTags(oldText)))
if (!string.IsNullOrWhiteSpace(HtmlUtil.RemoveHtmlTags(oldText)))
{
var startFactor = (double)Utilities.RemoveHtmlTags(currentParagraph.Text).Length / Utilities.RemoveHtmlTags(oldText).Length;
var startFactor = (double)HtmlUtil.RemoveHtmlTags(currentParagraph.Text).Length / HtmlUtil.RemoveHtmlTags(oldText).Length;
if (startFactor < 0.25)
startFactor = 0.25;
if (startFactor > 0.75)
@ -13623,7 +13623,7 @@ namespace Nikse.SubtitleEdit.Forms
selectedText = selectedText.Trim();
if (!string.IsNullOrEmpty(selectedText) && selectedText != textBoxSearchWord.Text)
{
textBoxSearchWord.Text = Utilities.RemoveHtmlTags(selectedText);
textBoxSearchWord.Text = HtmlUtil.RemoveHtmlTags(selectedText);
}
}
}
@ -15219,7 +15219,7 @@ namespace Nikse.SubtitleEdit.Forms
string text = tb.SelectedText;
int selectionStart = tb.SelectionStart;
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
tb.SelectedText = text;
tb.SelectionStart = selectionStart;
tb.SelectionLength = text.Length;
@ -17219,7 +17219,7 @@ namespace Nikse.SubtitleEdit.Forms
selectedText = selectedText.Trim();
if (!string.IsNullOrEmpty(selectedText) && selectedText != textBoxSearchWord.Text)
{
textBoxSearchWord.Text = Utilities.RemoveHtmlTags(selectedText);
textBoxSearchWord.Text = HtmlUtil.RemoveHtmlTags(selectedText);
}
}
}
@ -17444,7 +17444,7 @@ namespace Nikse.SubtitleEdit.Forms
int extraNewLineLength = Environment.NewLine.Length - 1;
int lineBreakPos = textBox.Text.IndexOf(Environment.NewLine, StringComparison.Ordinal);
int pos = textBox.SelectionStart;
var s = Utilities.RemoveHtmlTags(textBox.Text, true).Replace(Environment.NewLine, string.Empty); // we don't count new line in total length... correct?
var s = HtmlUtil.RemoveHtmlTags(textBox.Text, true).Replace(Environment.NewLine, string.Empty); // we don't count new line in total length... correct?
int totalLength = s.Length;
string totalL = " " + string.Format(_languageGeneral.TotalLengthX, totalLength);
if (lineBreakPos < 0 || pos <= lineBreakPos)
@ -18242,7 +18242,7 @@ namespace Nikse.SubtitleEdit.Forms
timeCodeLines.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds)));
timeCodeLines.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3:00}", p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds)));
textLines.AppendLine(Utilities.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "|"));
textLines.AppendLine(HtmlUtil.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "|"));
textLines.AppendLine();
}

View File

@ -229,8 +229,8 @@ namespace Nikse.SubtitleEdit.Forms
if (p.Text != null && next.Text != null)
{
string s = Utilities.RemoveHtmlTags(p.Text.Trim());
string s2 = Utilities.RemoveHtmlTags(next.Text.Trim());
string s = HtmlUtil.RemoveHtmlTags(p.Text.Trim());
string s2 = HtmlUtil.RemoveHtmlTags(next.Text.Trim());
return s == s2;
}
return false;
@ -246,8 +246,8 @@ namespace Nikse.SubtitleEdit.Forms
if (p.Text != null && next.Text != null)
{
string s = Utilities.RemoveHtmlTags(p.Text.Trim());
string s2 = Utilities.RemoveHtmlTags(next.Text.Trim());
string s = HtmlUtil.RemoveHtmlTags(p.Text.Trim());
string s2 = HtmlUtil.RemoveHtmlTags(next.Text.Trim());
if (!string.IsNullOrEmpty(s) && s2.Length > 0 && s2.StartsWith(s))
return true;
}

View File

@ -238,7 +238,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (p != null && p.Text != null && next != null && next.Text != null)
{
string s = Utilities.RemoveHtmlTags(p.Text.Trim());
string s = HtmlUtil.RemoveHtmlTags(p.Text.Trim());
if (p.Text.Length + next.Text.Length < maximumTotalLength && next.StartTime.TotalMilliseconds - p.EndTime.TotalMilliseconds < maximumMillisecondsBetweenLines)
{

View File

@ -209,7 +209,7 @@ namespace Nikse.SubtitleEdit.Forms
AddToPreviewListView(p, newText);
int index = _subtitle.GetIndex(p);
FixedSubtitle.Paragraphs[index].Text = newText;
if (!string.IsNullOrWhiteSpace(p.Text) && (string.IsNullOrWhiteSpace(newText) || Utilities.RemoveHtmlTags(newText, true).Trim().Length == 0))
if (!string.IsNullOrWhiteSpace(p.Text) && (string.IsNullOrWhiteSpace(newText) || HtmlUtil.RemoveHtmlTags(newText, true).Trim().Length == 0))
{
DeleteIndices.Add(index);
}

View File

@ -123,7 +123,7 @@ namespace Nikse.SubtitleEdit.Forms
int i = 0;
foreach (Paragraph p in subtitle.Paragraphs)
{
string s = Utilities.RemoveHtmlTags(p.Text);
string s = HtmlUtil.RemoveHtmlTags(p.Text);
if (s.Length > maxLength)
{
maxLength = s.Length;
@ -170,7 +170,7 @@ namespace Nikse.SubtitleEdit.Forms
var p = subtitle.GetParagraphOrDefault(i);
if (p != null && p.Text != null)
{
string oldText = Utilities.RemoveHtmlTags(p.Text);
string oldText = HtmlUtil.RemoveHtmlTags(p.Text);
if (SplitLongLinesHelper.QualifiesForSplit(p.Text, singleLineMaxCharacters, totalLineMaxCharacters) && IsFixAllowed(p))
{
bool isDialog = false;
@ -229,9 +229,9 @@ namespace Nikse.SubtitleEdit.Forms
newParagraph1.Text = Utilities.AutoBreakLine(arr[0], language);
double middle = p.StartTime.TotalMilliseconds + (p.Duration.TotalMilliseconds / 2);
if (!string.IsNullOrWhiteSpace(Utilities.RemoveHtmlTags(oldText)))
if (!string.IsNullOrWhiteSpace(HtmlUtil.RemoveHtmlTags(oldText)))
{
var startFactor = (double)Utilities.RemoveHtmlTags(newParagraph1.Text).Length / Utilities.RemoveHtmlTags(oldText).Length;
var startFactor = (double)HtmlUtil.RemoveHtmlTags(newParagraph1.Text).Length / HtmlUtil.RemoveHtmlTags(oldText).Length;
if (startFactor < 0.25)
startFactor = 0.25;
if (startFactor > 0.75)
@ -248,7 +248,7 @@ namespace Nikse.SubtitleEdit.Forms
splittedIndexes.Add(splittedSubtitle.Paragraphs.Count);
splittedIndexes.Add(splittedSubtitle.Paragraphs.Count + 1);
string p1 = Utilities.RemoveHtmlTags(newParagraph1.Text).TrimEnd();
string p1 = HtmlUtil.RemoveHtmlTags(newParagraph1.Text).TrimEnd();
if (p1.EndsWith('.') || p1.EndsWith('!') || p1.EndsWith('?') || p1.EndsWith(':') || p1.EndsWith(')') || p1.EndsWith(']') || p1.EndsWith('♪'))
{
if (newParagraph1.Text.StartsWith('-') && newParagraph2.Text.StartsWith('-'))

View File

@ -126,7 +126,7 @@ https://github.com/SubtitleEdit/subtitleedit
sb.AppendLine(string.Format(_l.NumberOfLinesX, _subtitle.Paragraphs.Count));
sb.AppendLine(string.Format(_l.LengthInFormatXinCharactersY, _format.FriendlyName, sourceLength));
sb.AppendLine(string.Format(_l.NumberOfCharactersInTextOnly, allText.Length));
sb.AppendLine(string.Format(_l.TotalCharsPerSecond, Utilities.RemoveHtmlTags(allText.ToString()).Length / (totalDuration / 1000.0)));
sb.AppendLine(string.Format(_l.TotalCharsPerSecond, HtmlUtil.RemoveHtmlTags(allText.ToString()).Length / (totalDuration / 1000.0)));
sb.AppendLine(string.Format(_l.NumberOfItalicTags, Utilities.CountTagInText(allText.ToString().ToLower(), "<i>")));
sb.AppendLine(string.Format(_l.NumberOfBoldTags, Utilities.CountTagInText(allText.ToString().ToLower(), "<b>")));
sb.AppendLine(string.Format(_l.NumberOfUnderlineTags, Utilities.CountTagInText(allText.ToString().ToLower(), "<u>")));

View File

@ -155,7 +155,7 @@ namespace Nikse.SubtitleEdit.Forms
{
bool subtitleFontBold = bold;
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
Font font;
try
@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Forms
SizeF textSize = g.MeasureString("Hj!", font);
var lineHeight = (textSize.Height * 0.64f);
textSize = g.MeasureString(Utilities.RemoveHtmlTags(text), font);
textSize = g.MeasureString(HtmlUtil.RemoveHtmlTags(text), font);
g.Dispose();
bmp.Dispose();
int sizeX = (int)(textSize.Width * 0.8) + 40;

View File

@ -6052,7 +6052,7 @@ namespace Nikse.SubtitleEdit.Forms
if ((line.StartsWith("J' ") || line.StartsWith("J“ ") || line.StartsWith("J* ") || line.StartsWith("♪ ")) && unItalicText.Length > 3 && HtmlUtil.RemoveOpenCloseTags(unItalicText, HtmlUtil.TagItalic)[1] == ' ')
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 2).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6060,7 +6060,7 @@ namespace Nikse.SubtitleEdit.Forms
if ((line.StartsWith("J' ") || line.StartsWith("J“ ") || line.StartsWith("J* ") || line.StartsWith("♪ ")) && unItalicText.Length > 3 && HtmlUtil.RemoveOpenCloseTags(unItalicText, HtmlUtil.TagItalic)[2] == ' ')
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 2).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6068,7 +6068,7 @@ namespace Nikse.SubtitleEdit.Forms
if (unItalicText.StartsWith("J'") && (line.StartsWith('♪') || textWithOutFixes.StartsWith('♪') || textWithOutFixes.StartsWith("<i>♪") || unItalicText.EndsWith('♪')))
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 2).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6076,7 +6076,7 @@ namespace Nikse.SubtitleEdit.Forms
if ((line.StartsWith("J` ") || line.StartsWith("J“ ") || line.StartsWith("J' ") || line.StartsWith("J* ")) && unItalicText.StartsWith("S "))
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 2).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6084,7 +6084,7 @@ namespace Nikse.SubtitleEdit.Forms
if ((line.StartsWith("J` ") || line.StartsWith("J“ ") || line.StartsWith("J' ") || line.StartsWith("J* ")) && unItalicText.StartsWith("<i>S</i> "))
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 8).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6092,7 +6092,7 @@ namespace Nikse.SubtitleEdit.Forms
if (unItalicText.StartsWith(";'") && (line.StartsWith('♪') || textWithOutFixes.StartsWith('♪') || textWithOutFixes.StartsWith("<i>♪") || unItalicText.EndsWith('♪')))
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 2).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6100,7 +6100,7 @@ namespace Nikse.SubtitleEdit.Forms
if (unItalicText.StartsWith(",{*") && (line.StartsWith('♪') || textWithOutFixes.StartsWith('♪') || textWithOutFixes.StartsWith("<i>♪") || unItalicText.EndsWith('♪')))
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = "♪ " + unItalicText.Remove(0, 3).TrimStart();
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6109,7 +6109,7 @@ namespace Nikse.SubtitleEdit.Forms
if (unItalicText.EndsWith("J'") && (line.EndsWith('♪') || textWithOutFixes.EndsWith('♪') || textWithOutFixes.EndsWith("♪</i>") || unItalicText.StartsWith('♪')))
{
bool ita = unItalicText.StartsWith("<i>") && unItalicText.EndsWith("</i>");
unItalicText = Utilities.RemoveHtmlTags(unItalicText);
unItalicText = HtmlUtil.RemoveHtmlTags(unItalicText);
unItalicText = unItalicText.Remove(unItalicText.Length - 3, 2).TrimEnd() + " ♪";
if (ita)
unItalicText = "<i>" + unItalicText + "</i>";
@ -6356,7 +6356,7 @@ namespace Nikse.SubtitleEdit.Forms
}
//check Tesseract... find an other way to do this...
//string tmp = Utilities.RemoveHtmlTags(line).Trim();
//string tmp = HtmlUtil.RemoveHtmlTags(line).Trim();
//if (!tmp.TrimEnd().EndsWith("..."))
//{
// tmp = tmp.TrimEnd('.').TrimEnd();
@ -6364,7 +6364,7 @@ namespace Nikse.SubtitleEdit.Forms
// {
// if (_nocrChars == null)
// _nocrChars = LoadNOcrForTesseract("Nikse.SubtitleEdit.Resources.nOCR_TesseractHelper.xml.zip");
// string text = Utilities.RemoveHtmlTags(NocrFastCheck(bitmap).TrimEnd());
// string text = HtmlUtil.RemoveHtmlTags(NocrFastCheck(bitmap).TrimEnd());
// string post = string.Empty;
// if (line.EndsWith("</i>"))
// {
@ -7152,7 +7152,7 @@ namespace Nikse.SubtitleEdit.Forms
Paragraph p = _subtitle.GetParagraphOrDefault(item.Index);
if (p != null)
{
p.Text = Utilities.RemoveHtmlTags(p.Text);
p.Text = HtmlUtil.RemoveHtmlTags(p.Text);
subtitleListView1.SetText(item.Index, p.Text);
if (item.Index == _selectedIndex)
textBoxCurrentText.Text = p.Text;

View File

@ -113,8 +113,8 @@ namespace Nikse.SubtitleEdit.Logic.Forms
var parts = text.Replace(" - ", Environment.NewLine).SplitToLines();
if (parts.Length == 2)
{
string part0 = Utilities.RemoveHtmlTags(parts[0]).Trim();
string part1 = Utilities.RemoveHtmlTags(parts[1]).Trim();
string part0 = HtmlUtil.RemoveHtmlTags(parts[0]).Trim();
string part1 = HtmlUtil.RemoveHtmlTags(parts[1]).Trim();
if (part0.Length > 1 && "-—!?.\"".Contains(part0[part0.Length - 1]) &&
part1.Length > 1 && ("'" + Utilities.UppercaseLetters).Contains(part1[0]))
{
@ -206,14 +206,14 @@ namespace Nikse.SubtitleEdit.Logic.Forms
{
var prev = subtitle.GetParagraphOrDefault(i - 1);
if (prev == null || !Utilities.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith('-') || Utilities.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith("--", StringComparison.Ordinal))
if (prev == null || !HtmlUtil.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith('-') || HtmlUtil.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith("--", StringComparison.Ordinal))
{
var lines = Utilities.RemoveHtmlTags(p.Text).SplitToLines();
var lines = HtmlUtil.RemoveHtmlTags(p.Text).SplitToLines();
int startHyphenCount = lines.Count(line => line.TrimStart().StartsWith('-'));
if (startHyphenCount == 1)
{
bool remove = true;
var parts = Utilities.RemoveHtmlTags(text).SplitToLines();
var parts = HtmlUtil.RemoveHtmlTags(text).SplitToLines();
if (parts.Length == 2)
{
if (parts[0].TrimStart().StartsWith('-') && parts[1].Contains(": "))
@ -269,7 +269,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
else if (text.StartsWith("<font ", StringComparison.Ordinal))
{
var prev = subtitle.GetParagraphOrDefault(i - 1);
if (prev == null || !Utilities.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith('-') || Utilities.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith("--", StringComparison.Ordinal))
if (prev == null || !HtmlUtil.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith('-') || HtmlUtil.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith("--", StringComparison.Ordinal))
{
var st = new StripableText(text);
if (st.Pre.EndsWith('-') || st.Pre.EndsWith("- ", StringComparison.Ordinal))
@ -299,18 +299,18 @@ namespace Nikse.SubtitleEdit.Logic.Forms
{
Paragraph p = subtitle.Paragraphs[i];
string text = p.Text;
var textCache = Utilities.RemoveHtmlTags(text.TrimStart());
var textCache = HtmlUtil.RemoveHtmlTags(text.TrimStart());
if (textCache.StartsWith('-') || textCache.Contains(Environment.NewLine + "-"))
{
Paragraph prev = subtitle.GetParagraphOrDefault(i - 1);
if (prev == null || !Utilities.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith('-') || Utilities.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith("--", StringComparison.Ordinal))
if (prev == null || !HtmlUtil.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith('-') || HtmlUtil.RemoveHtmlTags(prev.Text).TrimEnd().EndsWith("--", StringComparison.Ordinal))
{
var lines = Utilities.RemoveHtmlTags(p.Text).SplitToLines();
var lines = HtmlUtil.RemoveHtmlTags(p.Text).SplitToLines();
int startHyphenCount = lines.Count(line => line.TrimStart().StartsWith('-'));
if (startHyphenCount == 1)
{
var parts = Utilities.RemoveHtmlTags(text).SplitToLines();
var parts = HtmlUtil.RemoveHtmlTags(text).SplitToLines();
if (parts.Length == 2)
{
var part0 = parts[0].TrimEnd();
@ -388,7 +388,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
if (string.IsNullOrWhiteSpace(text) || !text.Contains(Environment.NewLine, StringComparison.Ordinal))
return text;
string s = Utilities.RemoveHtmlTags(text);
string s = HtmlUtil.RemoveHtmlTags(text);
if (s.Replace(Environment.NewLine, " ").Replace(" ", " ").Length < Configuration.Settings.Tools.MergeLinesShorterThan && text.Contains(Environment.NewLine))
{
s = s.TrimEnd().TrimEnd('.', '?', '!', ':', ';');

View File

@ -100,7 +100,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
if (indexOfColon > 0)
{
string pre = s.Substring(0, indexOfColon);
if (Settings.RemoveTextBeforeColonOnlyUppercase && Utilities.RemoveHtmlTags(pre, true) != Utilities.RemoveHtmlTags(pre, true).ToUpper())
if (Settings.RemoveTextBeforeColonOnlyUppercase && HtmlUtil.RemoveHtmlTags(pre, true) != HtmlUtil.RemoveHtmlTags(pre, true).ToUpper())
{
newText = newText + Environment.NewLine + s;
newText = newText.Trim();
@ -313,7 +313,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
}
else if (Utilities.CountTagInText(newText, Environment.NewLine) == 1 && removedInFirstLine == false && removedInSecondLine)
{
string noTags = Utilities.RemoveHtmlTags(newText, true).Trim();
string noTags = HtmlUtil.RemoveHtmlTags(newText, true).Trim();
bool insertDash = noTags.StartsWith('-') && Utilities.CountTagInText(noTags, '-') == 1;
if (insertDash)
{
@ -428,7 +428,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
// fix 3 lines to two liners - if only two lines
if (noOfNamesRemoved >= 1 && Utilities.CountTagInText(text, Environment.NewLine) == 2)
{
string[] a = Utilities.RemoveHtmlTags(text).Replace(" ", string.Empty).Split(new[] { '!', '?', '.' }, StringSplitOptions.RemoveEmptyEntries);
string[] a = HtmlUtil.RemoveHtmlTags(text).Replace(" ", string.Empty).Split(new[] { '!', '?', '.' }, StringSplitOptions.RemoveEmptyEntries);
if (a.Length == 2)
{
var temp = new StripableText(text);
@ -795,9 +795,9 @@ namespace Nikse.SubtitleEdit.Logic.Forms
lines[0] = lines[0].Remove(0, 1);
return lines[0].Trim();
}
if (Utilities.RemoveHtmlTags(lines[0], false).Trim() == "-")
if (HtmlUtil.RemoveHtmlTags(lines[0], false).Trim() == "-")
{
if (Utilities.RemoveHtmlTags(lines[1], false).Trim() == "-")
if (HtmlUtil.RemoveHtmlTags(lines[1], false).Trim() == "-")
return string.Empty;
if (lines[1].StartsWith('-') && lines[1].Length > 1)
return lines[1].Remove(0, 1).Trim();
@ -805,9 +805,9 @@ namespace Nikse.SubtitleEdit.Logic.Forms
return "<i>" + lines[1].Remove(0, 4).Trim();
return lines[1];
}
if (Utilities.RemoveHtmlTags(lines[1], false).Trim() == "-")
if (HtmlUtil.RemoveHtmlTags(lines[1], false).Trim() == "-")
{
if (Utilities.RemoveHtmlTags(lines[0], false).Trim() == "-")
if (HtmlUtil.RemoveHtmlTags(lines[0], false).Trim() == "-")
return string.Empty;
if (lines[0].StartsWith('-') && lines[0].Length > 1)
return lines[0].Remove(0, 1).Trim();
@ -966,7 +966,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
var sb = new StringBuilder();
foreach (string line in lines)
{
string lineNoHtml = Utilities.RemoveHtmlTags(line);
string lineNoHtml = HtmlUtil.RemoveHtmlTags(line);
string tmp = lineNoHtml.TrimEnd('.', '!', '?', ':').Trim();
if (lineNoHtml != lineNoHtml.ToLower() && lineNoHtml == lineNoHtml.ToUpper())
{

View File

@ -9,7 +9,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
public static bool QualifiesForSplit(string text, int singleLineMaxCharacters, int totalLineMaxCharacters)
{
string s = Utilities.RemoveHtmlTags(text.Trim());
string s = HtmlUtil.RemoveHtmlTags(text.Trim());
if (s.Length > totalLineMaxCharacters)
return true;
@ -88,7 +88,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
splittedIndexes.Add(splittedSubtitle.Paragraphs.Count);
splittedIndexes.Add(splittedSubtitle.Paragraphs.Count + 1);
string p1 = Utilities.RemoveHtmlTags(newParagraph1.Text);
string p1 = HtmlUtil.RemoveHtmlTags(newParagraph1.Text);
if (p1.EndsWith('.') || p1.EndsWith('!') || p1.EndsWith('?') || p1.EndsWith(':') || p1.EndsWith(')') || p1.EndsWith(']') || p1.EndsWith('♪'))
{
if (newParagraph1.Text.StartsWith('-') && newParagraph2.Text.StartsWith('-'))

View File

@ -467,7 +467,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
int start = text.IndexOf(tag, StringComparison.Ordinal);
while (start > 0)
{
lastLine = Utilities.RemoveHtmlTags(text.Substring(0, start)).TrimEnd().TrimEnd('-').TrimEnd();
lastLine = HtmlUtil.RemoveHtmlTags(text.Substring(0, start)).TrimEnd().TrimEnd('-').TrimEnd();
endingBeforeThis = string.IsNullOrEmpty(lastLine) || lastLine.EndsWith('.') || lastLine.EndsWith('!') || lastLine.EndsWith('?');
if (start < text.Length - 4)
{
@ -490,7 +490,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
start = text.IndexOf(tag, StringComparison.Ordinal);
while (start > 0)
{
lastLine = Utilities.RemoveHtmlTags(text.Substring(0, start)).TrimEnd().TrimEnd('-').TrimEnd();
lastLine = HtmlUtil.RemoveHtmlTags(text.Substring(0, start)).TrimEnd().TrimEnd('-').TrimEnd();
endingBeforeThis = string.IsNullOrEmpty(lastLine) || lastLine.EndsWith('.') || lastLine.EndsWith('!') || lastLine.EndsWith('?') || lastLine.EndsWith(".</i>");
if (start < text.Length - 5)
{
@ -510,7 +510,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
start = text.IndexOf(tag, StringComparison.Ordinal);
while (start > 0)
{
lastLine = Utilities.RemoveHtmlTags(text.Substring(0, start)).TrimEnd().TrimEnd('-').TrimEnd();
lastLine = HtmlUtil.RemoveHtmlTags(text.Substring(0, start)).TrimEnd().TrimEnd('-').TrimEnd();
endingBeforeThis = string.IsNullOrEmpty(lastLine) || lastLine.EndsWith('.') || lastLine.EndsWith('!') || lastLine.EndsWith('?') || lastLine.EndsWith(".</i>");
if (start < text.Length - 8)
{
@ -652,7 +652,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
if (i > 0)
lastLine = lines[i - 1];
lastLine = Utilities.RemoveHtmlTags(lastLine);
lastLine = HtmlUtil.RemoveHtmlTags(lastLine);
if (string.IsNullOrEmpty(lastLine) ||
lastLine.EndsWith('.') ||
@ -830,7 +830,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
lastLine.EndsWith(']') ||
lastLine.EndsWith('♪'))
{
lastLine = Utilities.RemoveHtmlTags(lastLine);
lastLine = HtmlUtil.RemoveHtmlTags(lastLine);
var st = new StripableText(input);
if (lastLine == null || (!lastLine.EndsWith("...") && !EndsWithAbbreviation(lastLine, abbreviationList)))
{

View File

@ -143,7 +143,7 @@ namespace Nikse.SubtitleEdit.Logic
{
if (string.IsNullOrEmpty(Text))
return 0;
int wordCount = Utilities.RemoveHtmlTags(Text).Split((" ,.!?;:()[]" + Environment.NewLine).ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
int wordCount = HtmlUtil.RemoveHtmlTags(Text).Split((" ,.!?;:()[]" + Environment.NewLine).ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
return (60.0 / Duration.TotalSeconds) * wordCount;
}
}

View File

@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Logic
if (checkLastLine)
{
string s = Utilities.RemoveHtmlTags(lastLine).TrimEnd().TrimEnd('\"').TrimEnd();
string s = HtmlUtil.RemoveHtmlTags(lastLine).TrimEnd().TrimEnd('\"').TrimEnd();
bool startWithUppercase = string.IsNullOrEmpty(s) ||
s.EndsWith('.') ||

View File

@ -53,7 +53,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
end.InnerText = ToTimeCode(p.EndTime.TotalMilliseconds);
paragraph.Attributes.Append(end);
paragraph.InnerText = Utilities.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "|"), true);
paragraph.InnerText = HtmlUtil.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "|"), true);
reel.AppendChild(paragraph);
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Xml;
using Nikse.SubtitleEdit.Core;
namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
@ -52,7 +53,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
XmlNode paragraph = xml.CreateElement("marker");
paragraph.InnerXml = string.Format(CultureInfo.InvariantCulture, innerXml, p.StartTime.TotalSeconds, p.Duration.TotalSeconds);
paragraph.SelectSingleNode("comment").Attributes["value"].InnerText = Utilities.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "||");
paragraph.SelectSingleNode("comment").Attributes["value"].InnerText = HtmlUtil.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "||");
root.AppendChild(paragraph);
}

View File

@ -60,7 +60,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
sb.AppendLine(string.Format("{0} {1} {2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text, true)));
sb.AppendLine(string.Format("{0} {1} {2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text, true)));
index++;
}
return sb.ToString();

View File

@ -52,7 +52,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
string text = p.Text;
text = text.Replace("<i>", "@Italic@");
text = text.Replace("</i>", "@Italic@");
text = Utilities.RemoveHtmlTags(text, true);
text = HtmlUtil.RemoveHtmlTags(text, true);
if (Utilities.CountTagInText(Environment.NewLine, text) > 1)
text = Utilities.AutoBreakLineMoreThanTwoLines(text, Configuration.Settings.General.SubtitleLineMaximumLength, string.Empty);
text = text.Replace(Environment.NewLine, Environment.NewLine + "\t\t\t\t");

View File

@ -52,7 +52,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
text = text.Replace("<i>", "@Italic@");
text = text.Replace("</i>", "@Italic@");
text = text.Replace(Environment.NewLine, "//");
sb.AppendLine(string.Format("{0:0000}\t{1}\t{2}\t{3}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(text, true)));
sb.AppendLine(string.Format("{0:0000}\t{1}\t{2}\t{3}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(text, true)));
}
return sb.ToString();
}

View File

@ -43,7 +43,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
//00:00:54:08 00:00:58:06 - Saucers... - ... a dry lake bed. (newline is \r)
sb.AppendLine(string.Format("{0}\t{1}\t{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "\r")));
sb.AppendLine(string.Format("{0}\t{1}\t{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "\r")));
index++;
}
return sb.ToString();

View File

@ -48,7 +48,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
sb.AppendLine(string.Format("{0} {1} {2} {3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text, true)));
sb.AppendLine(string.Format("{0} {1} {2} {3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text, true)));
index++;
}
return sb.ToString();

View File

@ -46,7 +46,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
sb.AppendLine(string.Format("{0} {1} {2} {3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text, true)));
sb.AppendLine(string.Format("{0} {1} {2} {3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text, true)));
index++;
}
return sb.ToString();

View File

@ -40,7 +40,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb.AppendLine("<begin subtitles>");
foreach (Paragraph p in subtitle.Paragraphs)
{
sb.AppendLine(string.Format("{0} {1}{2}{3}{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Environment.NewLine, Utilities.RemoveHtmlTags(p.Text, true)));
sb.AppendLine(string.Format("{0} {1}{2}{3}{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Environment.NewLine, HtmlUtil.RemoveHtmlTags(p.Text, true)));
//00:50:34:22 00:50:39:13
//Ich muss dafür sorgen,
//dass die Epsteins weiterleben

View File

@ -73,7 +73,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb.AppendLine("$Italic = FALSE");
}
text = Utilities.RemoveHtmlTags(text, true);
text = HtmlUtil.RemoveHtmlTags(text, true);
sb.AppendLine(string.Format("{0}\t{1}\t{2}\t{3}", count, MakeTimeCode(p.StartTime), MakeTimeCode(p.EndTime), text.Replace(Environment.NewLine, "|")));
sb.AppendLine();
count++;

View File

@ -58,7 +58,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.AppendChild(end);
XmlNode text = xml.CreateElement("Text");
text.InnerText = Utilities.RemoveHtmlTags(p.Text, true);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text, true);
paragraph.AppendChild(text);
xml.DocumentElement.AppendChild(paragraph);

View File

@ -108,7 +108,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
buffer[10] = 3;
fs.Write(buffer, 0, buffer.Length);
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
if (text.Length > 118)
text = text.Substring(0, 118);
fs.WriteByte((byte)(text.Length));

View File

@ -72,7 +72,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.Attributes.Append(end);
XmlAttribute text = xml.CreateAttribute("CaptionText");
text.InnerText = Utilities.RemoveHtmlTags(p.Text, true);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text, true);
paragraph.Attributes.Append(text);
XmlAttribute align = xml.CreateAttribute("Align");

View File

@ -1,4 +1,5 @@
using System;
using Nikse.SubtitleEdit.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
@ -87,7 +88,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.AppendChild(tracks);
XmlNode track0 = xml.CreateElement("track0");
track0.InnerText = Utilities.RemoveHtmlTags(p.Text, true);
track0.InnerText = HtmlUtil.RemoveHtmlTags(p.Text, true);
track0.InnerXml = track0.InnerXml.Replace(Environment.NewLine, "<br />");
tracks.AppendChild(track0);
}
@ -143,7 +144,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (node.SelectSingleNode("tracks/track0") != null)
{
string text = node.SelectSingleNode("tracks/track0").InnerText;
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
text = text.Replace("<br>", Environment.NewLine).Replace("<br />", Environment.NewLine).Replace("<BR>", Environment.NewLine);
p = new Paragraph(text, startMilliseconds, startMilliseconds + 3000);
if (!string.IsNullOrWhiteSpace(text))

View File

@ -87,7 +87,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.AppendChild(tracks);
XmlNode track0 = xml.CreateElement("track0");
track0.InnerText = Utilities.RemoveHtmlTags(p.Text, true);
track0.InnerText = HtmlUtil.RemoveHtmlTags(p.Text, true);
track0.InnerXml = track0.InnerXml.Replace(Environment.NewLine, "<br />");
tracks.AppendChild(track0);
}
@ -131,7 +131,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (node.SelectSingleNode("tracks/track0") != null)
{
string text = node.SelectSingleNode("tracks/track0").InnerText;
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
text = text.Replace("<br>", Environment.NewLine).Replace("<br />", Environment.NewLine).Replace("<BR>", Environment.NewLine);
p = new Paragraph(text, startMilliseconds, startMilliseconds + 3000);
if (!string.IsNullOrWhiteSpace(text))

View File

@ -157,7 +157,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var textBytes = new List<byte>();
var italic = p.Text.StartsWith("<i>") && p.Text.EndsWith("</i>");
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
int j = 0;
if (italic)
textBytes.Add(0xd0);

View File

@ -247,7 +247,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
}
text = sb + post;
if (Utilities.RemoveHtmlTags(text).Trim().Length == 0)
if (HtmlUtil.RemoveHtmlTags(text).Trim().Length == 0)
return string.Empty;
return text;
}

View File

@ -279,7 +279,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
i += 7;
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
txt = new StringBuilder();
}
@ -329,7 +329,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
fontNode.Attributes.Append(fontEffect);
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
txt = new StringBuilder();
}
@ -366,7 +366,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
fontNode.Attributes.Append(fontEffect);
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
}
else if (html.Length > 0 && html.ToString().StartsWith("<Font "))
@ -414,7 +414,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
fontNode.Attributes.Append(fontEffect);
}
fontNode.InnerText = Utilities.RemoveHtmlTags(line);
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(line);
html.Append(fontNode.OuterXml);
}
}

View File

@ -303,7 +303,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
i += 7;
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
txt = new StringBuilder();
}
@ -346,7 +346,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
i += 4;
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
txt = new StringBuilder();
}
@ -377,7 +377,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
fontNode.Attributes.Append(italic);
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
}
else if (html.Length > 0 && html.ToString().StartsWith("<dcst:Font "))
@ -411,7 +411,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
italic.InnerText = "yes";
fontNode.Attributes.Append(italic);
fontNode.InnerText = Utilities.RemoveHtmlTags(line);
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(line);
html.Append(fontNode.OuterXml);
}
}

View File

@ -304,7 +304,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
i += 7;
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
txt = new StringBuilder();
}
@ -347,7 +347,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
i += 4;
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
txt = new StringBuilder();
}
@ -378,7 +378,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
fontNode.Attributes.Append(italic);
}
fontNode.InnerText = Utilities.RemoveHtmlTags(txt.ToString());
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(txt.ToString());
html.Append(fontNode.OuterXml);
}
else if (html.Length > 0 && html.ToString().StartsWith("<dcst:Font "))
@ -412,7 +412,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
italic.InnerText = "yes";
fontNode.Attributes.Append(italic);
fontNode.InnerText = Utilities.RemoveHtmlTags(line);
fontNode.InnerText = HtmlUtil.RemoveHtmlTags(line);
html.Append(fontNode.OuterXml);
}
}

View File

@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
sb.AppendLine(string.Format("{0} {1} {2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "//"), true)));
sb.AppendLine(string.Format("{0} {1} {2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "//"), true)));
}
return sb.ToString();
}

View File

@ -273,7 +273,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
//font tags
if (header.DisplayStandardCode == "0") // Open subtitling
{
TextField = Utilities.RemoveHtmlTags(TextField, true);
TextField = HtmlUtil.RemoveHtmlTags(TextField, true);
}
else // teletext
{
@ -325,7 +325,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb.Append(prefix);
sb.AppendLine(s);
}
TextField = Utilities.RemoveHtmlTags(sb.ToString()).TrimEnd();
TextField = HtmlUtil.RemoveHtmlTags(sb.ToString()).TrimEnd();
}
// newline

View File

@ -45,9 +45,9 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
// if (p.StartTime.TotalMilliseconds == lastEndTimeMilliseconds)
sb.AppendFormat("{0}{1}", Utilities.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime));
sb.AppendFormat("{0}{1}", HtmlUtil.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime));
//else
// sb.Append(string.Format("{0}{1}{2}", EncodeTimeCode(p.StartTime), Utilities.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime)));
// sb.Append(string.Format("{0}{1}{2}", EncodeTimeCode(p.StartTime), HtmlUtil.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime)));
lastEndTimeMilliseconds = p.EndTime.TotalMilliseconds;
}
return sb.ToString().Trim();

View File

@ -40,7 +40,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
//00:50:34:22 00:50:39:13
//Ich muss dafür sorgen,
//dass die Epsteins weiterleben
sb.AppendLine(string.Format("{0} {1}{2}{3}{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Environment.NewLine, Utilities.RemoveHtmlTags(p.Text)));
sb.AppendLine(string.Format("{0} {1}{2}{3}{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Environment.NewLine, HtmlUtil.RemoveHtmlTags(p.Text)));
index++;
}
return sb.ToString();

View File

@ -68,7 +68,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
XmlNode paragraph = xml.CreateElement("subtitle");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
XmlNode num = xml.CreateElement("num");
num.InnerText = no.ToString();

View File

@ -137,7 +137,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
end.InnerText = ((int)Math.Round(p.EndTime.TotalSeconds * frameRate)).ToString();
XmlNode text = generatorItem.SelectSingleNode("generatoritem/effect/parameter[parameterid='str']/value");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
text.InnerXml = text.InnerXml.Replace(Environment.NewLine, newLine);
trackNode.AppendChild(generatorItem.SelectSingleNode("generatoritem"));

View File

@ -207,7 +207,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
end.InnerText = ((int)Math.Round(p.EndTime.TotalSeconds * frameRate)).ToString();
XmlNode text = generatorItem.SelectSingleNode("generatoritem/effect/parameter[parameterid='str']/value");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
text.InnerXml = text.InnerXml.Replace(Environment.NewLine, newLine);
trackNode.AppendChild(generatorItem.SelectSingleNode("generatoritem"));

View File

@ -103,12 +103,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
XmlNode titleNode = clip.SelectSingleNode("title");
titleNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s";
titleNode.Attributes["name"].Value = Utilities.RemoveHtmlTags(p.Text);
titleNode.Attributes["name"].Value = HtmlUtil.RemoveHtmlTags(p.Text);
titleNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 60000) + "/60000s";
titleNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s";
XmlNode text = clip.SelectSingleNode("title/text");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
videoNode.AppendChild(clip);
number++;

View File

@ -423,7 +423,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
end.InnerText = ((int)Math.Round(p.EndTime.TotalSeconds * frameRate)).ToString();
XmlNode text = generatorItem.SelectSingleNode("generatoritem/effect/parameter[parameterid='str']/value");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
text.InnerXml = text.InnerXml.Replace(Environment.NewLine, newLine);
trackNode.AppendChild(generatorItem.SelectSingleNode("generatoritem"));

View File

@ -102,12 +102,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
XmlNode titleNode = clip.SelectSingleNode("video");
titleNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s";
titleNode.Attributes["name"].Value = Utilities.RemoveHtmlTags(p.Text);
titleNode.Attributes["name"].Value = HtmlUtil.RemoveHtmlTags(p.Text);
titleNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 60000) + "/60000s";
titleNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s";
XmlNode param = clip.SelectSingleNode("video/param");
param.Attributes["value"].InnerText = Utilities.RemoveHtmlTags(p.Text);
param.Attributes["value"].InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
videoNode.AppendChild(clip);
number++;

View File

@ -93,7 +93,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
generatorNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 2400000) + "/2400000s";
XmlNode param = video.SelectSingleNode("video/param");
param.Attributes["value"].InnerText = Utilities.RemoveHtmlTags(p.Text);
param.Attributes["value"].InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
videoNode.AppendChild(generatorNode);
number++;

View File

@ -82,7 +82,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
XmlNode video = xml.CreateElement("video");
var trimmedTitle = new StringBuilder();
foreach (var ch in Utilities.RemoveHtmlTags(p.Text, true))
foreach (var ch in HtmlUtil.RemoveHtmlTags(p.Text, true))
{
if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".Contains(ch.ToString(CultureInfo.InvariantCulture)))
trimmedTitle.Append(ch.ToString(CultureInfo.InvariantCulture));
@ -107,7 +107,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
generatorNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 2400000) + "/2400000s";
XmlNode param = video.SelectSingleNode("title/text/text-style");
param.InnerText = Utilities.RemoveHtmlTags(p.Text);
param.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
videoNode.AppendChild(generatorNode);
number++;

View File

@ -78,10 +78,10 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
titleNode.InnerXml = xmlClipStructure;
titleNode = titleNode.SelectSingleNode("title");
titleNode.Attributes["offset"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s";
titleNode.Attributes["name"].Value = Utilities.RemoveHtmlTags(p.Text);
titleNode.Attributes["name"].Value = HtmlUtil.RemoveHtmlTags(p.Text);
titleNode.Attributes["duration"].Value = Convert.ToInt64(p.Duration.TotalSeconds * 60000) + "/60000s";
titleNode.Attributes["start"].Value = Convert.ToInt64(p.StartTime.TotalSeconds * 60000) + "/60000s";
titleNode.SelectSingleNode("text").InnerText = Utilities.RemoveHtmlTags(p.Text);
titleNode.SelectSingleNode("text").InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
videoNode.AppendChild(titleNode);
number++;
}

View File

@ -77,7 +77,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
XmlNode paragraph = xml.CreateElement("p");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.InnerText = text;
paragraph.InnerXml = "<![CDATA[<sub>" + paragraph.InnerXml.Replace(Environment.NewLine, "<br />") + "</sub>]]>";

View File

@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
count++;
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
if (p.Text.StartsWith("<i>") && p.Text.EndsWith("</i>"))
text = "#" + text;
sb.AppendLine(string.Format(paragraphWriteFormat, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), text, Environment.NewLine, count));

View File

@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
for (int i = 0; i < subtitle.Paragraphs.Count; i++)
{
Paragraph p = subtitle.Paragraphs[i];
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
sb.AppendLine(string.Format("{0}\t{1}\t{2}\t", count.ToString().PadLeft(5, ' '), MakeTimeCode(p.StartTime), text));
sb.AppendLine("\t\t\t\t");
Paragraph next = subtitle.GetParagraphOrDefault(i + 1);

View File

@ -69,7 +69,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (i + 1 < subtitle.Paragraphs.Count)
next = subtitle.Paragraphs[i + 1];
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
text = text.Replace(Environment.NewLine, " "); // text = text.Replace(Environment.NewLine, "|");
sb.AppendLine(string.Format("[{0:00}:{1:00}.{2:00}]{3}", p.StartTime.Hours * 60 + p.StartTime.Minutes, p.StartTime.Seconds, (int)Math.Round(p.StartTime.Milliseconds / 10.0), text));

View File

@ -101,7 +101,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (line.Contains("</i>"))
italicOn = false;
sb.Append(Utilities.RemoveHtmlTags(line));
sb.Append(HtmlUtil.RemoveHtmlTags(line));
count++;
}
sb.AppendLine();

View File

@ -240,7 +240,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (s.Contains("</u>"))
underlineOn = false;
lineSb.Append(Utilities.RemoveHtmlTags(pre + line));
lineSb.Append(HtmlUtil.RemoveHtmlTags(pre + line));
count++;
}
string text = lineSb.ToString();
@ -271,7 +271,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (Utilities.CountTagInText(text, "{y:u}") == 1 && noOfLines == 1)
text = text.Replace("{y:u}", "{Y:u}");
sb.AppendLine(Utilities.RemoveHtmlTags(text));
sb.AppendLine(HtmlUtil.RemoveHtmlTags(text));
}
return sb.ToString().Trim();
}

View File

@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
StringBuilder sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
sb.AppendLine(string.Format("{3} <{0}> <{1}>{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Environment.NewLine, Utilities.RemoveHtmlTags(p.Text)));
sb.AppendLine(string.Format("{3} <{0}> <{1}>{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Environment.NewLine, HtmlUtil.RemoveHtmlTags(p.Text)));
//Var vi bedre end japanerne
//eller bare mere heldige? <12:03:29:03> <12:03:35:06>
}

View File

@ -48,7 +48,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
const string tags = "{Bottom}{Open Caption}{Center}{White}{Font Arial GVP Bold}";
string text = Utilities.RemoveHtmlTags(p.Text, true);
string text = HtmlUtil.RemoveHtmlTags(p.Text, true);
text = text.Replace(Environment.NewLine, "{N}");
sb.AppendLine(string.Format(format, EncodeTimeCode(p.StartTime), tags, text));
}

View File

@ -195,7 +195,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
n3sub1sub3sub1sub.Attributes.Append(n3sub1sub3sub1suba1);
n3sub1sub3sub1.AppendChild(n3sub1sub3sub1sub);
var lines = Utilities.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "\n").Split('\n');
var lines = HtmlUtil.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, "\n").Split('\n');
for (int i = 0; i < lines.Length; i++)
{
var n3sub1sub3sub2 = xml.CreateElement("w:r", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");

View File

@ -80,7 +80,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
XmlNode paragraph = xml.CreateElement("dict");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
XmlNode keyNode = xml.CreateElement("key");
keyNode.InnerText = "in";

View File

@ -855,7 +855,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
text = text.Replace("</I>", "</i>");
if (Utilities.CountTagInText(text, "<i>") == 1 && text.StartsWith("<i>") && text.EndsWith("</i>"))
return "<" + Utilities.RemoveHtmlTags(text).Replace(Environment.NewLine, Environment.NewLine + "<");
return "<" + HtmlUtil.RemoveHtmlTags(text).Replace(Environment.NewLine, Environment.NewLine + "<");
var sb = new StringBuilder();
var parts = text.SplitToLines();
@ -864,7 +864,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
string s = line.Trim();
if (Utilities.CountTagInText(s, "<i>") == 1 && s.StartsWith("<i>") && s.EndsWith("</i>"))
{
sb.AppendLine("<" + Utilities.RemoveHtmlTags(s));
sb.AppendLine("<" + HtmlUtil.RemoveHtmlTags(s));
}
else
{
@ -1223,7 +1223,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
for (int i = 0; i < LatinLetters.Count; i++)
sb.Append(LatinLetters[i]);
string latinLetters = sb + "ABCDEFGHIJKLMNOPPQRSTUVWXYZÆØÅÄÖÜabcdefghijklmnopqrstuvwxyzæøäåü(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
foreach (char ch in HtmlUtil.RemoveHtmlTags(p.Text, true))
{
if (!latinLetters.Contains(ch))
allOk = false;
@ -1235,7 +1235,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
_codePage = 1;
p = GetPacParagraph(ref index, buffer);
allOk = true;
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
foreach (char ch in HtmlUtil.RemoveHtmlTags(p.Text, true))
{
if (!"AαBβΓγΔδEϵεZζHηΘθIιKκΛλMμNνΞξOοΠπPρΣσςTτΥυΦϕφXχΨψΩω(1234567890, .!?-\r\n'\")".Contains(ch))
allOk = false;
@ -1251,7 +1251,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
for (int i = 0; i < ArabicLetters.Count; i++)
sb.Append(ArabicLetters[i]);
string arabicLetters = sb + "(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
foreach (char ch in HtmlUtil.RemoveHtmlTags(p.Text, true))
{
if (!arabicLetters.Contains(ch))
allOk = false;
@ -1267,7 +1267,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
for (int i = 0; i < HebrewLetters.Count; i++)
sb.Append(HebrewLetters[i]);
string hebrewLetters = sb + "(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
foreach (char ch in HtmlUtil.RemoveHtmlTags(p.Text, true))
{
if (!hebrewLetters.Contains(ch))
allOk = false;
@ -1283,7 +1283,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
for (int i = 0; i < CyrillicLetters.Count; i++)
sb.Append(CyrillicLetters[i]);
string cyrillicLetters = sb + "(1234567890, .!?-\r\n'\")";
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
foreach (char ch in HtmlUtil.RemoveHtmlTags(p.Text, true))
{
if (!cyrillicLetters.Contains(ch))
allOk = false;

View File

@ -49,7 +49,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
//00:03:15:22 00:03:23:10 This is line one.
//This is line two.
sb.AppendLine(string.Format("{0} {1} {2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text)));
sb.AppendLine(string.Format("{0} {1} {2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text)));
index++;
}
sb.AppendLine(@"-------------------------------------------------");

View File

@ -1,4 +1,5 @@
using System;
using Nikse.SubtitleEdit.Core;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
@ -52,7 +53,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (index != 0) sb.AppendLine();
index++;
sb.AppendLine(Utilities.RemoveHtmlTags(p.Text));
sb.AppendLine(HtmlUtil.RemoveHtmlTags(p.Text));
sb.AppendLine(EncodeTimeCode(p.StartTime));
sb.AppendLine(EncodeTimeCode(p.EndTime));

View File

@ -54,7 +54,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
//[00:00:26.26]
//tout le temps,
//[00:00:35.08]
sb.AppendLine(string.Format("{0}{1}{2}", EncodeTimeCode(p.StartTime) + Environment.NewLine, Utilities.RemoveHtmlTags(p.Text) + Environment.NewLine, EncodeTimeCode(p.EndTime) + Environment.NewLine));
sb.AppendLine(string.Format("{0}{1}{2}", EncodeTimeCode(p.StartTime) + Environment.NewLine, HtmlUtil.RemoveHtmlTags(p.Text) + Environment.NewLine, EncodeTimeCode(p.EndTime) + Environment.NewLine));
index++;
}
return sb.ToString();

View File

@ -65,7 +65,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
XmlNode paragraph = xml.CreateElement("Data");
XmlAttribute charSize = xml.CreateAttribute("CharSize");
charSize.InnerText = Utilities.RemoveHtmlTags("0.2");
charSize.InnerText = HtmlUtil.RemoveHtmlTags("0.2");
paragraph.Attributes.Append(charSize);
XmlAttribute posX = xml.CreateAttribute("PosX");
@ -123,7 +123,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.Attributes.Append(end);
XmlAttribute text = xml.CreateAttribute("Title");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.Attributes.Append(text);
xml.DocumentElement.AppendChild(paragraph);

View File

@ -43,7 +43,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
//0003 00:00:28:16 00:00:31:04 Jeg vil lære jer frygten for HERREN." (newline is \t)
sb.AppendLine(string.Format("{0:0000}\t{1}\t{2}\t{3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "\t")));
sb.AppendLine(string.Format("{0:0000}\t{1}\t{2}\t{3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "\t")));
index++;
}
return sb.ToString();

View File

@ -96,7 +96,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
// Replace remaining italics tags
text = text.Replace("<i>", @"[");
text = text.Replace("</i>", @"]");
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
}
// Add top-position SoftNI marker "}" at the beginning of first line.

View File

@ -96,7 +96,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
// Replace remaining italics tags
text = text.Replace("<i>", @"[");
text = text.Replace("</i>", @"]");
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
}
// Add top-position SoftNI marker "}" at the beginning of first line.

View File

@ -41,7 +41,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
int index = 0;
foreach (Paragraph p in subtitle.Paragraphs)
{
sb.AppendLine(string.Format("{0:0000}\t{1}\t{2}\t{3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "\t")));
sb.AppendLine(string.Format("{0:0000}\t{1}\t{2}\t{3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "\t")));
index++;
}
return sb.ToString();

View File

@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
//0001 00:49:26:22 00:49:27:13 t01_v001c001_22_0001.bmp
sb.AppendLine(string.Format("{0:0000} {1} {2} {3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "\t")));
sb.AppendLine(string.Format("{0:0000} {1} {2} {3}", index + 1, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(p.Text).Replace(Environment.NewLine, "\t")));
index++;
}
return sb.ToString();

View File

@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
text = text.Replace(Environment.NewLine, "\r");
sb.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3:00} - {4:00}:{5:00}:{6:00}:{7:00} \t{8}",
p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10,

View File

@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
text = text.Replace(Environment.NewLine, "\r");
sb.AppendLine(string.Format("{0:00}:{1:00}:{2:00}.{3:000}\t{4:00}:{5:00}:{6:00}.{7:000}\t{8:00}:{9:00}:{10:00}.{11:000}\t{12}",
p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds,

View File

@ -51,7 +51,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
count++;
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
sb.AppendLine(string.Format("{13}\t{0:00}:{1:00}:{2:00}:{3:00}\t{4:00}:{5:00}:{6:00}:{7:00}\t{8:00}:{9:00}:{10:00}:{11:00}\r\n{12}" + Environment.NewLine,
p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds),
p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, MillisecondsToFramesMaxFrameRate(p.EndTime.Milliseconds),

View File

@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
text = text.Replace(Environment.NewLine, "\r");
sb.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3:00}\t{4:00}:{5:00}:{6:00}:{7:00}\t{8}",
p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10,

View File

@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
text = text.Replace(Environment.NewLine, "\r");
sb.AppendLine(string.Format("{9:0000} {0:00}:{1:00}:{2:00}:{3:00} {4:00}:{5:00}:{6:00}:{7:00} \t{8}" + Environment.NewLine,
p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10,

View File

@ -67,7 +67,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
sb.AppendFormat(header, title);
foreach (Paragraph p in subtitle.Paragraphs)
{
string text = Utilities.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "|"));
string text = HtmlUtil.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "|"));
sb.AppendLine(string.Format(paragraphWriteFormat,
p.StartTime.Hours,

View File

@ -123,7 +123,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
style.InnerText = "Default";
paragraph.Attributes.Append(style);
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
XmlAttribute textNode = xml.CreateAttribute("text");
textNode.InnerText = text;
paragraph.Attributes.Append(textNode);

View File

@ -73,7 +73,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
string startTime = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, MillisecondsToFramesMaxFrameRate(p.StartTime.Milliseconds));
string duration = string.Format("{0:00}:{1:00}", p.Duration.Seconds, MillisecondsToFramesMaxFrameRate(p.Duration.Milliseconds));
sb.AppendLine(string.Format(paragraphWriteFormat, startTime, duration, Utilities.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, " ")), count));
sb.AppendLine(string.Format(paragraphWriteFormat, startTime, duration, HtmlUtil.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, " ")), count));
sb.AppendLine();
sb.AppendLine();
count++;

View File

@ -58,7 +58,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
var sb = new StringBuilder();
foreach (Paragraph p in subtitle.Paragraphs)
{
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
text = text.Replace(Environment.NewLine, "|");
sb.AppendLine(string.Format("{0:00}:{1:00}:{2:00}:{3}", p.StartTime.Hours,
p.StartTime.Minutes,

View File

@ -55,7 +55,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.AppendChild(end);
XmlNode text = xml.CreateElement("Text");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.AppendChild(text);
xml.DocumentElement.AppendChild(paragraph);

View File

@ -59,7 +59,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.AppendChild(duration);
XmlNode text = xml.CreateElement("Text");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.AppendChild(text);
xml.DocumentElement.AppendChild(paragraph);

View File

@ -102,7 +102,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
//string text = p.Text.Replace("<i>", "@iSTART__").Replace("</i>", "@iEND__");
string text = p.Text.Replace(Environment.NewLine, "\n").Replace("\n", "@iNEWLINE__");
text = Utilities.RemoveHtmlTags(text);
text = HtmlUtil.RemoveHtmlTags(text);
paragraph.InnerText = text;
paragraph.InnerXml = paragraph.InnerXml.Replace("@iNEWLINE__", "<br />");
//paragraph.InnerXml = paragraph.InnerXml.Replace("@iSTART__", "<i>").Replace("@iEND__", "</i>");

View File

@ -100,7 +100,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
foreach (Paragraph p in subtitle.Paragraphs)
{
XmlNode paragraph = xml.CreateElement("p", "http://www.w3.org/2006/04/ttaf1");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
bool first = true;
foreach (string line in text.SplitToLines())

View File

@ -48,7 +48,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
text = text.Replace("<i>", "@Italic@");
text = text.Replace("</i>", "@Italic@");
text = text.Replace(Environment.NewLine, "//");
sb.AppendLine(string.Format("{0},\t{1},\t{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), Utilities.RemoveHtmlTags(text)));
sb.AppendLine(string.Format("{0},\t{1},\t{2}", EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), HtmlUtil.RemoveHtmlTags(text)));
}
return sb.ToString();
}

View File

@ -59,7 +59,7 @@ ATTENTION : Pas plus de 40 caractères PAR LIGNE
foreach (Paragraph p in subtitle.Paragraphs)
{
index++;
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
sb.AppendLine(string.Format("* {0} :\t{1}\t{2}\t{3}{4}{5}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), GetMaxCharsForDuration(p.Duration.TotalSeconds) + "c", Environment.NewLine, text));
sb.AppendLine();
if (!text.Contains(Environment.NewLine))

View File

@ -25,7 +25,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
XmlNode paragraph = xml.CreateElement("SubtitleItem");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.InnerText = text;
paragraph.InnerXml = "<Text><![CDATA[" + paragraph.InnerXml.Replace(Environment.NewLine, "\\n") + "\\n]]></Text>";

View File

@ -236,7 +236,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
XmlNode paragraph = xml.CreateElement("SubtitleItem");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.InnerText = text;
paragraph.InnerXml = "<Text><![CDATA[" + paragraph.InnerXml.Replace(Environment.NewLine, "\\n") + "]]></Text>";

View File

@ -57,7 +57,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
//How much in there? -
//Three...
sb.AppendLine(string.Format("#{0} {1} {2}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime)));
sb.AppendLine(Utilities.RemoveHtmlTags(p.Text));
sb.AppendLine(HtmlUtil.RemoveHtmlTags(p.Text));
index++;
}
sb.AppendLine(string.Format(Footer, subtitle.Paragraphs.Count));

View File

@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
int skipCount = 0;
int numberOfNewLines = Utilities.CountTagInText(p.Text, Environment.NewLine);
bool italic = p.Text.StartsWith("<i>") && p.Text.EndsWith("</i>");
string text = Utilities.RemoveHtmlTags(p.Text);
string text = HtmlUtil.RemoveHtmlTags(p.Text);
if (italic)
{
sb.Append(Convert.ToChar(0x11));

View File

@ -77,7 +77,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
paragraph.Attributes.Append(stop);
XmlNode text = xml.CreateElement("text");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
text.InnerText = HtmlUtil.RemoveHtmlTags(p.Text);
paragraph.AppendChild(text);
XmlAttribute style = xml.CreateAttribute("style");

View File

@ -137,7 +137,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
if (line.Contains("</u>"))
underlineOn = false;
lineSb.Append(Utilities.RemoveHtmlTags(line));
lineSb.Append(HtmlUtil.RemoveHtmlTags(line));
count++;
}
string text = lineSb.ToString();
@ -148,7 +148,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
text = "{Y:b}" + text.Replace("{y:b}", string.Empty);
else if (noOfLines > 1 && Utilities.CountTagInText(text, "{y:u}") == noOfLines)
text = "{Y:u}" + text.Replace("{y:u}", string.Empty);
sb.AppendLine(Utilities.RemoveHtmlTags(text));
sb.AppendLine(HtmlUtil.RemoveHtmlTags(text));
}
return sb.ToString().Trim();
}

Some files were not shown because too many files have changed in this diff Show More