mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 15:02:35 +01:00
commit
6c6c847f26
@ -1820,7 +1820,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
var currentLengthInSeconds = XPositionToSeconds(i - begin) - StartPositionSeconds;
|
||||
if (currentLengthInSeconds > 1.0)
|
||||
{
|
||||
subtitleOn = EndParagraphDueToLowVolume(silenceThresshold, begin, subtitleOn, i);
|
||||
subtitleOn = EndParagraphDueToLowVolume(silenceThresshold, begin, true, i);
|
||||
if (!subtitleOn)
|
||||
{
|
||||
begin = i + minBetween;
|
||||
@ -1831,7 +1831,7 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
{
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
subtitleOn = EndParagraphDueToLowVolume(silenceThresshold, begin, subtitleOn, i + (j * length50Ms));
|
||||
subtitleOn = EndParagraphDueToLowVolume(silenceThresshold, begin, true, i + (j * length50Ms));
|
||||
if (!subtitleOn)
|
||||
{
|
||||
i += (j * length50Ms);
|
||||
|
@ -19,11 +19,11 @@ namespace Nikse.SubtitleEdit.Controls
|
||||
public SETextBox()
|
||||
{
|
||||
AllowDrop = true;
|
||||
DragEnter += new DragEventHandler(SETextBox_DragEnter);
|
||||
// DragOver += new DragEventHandler(SETextBox_DragOver); could draw some gfx where drop position is...
|
||||
DragDrop += new DragEventHandler(SETextBox_DragDrop);
|
||||
MouseDown += new MouseEventHandler(SETextBox_MouseDown);
|
||||
MouseUp += new MouseEventHandler(SETextBox_MouseUp);
|
||||
DragEnter += SETextBox_DragEnter;
|
||||
//DragOver += SETextBox_DragOver; could draw some gfx where drop position is...
|
||||
DragDrop += SETextBox_DragDrop;
|
||||
MouseDown += SETextBox_MouseDown;
|
||||
MouseUp += SETextBox_MouseUp;
|
||||
KeyDown += SETextBox_KeyDown;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var waveFile = new WavePeakGenerator(targetFile);
|
||||
|
||||
int sampleRate = Configuration.Settings.VideoControls.WaveFormMininumSampleRate; // Normally 128
|
||||
while (!(waveFile.Header.SampleRate % sampleRate == 0) && sampleRate < 5000)
|
||||
while (waveFile.Header.SampleRate % sampleRate != 0 && sampleRate < 5000)
|
||||
sampleRate++; // old sample-rate / new sample-rate must have rest = 0
|
||||
|
||||
labelProgress.Text = Configuration.Settings.Language.AddWaveForm.GeneratingPeakFile;
|
||||
|
@ -30,7 +30,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
/// <summary>
|
||||
/// Summary description for ColorChooser.
|
||||
/// </summary>
|
||||
public class ColorChooser : Form, IDisposable
|
||||
public class ColorChooser : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -753,7 +753,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
base.Dispose(true);
|
||||
if (myColorWheel != null)
|
||||
{
|
||||
myColorWheel.Dispose();
|
||||
|
@ -896,7 +896,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
double factor = (1000.0 / Configuration.Settings.General.CurrentFrameRate);
|
||||
string startTime = string.Format(timeFormat, param.P.StartTime.Hours, param.P.StartTime.Minutes, param.P.StartTime.Seconds, (int)Math.Round(param.P.StartTime.Milliseconds / factor));
|
||||
string endTime = string.Format(timeFormat, param.P.EndTime.Hours, param.P.EndTime.Minutes, param.P.EndTime.Seconds, (int)Math.Round(param.P.EndTime.Milliseconds / factor));
|
||||
sb.Append(string.Format(paragraphWriteFormat, startTime, endTime, fileName));
|
||||
sb.AppendFormat(paragraphWriteFormat, startTime, endTime, fileName);
|
||||
|
||||
param.Saved = true;
|
||||
}
|
||||
@ -1481,7 +1481,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
lastText.Append(sb.ToString());
|
||||
lastText.Append(sb);
|
||||
TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint);
|
||||
}
|
||||
if (path.PointCount > 0)
|
||||
@ -2444,7 +2444,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
|
||||
checkBoxSimpleRender.Text = Configuration.Settings.Language.ExportPngXml.SimpleRendering;
|
||||
checkBoxTransAntiAliase.Text = Configuration.Settings.Language.ExportPngXml.AntiAliasingWithTransparency;
|
||||
|
||||
normalToolStripMenuItem.Text = Configuration.Settings.Language.Main.Menu.ContextMenu.Normal; ;
|
||||
normalToolStripMenuItem.Text = Configuration.Settings.Language.Main.Menu.ContextMenu.Normal;
|
||||
italicToolStripMenuItem.Text = Configuration.Settings.Language.General.Italic;
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.ExportPngXml.BoxSingleLine)) //TODO: Remove in SE 3.4
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (showTimecodes)
|
||||
{
|
||||
if (timeCodeSrt)
|
||||
sb.Append(p.StartTime.ToString() + timeCodeSeperator + p.EndTime.ToString());
|
||||
sb.Append(p.StartTime + timeCodeSeperator + p.EndTime);
|
||||
else if (timeCodeHHMMSSFF)
|
||||
sb.Append(p.StartTime.ToHHMMSSFF() + timeCodeSeperator + p.EndTime.ToHHMMSSFF());
|
||||
else
|
||||
|
@ -883,7 +883,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
string oldCurrent = p.ToString();
|
||||
if (next != null && next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
|
||||
if (next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
|
||||
p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds;
|
||||
|
||||
@ -937,7 +937,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (diffMs < 1000 &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime &&
|
||||
p.StartTime.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds &&
|
||||
next != null &&
|
||||
(nextNext == null || next.EndTime.TotalMilliseconds + diffMs + Configuration.Settings.General.MininumMillisecondsBetweenLines * 2 < nextNext.StartTime.TotalMilliseconds))
|
||||
{
|
||||
if (AllowFix(p, fixAction))
|
||||
@ -956,8 +955,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
// Make next subtitle duration shorter + make current subtitle duration longer
|
||||
else if (diffMs < 1000 &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime &&
|
||||
next != null && Utilities.GetCharactersPerSecond(new Paragraph(next.Text, p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines, next.EndTime.TotalMilliseconds)) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && Utilities.GetCharactersPerSecond(new Paragraph(next.Text, p.StartTime.TotalMilliseconds + temp.Duration.TotalMilliseconds + Configuration.Settings.General.MininumMillisecondsBetweenLines, next.EndTime.TotalMilliseconds)) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
{
|
||||
if (AllowFix(p, fixAction))
|
||||
{
|
||||
@ -973,8 +971,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
// Make next-next subtitle duration shorter + move next + make current subtitle duration longer
|
||||
else if (diffMs < 500 &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime &&
|
||||
next != null && nextNext != null &&
|
||||
Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime && nextNext != null &&
|
||||
Utilities.GetCharactersPerSecond(new Paragraph(nextNext.Text, nextNext.StartTime.TotalMilliseconds + diffMs + Configuration.Settings.General.MininumMillisecondsBetweenLines, nextNext.EndTime.TotalMilliseconds - (diffMs))) < Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds)
|
||||
{
|
||||
if (AllowFix(p, fixAction))
|
||||
@ -2052,7 +2049,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (IsOneLineUrl(p.Text) || p.Text.Contains("♪") || p.Text.Contains("♫") || p.Text.EndsWith("'", StringComparison.Ordinal))
|
||||
{
|
||||
; // ignore urls
|
||||
// ignore urls
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(nextText) && next != null &&
|
||||
next.Text.Length > 0 &&
|
||||
@ -4206,7 +4203,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string trimmedStart = p.Text.TrimStart(("- ").ToCharArray());
|
||||
if (last != null && last.Text.EndsWith("...", StringComparison.Ordinal) && trimmedStart.Length > 0 && trimmedStart[0].ToString() == trimmedStart[0].ToString().ToLower())
|
||||
wasLastLineClosed = false;
|
||||
if (!wasLastLineClosed && last != null && last.Text == last.Text.ToUpper())
|
||||
if (!wasLastLineClosed && last.Text == last.Text.ToUpper())
|
||||
wasLastLineClosed = true;
|
||||
|
||||
string oldText = p.Text;
|
||||
@ -4489,7 +4486,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// build log
|
||||
textBoxFixedIssues.Text = string.Empty;
|
||||
if (_newLog.Length >= 0)
|
||||
textBoxFixedIssues.AppendText(_newLog.ToString() + Environment.NewLine);
|
||||
textBoxFixedIssues.AppendText(_newLog + Environment.NewLine);
|
||||
textBoxFixedIssues.AppendText(_appliedLog.ToString());
|
||||
subtitleListView1.EndUpdate();
|
||||
}
|
||||
@ -4699,15 +4696,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string s = before.Substring(i, 1);
|
||||
if (beforeColors.ContainsKey(i) && beforeBackgroundColors.ContainsKey(i))
|
||||
{
|
||||
sb.Append(string.Format("<span style=\"color:{0}; background-color: {1}\">{2}</span>", ColorTranslator.ToHtml(beforeColors[i]), ColorTranslator.ToHtml(beforeBackgroundColors[i]), s));
|
||||
sb.AppendFormat("<span style=\"color:{0}; background-color: {1}\">{2}</span>", ColorTranslator.ToHtml(beforeColors[i]), ColorTranslator.ToHtml(beforeBackgroundColors[i]), s);
|
||||
}
|
||||
else if (beforeColors.ContainsKey(i))
|
||||
{
|
||||
sb.Append(string.Format("<span style=\"color:{0}; \">{1}</span>", ColorTranslator.ToHtml(beforeColors[i]), s));
|
||||
sb.AppendFormat("<span style=\"color:{0}; \">{1}</span>", ColorTranslator.ToHtml(beforeColors[i]), s);
|
||||
}
|
||||
else if (beforeBackgroundColors.ContainsKey(i))
|
||||
{
|
||||
sb.Append(string.Format("<span style=\"background-color: {0}\">{1}</span>", ColorTranslator.ToHtml(beforeBackgroundColors[i]), s));
|
||||
sb.AppendFormat("<span style=\"background-color: {0}\">{1}</span>", ColorTranslator.ToHtml(beforeBackgroundColors[i]), s);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4720,15 +4717,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string s = after.Substring(i, 1);
|
||||
if (afterColors.ContainsKey(i) && afterBackgroundColors.ContainsKey(i))
|
||||
{
|
||||
sb2.Append(string.Format("<span style=\"color:{0}; background-color: {1}\">{2}</span>", ColorTranslator.ToHtml(afterColors[i]), ColorTranslator.ToHtml(afterBackgroundColors[i]), s));
|
||||
sb2.AppendFormat("<span style=\"color:{0}; background-color: {1}\">{2}</span>", ColorTranslator.ToHtml(afterColors[i]), ColorTranslator.ToHtml(afterBackgroundColors[i]), s);
|
||||
}
|
||||
else if (afterColors.ContainsKey(i))
|
||||
{
|
||||
sb2.Append(string.Format("<span style=\"color:{0}; \">{1}</span>", ColorTranslator.ToHtml(afterColors[i]), s));
|
||||
sb2.AppendFormat("<span style=\"color:{0}; \">{1}</span>", ColorTranslator.ToHtml(afterColors[i]), s);
|
||||
}
|
||||
else if (afterBackgroundColors.ContainsKey(i))
|
||||
{
|
||||
sb2.Append(string.Format("<span style=\"background-color: {0}\">{1}</span>", ColorTranslator.ToHtml(afterBackgroundColors[i]), s));
|
||||
sb2.AppendFormat("<span style=\"background-color: {0}\">{1}</span>", ColorTranslator.ToHtml(afterBackgroundColors[i]), s);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string url = _dictionaryDownloadLinks[index];
|
||||
|
||||
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
||||
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
|
||||
wc.DownloadDataCompleted += wc_DownloadDataCompleted;
|
||||
wc.DownloadDataAsync(new Uri(url));
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string url = _dictionaryDownloadLinks[index];
|
||||
|
||||
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
||||
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
|
||||
wc.DownloadDataCompleted += wc_DownloadDataCompleted;
|
||||
wc.DownloadDataAsync(new Uri(url));
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
{
|
||||
string text = string.Format("{1} {0} |", p.Text.Replace("|", _newlineString), _splitterString);
|
||||
if (Utilities.UrlEncode(sb.ToString() + text).Length >= textMaxSize)
|
||||
if (Utilities.UrlEncode(sb + text).Length >= textMaxSize)
|
||||
{
|
||||
FillTranslatedText(DoTranslate(sb.ToString()), start, index - 1);
|
||||
sb = new StringBuilder();
|
||||
@ -392,7 +392,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
/// <summary>
|
||||
/// Translate Text using Google Translate API's
|
||||
/// Google URL - http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}
|
||||
/// Google URL - http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}
|
||||
/// </summary>
|
||||
/// <param name="input">Input string</param>
|
||||
/// <param name="languagePair">2 letter Language Pair, delimited by "|".
|
||||
@ -898,7 +898,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string text = string.Format("{1}{0}|", p.Text, _splitterString);
|
||||
if (!overQuota)
|
||||
{
|
||||
if ((Utilities.UrlEncode(sb.ToString() + text)).Length >= textMaxSize)
|
||||
if ((Utilities.UrlEncode(sb + text)).Length >= textMaxSize)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -250,8 +250,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
ms.Position = 0;
|
||||
bmp = ((Bitmap)Bitmap.FromStream(ms)); // avoid locking file
|
||||
}
|
||||
if (bmp != null)
|
||||
pictureBox2.Image = bmp;
|
||||
pictureBox2.Image = bmp;
|
||||
System.Threading.Thread.Sleep(50);
|
||||
File.Delete(fileName);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (sub.Header != null)
|
||||
header = sub.Header;
|
||||
|
||||
if (lastFormat == null || (lastFormat != null && lastFormat.FriendlyName == format.FriendlyName))
|
||||
if (lastFormat == null || lastFormat.FriendlyName == format.FriendlyName)
|
||||
lastFormat = format;
|
||||
else
|
||||
lastFormat = new Logic.SubtitleFormats.SubRip(); // default subtitle format
|
||||
|
@ -5,6 +5,7 @@ using Nikse.SubtitleEdit.Logic.Enums;
|
||||
using Nikse.SubtitleEdit.Logic.Networking;
|
||||
using Nikse.SubtitleEdit.Logic.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VideoFormats;
|
||||
using Nikse.SubtitleEdit.Logic.VideoPlayers;
|
||||
using Nikse.SubtitleEdit.Logic.VobSub;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -392,7 +393,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int index = 0;
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
{
|
||||
if (tc == p.StartTime.ToString() + " --> " + p.EndTime.ToString())
|
||||
if (tc == p.StartTime + " --> " + p.EndTime)
|
||||
{
|
||||
SubtitleListview1.SelectNone();
|
||||
SubtitleListview1.Items[0].Selected = false;
|
||||
@ -754,11 +755,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (x.CodecId.ToUpper() == "S_VOBSUB")
|
||||
{
|
||||
Console.WriteLine(string.Format("{0}: {1} - Cannot convert from VobSub image based format!", fileName, toFormat));
|
||||
Console.WriteLine("{0}: {1} - Cannot convert from VobSub image based format!", fileName, toFormat);
|
||||
}
|
||||
else if (x.CodecId.ToUpper() == "S_HDMV/PGS")
|
||||
{
|
||||
Console.WriteLine(string.Format("{0}: {1} - Cannot convert from Blu-ray image based format!", fileName, toFormat));
|
||||
Console.WriteLine("{0}: {1} - Cannot convert from Blu-ray image based format!", fileName, toFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -923,9 +924,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (format == null)
|
||||
{
|
||||
if (fi.Length < 1024 * 1024) // max 1 mb
|
||||
Console.WriteLine(string.Format("{0}: {1} - input file format unknown!", fileName, toFormat));
|
||||
Console.WriteLine("{0}: {1} - input file format unknown!", fileName, toFormat);
|
||||
else
|
||||
Console.WriteLine(string.Format("{0}: {1} - input file too large!", fileName, toFormat));
|
||||
Console.WriteLine("{0}: {1} - input file too large!", fileName, toFormat);
|
||||
}
|
||||
else if (!done)
|
||||
{
|
||||
@ -934,7 +935,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(string.Format("{0}: {1} - file not found!", count, fileName));
|
||||
Console.WriteLine("{0}: {1} - file not found!", count, fileName);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
@ -947,7 +948,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(string.Format("{0} file(s) converted", converted));
|
||||
Console.WriteLine("{0} file(s) converted", converted);
|
||||
Console.WriteLine();
|
||||
Console.Write(currentDir + ">");
|
||||
|
||||
@ -992,7 +993,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
targetFormatFound = true;
|
||||
sf.BatchMode = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, sf.Extension, outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
if (sf.IsFrameBased && !sub.WasLoadedWithFrameNumbers)
|
||||
sub.CalculateFrameNumbersFromTimeCodesNoCheck(Configuration.Settings.General.CurrentFrameRate);
|
||||
else if (sf.IsTimeBased && sub.WasLoadedWithFrameNumbers)
|
||||
@ -1050,7 +1051,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
targetFormatFound = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, ebu.Extension, outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
Ebu.Save(outputFileName, sub, true);
|
||||
Console.WriteLine(" done.");
|
||||
}
|
||||
@ -1065,7 +1066,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
pac.CodePage = Convert.ToInt32(pacCodePage);
|
||||
targetFormatFound = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, pac.Extension, outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
pac.Save(outputFileName, sub);
|
||||
Console.WriteLine(" done.");
|
||||
}
|
||||
@ -1077,7 +1078,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
targetFormatFound = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, cavena890.Extension, outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
cavena890.Save(outputFileName, sub);
|
||||
Console.WriteLine(" done.");
|
||||
}
|
||||
@ -1089,7 +1090,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
targetFormatFound = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, cheetahCaption.Extension, outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
CheetahCaption.Save(outputFileName, sub);
|
||||
Console.WriteLine(" done.");
|
||||
}
|
||||
@ -1101,7 +1102,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
targetFormatFound = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, capMakerPlus.Extension, outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
CapMakerPlus.Save(outputFileName, sub);
|
||||
Console.WriteLine(" done.");
|
||||
}
|
||||
@ -1112,14 +1113,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
targetFormatFound = true;
|
||||
outputFileName = FormatOutputFileNameForBatchConvert(fileName, ".txt", outputFolder, overwrite);
|
||||
Console.Write(string.Format("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName));
|
||||
Console.Write("{0}: {1} -> {2}...", count, Path.GetFileName(fileName), outputFileName);
|
||||
File.WriteAllText(outputFileName, ExportText.GeneratePlainText(sub, false, false, false, false, false, false, string.Empty, true, false, true, true, false), targetEncoding);
|
||||
Console.WriteLine(" done.");
|
||||
}
|
||||
}
|
||||
if (!targetFormatFound)
|
||||
{
|
||||
Console.WriteLine(string.Format("{0}: {1} - target format '{2}' not found!", count, fileName, toFormat));
|
||||
Console.WriteLine("{0}: {1} - target format '{2}' not found!", count, fileName, toFormat);
|
||||
errors++;
|
||||
return false;
|
||||
}
|
||||
@ -5281,7 +5282,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (format != null)
|
||||
{
|
||||
if (subtitleToAppend != null && subtitleToAppend.Paragraphs.Count > 1)
|
||||
if (subtitleToAppend.Paragraphs.Count > 1)
|
||||
{
|
||||
var visualSync = new VisualSync();
|
||||
visualSync.Initialize(toolStripButtonVisualSync.Image as Bitmap, subtitleToAppend, _fileName, _language.AppendViaVisualSyncTitle, CurrentFrameRate);
|
||||
@ -7714,13 +7715,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentParagraph != null && newParagraph != null)
|
||||
{
|
||||
if (currentParagraph.Text.StartsWith("<i> "))
|
||||
currentParagraph.Text = currentParagraph.Text.Remove(3, 1);
|
||||
if (newParagraph.Text.StartsWith("<i> "))
|
||||
newParagraph.Text = newParagraph.Text.Remove(3, 1);
|
||||
}
|
||||
if (currentParagraph.Text.StartsWith("<i> "))
|
||||
currentParagraph.Text = currentParagraph.Text.Remove(3, 1);
|
||||
if (newParagraph.Text.StartsWith("<i> "))
|
||||
newParagraph.Text = newParagraph.Text.Remove(3, 1);
|
||||
|
||||
double startFactor = 0;
|
||||
double middle = currentParagraph.StartTime.TotalMilliseconds + (currentParagraph.Duration.TotalMilliseconds / 2);
|
||||
@ -8502,7 +8500,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (_subtitleListViewIndex >= 0)
|
||||
{
|
||||
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.StarTimeAdjustedX, "#" + (_subtitleListViewIndex + 1).ToString() + ": " + timeUpDownStartTime.TimeCode.ToString()));
|
||||
MakeHistoryForUndoOnlyIfNotResent(string.Format(_language.StarTimeAdjustedX, "#" + (_subtitleListViewIndex + 1) + ": " + timeUpDownStartTime.TimeCode));
|
||||
|
||||
int firstSelectedIndex = FirstSelectedIndex;
|
||||
Paragraph oldParagraph = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
@ -8655,7 +8653,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Paragraph p = _subtitle.GetParagraphOrDefault(FirstSelectedIndex);
|
||||
if (p != null)
|
||||
{
|
||||
string tc = p.StartTime.ToString() + " --> " + p.EndTime.ToString();
|
||||
string tc = p.StartTime + " --> " + p.EndTime;
|
||||
int start = textBoxSource.Text.IndexOf(tc);
|
||||
if (start > 0)
|
||||
{
|
||||
@ -8719,7 +8717,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int index = 0;
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
{
|
||||
if (tc == p.StartTime.ToString() + " --> " + p.EndTime.ToString())
|
||||
if (tc == p.StartTime + " --> " + p.EndTime)
|
||||
{
|
||||
SubtitleListview1.SelectIndexAndEnsureVisible(index, true);
|
||||
break;
|
||||
@ -9537,7 +9535,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
catch (Exception exception)
|
||||
{
|
||||
var tc = new TimeCode(p.StartMilliseconds);
|
||||
lastError = tc.ToString() + ": " + exception.Message + ": " + exception.StackTrace;
|
||||
lastError = tc + ": " + exception.Message + ": " + exception.StackTrace;
|
||||
noOfErrors++;
|
||||
}
|
||||
finally
|
||||
@ -9797,7 +9795,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (!ascii)
|
||||
{
|
||||
text += " "; /// (char)active_set[32];
|
||||
text += " "; // (char)active_set[32];
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -11575,7 +11573,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (_subtitle.Paragraphs[index].StartTime.TotalMilliseconds + 100 > tc.TotalMilliseconds || offset > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
|
||||
return;
|
||||
|
||||
MakeHistoryForUndo(_language.BeforeSetEndTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc.ToString());
|
||||
MakeHistoryForUndo(_language.BeforeSetEndTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc);
|
||||
|
||||
numericUpDownDuration.ValueChanged -= NumericUpDownDurationValueChanged;
|
||||
_subtitle.Paragraphs[index].EndTime.TotalSeconds = videoPosition;
|
||||
@ -11833,7 +11831,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else
|
||||
sb.AppendLine("- " + line);
|
||||
}
|
||||
string text = sb.ToString().Trim(); ;
|
||||
string text = sb.ToString().Trim();
|
||||
_subtitle.Paragraphs[index].Text = text;
|
||||
SubtitleListview1.SetText(index, text);
|
||||
if (index == _subtitleListViewIndex)
|
||||
@ -11857,7 +11855,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else
|
||||
sb.AppendLine(line);
|
||||
}
|
||||
string text = sb.ToString().Trim(); ;
|
||||
string text = sb.ToString().Trim();
|
||||
_subtitle.Paragraphs[index].Text = text;
|
||||
SubtitleListview1.SetText(index, text);
|
||||
if (index == _subtitleListViewIndex)
|
||||
@ -11958,7 +11956,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
InsertAfter();
|
||||
textBoxListViewText.Text = p.Text;
|
||||
if (lastParagraph != null && lastTempParagraph != null)
|
||||
if (lastParagraph != null)
|
||||
{
|
||||
double millisecondsBetween = p.StartTime.TotalMilliseconds - lastTempParagraph.EndTime.TotalMilliseconds;
|
||||
timeUpDownStartTime.TimeCode = new TimeCode(lastParagraph.EndTime.TotalMilliseconds + millisecondsBetween);
|
||||
@ -12851,9 +12849,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
|
||||
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
Encoding encoding = null;
|
||||
Encoding encoding;
|
||||
Subtitle timeCodeSubtitle = new Subtitle();
|
||||
SubtitleFormat format = timeCodeSubtitle.LoadSubtitle(openFileDialog1.FileName, out encoding, encoding);
|
||||
SubtitleFormat format = timeCodeSubtitle.LoadSubtitle(openFileDialog1.FileName, out encoding, null);
|
||||
if (format == null)
|
||||
{
|
||||
ShowUnknownSubtitle();
|
||||
@ -12934,7 +12932,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
openFileDialog1.Title = Configuration.Settings.Language.General.OpenOriginalSubtitleFile;
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
|
||||
if (!(openFileDialog1.ShowDialog(this) == DialogResult.OK))
|
||||
if (openFileDialog1.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (!LoadAlternateSubtitleFile(openFileDialog1.FileName))
|
||||
@ -13815,7 +13813,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
videoPositionInMilliseconds -= Configuration.Settings.General.SetStartEndHumanDelay;
|
||||
|
||||
var tc = new TimeCode(videoPositionInMilliseconds);
|
||||
MakeHistoryForUndo(_language.BeforeInsertSubtitleAtVideoPosition + " " + tc.ToString());
|
||||
MakeHistoryForUndo(_language.BeforeInsertSubtitleAtVideoPosition + " " + tc);
|
||||
|
||||
// find index where to insert
|
||||
int index = 0;
|
||||
@ -14005,7 +14003,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public void ShowEarlierOrLater(double adjustMilliseconds, SelectionChoice selection)
|
||||
{
|
||||
var tc = new TimeCode(adjustMilliseconds);
|
||||
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater + ": " + tc.ToString());
|
||||
MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater + ": " + tc);
|
||||
if (adjustMilliseconds < 0)
|
||||
{
|
||||
if (selection == SelectionChoice.AllLines)
|
||||
@ -14464,7 +14462,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var tc = TimeCode.FromSeconds(videoPosition);
|
||||
timeUpDownStartTime.TimeCode = tc;
|
||||
|
||||
MakeHistoryForUndo(_language.BeforeSetStartTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc.ToString());
|
||||
MakeHistoryForUndo(_language.BeforeSetStartTimeAndOffsetTheRest + " " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc);
|
||||
|
||||
double offset = _subtitle.Paragraphs[index].StartTime.TotalMilliseconds - tc.TotalMilliseconds;
|
||||
|
||||
@ -14532,7 +14530,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string oldDuration = _subtitle.Paragraphs[index].Duration.ToString();
|
||||
var temp = new Paragraph(_subtitle.Paragraphs[index]);
|
||||
temp.EndTime.TotalMilliseconds = TimeCode.FromSeconds(videoPosition).TotalMilliseconds;
|
||||
MakeHistoryForUndo(string.Format(_language.DisplayTimeAdjustedX, "#" + _subtitle.Paragraphs[index].Number + ": " + oldDuration + " -> " + temp.Duration.ToString()));
|
||||
MakeHistoryForUndo(string.Format(_language.DisplayTimeAdjustedX, "#" + _subtitle.Paragraphs[index].Number + ": " + oldDuration + " -> " + temp.Duration));
|
||||
_makeHistoryPaused = true;
|
||||
|
||||
if (_subtitle.Paragraphs[index].StartTime.IsMaxTime)
|
||||
@ -16943,9 +16941,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
MakeHistoryForUndo(string.Format(_language.BeforeInsertLine, openFileDialog1.FileName));
|
||||
|
||||
Encoding encoding = null;
|
||||
Encoding encoding;
|
||||
var subtitle = new Subtitle();
|
||||
SubtitleFormat format = subtitle.LoadSubtitle(openFileDialog1.FileName, out encoding, encoding);
|
||||
SubtitleFormat format = subtitle.LoadSubtitle(openFileDialog1.FileName, out encoding, null);
|
||||
|
||||
if (format != null)
|
||||
{
|
||||
@ -17048,9 +17046,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
setVideoOffsetToolStripMenuItem.Visible = !string.IsNullOrEmpty(_videoFileName) && Configuration.Settings.General.ShowBetaStuff;
|
||||
|
||||
toolStripMenuItemSetAudioTrack.Visible = false;
|
||||
if (mediaPlayer.VideoPlayer != null && mediaPlayer.VideoPlayer is Logic.VideoPlayers.LibVlcDynamic)
|
||||
var libVlc = mediaPlayer.VideoPlayer as LibVlcDynamic;
|
||||
if (libVlc != null)
|
||||
{
|
||||
var libVlc = (Logic.VideoPlayers.LibVlcDynamic)mediaPlayer.VideoPlayer;
|
||||
int numberOfTracks = libVlc.AudioTrackCount;
|
||||
_videoAudioTrackNumber = libVlc.AudioTrackNumber;
|
||||
if (numberOfTracks > 1)
|
||||
@ -17080,9 +17078,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void ChooseAudioTrack(object sender, EventArgs e)
|
||||
{
|
||||
if (mediaPlayer.VideoPlayer != null && mediaPlayer.VideoPlayer is Logic.VideoPlayers.LibVlcDynamic)
|
||||
var libVlc = mediaPlayer.VideoPlayer as LibVlcDynamic;
|
||||
if (libVlc != null)
|
||||
{
|
||||
var libVlc = (Logic.VideoPlayers.LibVlcDynamic)mediaPlayer.VideoPlayer;
|
||||
var item = sender as ToolStripItem;
|
||||
|
||||
int number = int.Parse(item.Text);
|
||||
@ -17387,7 +17385,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
double totalMillisecondsEnd = mediaPlayer.CurrentPosition * 1000.0;
|
||||
|
||||
var tc = new TimeCode(totalMillisecondsEnd - durationTotalMilliseconds);
|
||||
MakeHistoryForUndo(_language.BeforeSetEndAndVideoPosition + " " + tc.ToString());
|
||||
MakeHistoryForUndo(_language.BeforeSetEndAndVideoPosition + " " + tc);
|
||||
_makeHistoryPaused = true;
|
||||
|
||||
if (p.StartTime.IsMaxTime)
|
||||
@ -19191,9 +19189,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
Encoding encoding = null;
|
||||
Encoding encoding;
|
||||
var tmp = new Subtitle();
|
||||
SubtitleFormat format = tmp.LoadSubtitle(openFileDialog1.FileName, out encoding, encoding);
|
||||
SubtitleFormat format = tmp.LoadSubtitle(openFileDialog1.FileName, out encoding, null);
|
||||
|
||||
if (format != null)
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
Paragraph next = subtitle.GetParagraphOrDefault(i);
|
||||
Paragraph afterNext = subtitle.GetParagraphOrDefault(i + 1);
|
||||
if (p != null && next != null)
|
||||
if (next != null)
|
||||
{
|
||||
if ((QualifiesForMerge(p, next, maxMsBetween) || (fixIncrementing && QualifiesForMergeIncrement(p, next, maxMsBetween))) && IsFixAllowed(p))
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
mergedSubtitle.Paragraphs.Add(p);
|
||||
}
|
||||
Paragraph next = subtitle.GetParagraphOrDefault(i);
|
||||
if (p != null && next != null)
|
||||
if (next != null)
|
||||
{
|
||||
if (QualifiesForMerge(p, next, maxMillisecondsBetweenLines, maxCharacters) && IsFixAllowed(p))
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
Paragraph next = subtitle.GetParagraphOrDefault(i);
|
||||
Paragraph afterNext = subtitle.GetParagraphOrDefault(i + 1);
|
||||
if (p != null && next != null)
|
||||
if (next != null)
|
||||
{
|
||||
if (QualifiesForMerge(p, next, maxMsBetween) && IsFixAllowed(p))
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
comboBoxDrive.Items.Add(drive.ToString() + " " + drive.VolumeLabel);
|
||||
comboBoxDrive.Items.Add(drive + " " + drive.VolumeLabel);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
||||
wc.Encoding = System.Text.Encoding.UTF8;
|
||||
wc.Headers.Add("Accept-Encoding", "");
|
||||
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
|
||||
wc.DownloadStringCompleted += wc_DownloadStringCompleted;
|
||||
wc.DownloadStringAsync(new Uri(url));
|
||||
}
|
||||
catch (Exception exception)
|
||||
@ -214,7 +214,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_downloadedPluginName = _pluginDoc.DocumentElement.SelectNodes("Plugin")[index].SelectSingleNode("Name").InnerText;
|
||||
|
||||
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
||||
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
|
||||
wc.DownloadDataCompleted += wc_DownloadDataCompleted;
|
||||
wc.DownloadDataAsync(new Uri(url));
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
@ -388,7 +388,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
for (int i = 0; i < _updateAllListUrls.Count; i++)
|
||||
{
|
||||
var wc = new WebClient { Proxy = Utilities.GetProxy() };
|
||||
wc.DownloadDataCompleted += new DownloadDataCompletedEventHandler(wc_DownloadDataCompleted);
|
||||
wc.DownloadDataCompleted += wc_DownloadDataCompleted;
|
||||
wc.DownloadDataAsync(new Uri(_updateAllListUrls[i]));
|
||||
}
|
||||
Cursor = Cursors.Default;
|
||||
|
@ -79,15 +79,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_left = findHelper.WindowPositionLeft;
|
||||
_top = findHelper.WindowPositionTop;
|
||||
|
||||
if (findHelper != null)
|
||||
{
|
||||
if (findHelper.FindType == FindType.RegEx)
|
||||
radioButtonRegEx.Checked = true;
|
||||
else if (findHelper.FindType == FindType.CaseSensitive)
|
||||
radioButtonCaseSensitive.Checked = true;
|
||||
else
|
||||
radioButtonNormal.Checked = true;
|
||||
}
|
||||
if (findHelper.FindType == FindType.RegEx)
|
||||
radioButtonRegEx.Checked = true;
|
||||
else if (findHelper.FindType == FindType.CaseSensitive)
|
||||
radioButtonCaseSensitive.Checked = true;
|
||||
else
|
||||
radioButtonNormal.Checked = true;
|
||||
}
|
||||
|
||||
private void ButtonReplaceClick(object sender, EventArgs e)
|
||||
|
@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (listViewBackups.SelectedItems.Count == 1)
|
||||
{
|
||||
string argument = @"/select, " + listViewBackups.SelectedItems[0].Tag.ToString();
|
||||
string argument = @"/select, " + listViewBackups.SelectedItems[0].Tag;
|
||||
System.Diagnostics.Process.Start("explorer.exe", argument);
|
||||
}
|
||||
else
|
||||
|
@ -63,7 +63,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
subtitleListView1.Fill(subtitle);
|
||||
_guess = subtitle.Paragraphs[index].StartTime.TimeSpan;
|
||||
subtitleListView1.Items[index].Selected = true;
|
||||
Text = string.Format(Configuration.Settings.Language.SetSyncPoint.Title, subtitle.Paragraphs[index].Number.ToString() + ": " + subtitle.Paragraphs[index].ToString());
|
||||
Text = string.Format(Configuration.Settings.Language.SetSyncPoint.Title, subtitle.Paragraphs[index].Number.ToString() + ": " + subtitle.Paragraphs[index]);
|
||||
labelSubtitle.Text = string.Empty;
|
||||
labelVideoFileName.Text = Configuration.Settings.Language.General.NoVideoLoaded;
|
||||
|
||||
@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
videoPlayerContainer1.Pause();
|
||||
|
||||
if (_guess != null && _guess.TotalMilliseconds > 0 && _guess.TotalMilliseconds / 1000.0 < videoPlayerContainer1.VideoPlayer.Duration)
|
||||
if (_guess.TotalMilliseconds > 0 && _guess.TotalMilliseconds / 1000.0 < videoPlayerContainer1.VideoPlayer.Duration)
|
||||
{
|
||||
videoPlayerContainer1.VideoPlayer.CurrentPosition = _guess.TotalMilliseconds / 1000.0;
|
||||
videoPlayerContainer1.RefreshProgressBar();
|
||||
|
@ -1645,11 +1645,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("This is a test!");
|
||||
|
||||
bool bold = false;
|
||||
bool italic = false;
|
||||
bool underline = false;
|
||||
var measuredWidth = TextDraw.MeasureTextWidth(font, sb.ToString(), bold) + 1;
|
||||
var measuredHeight = TextDraw.MeasureTextHeight(font, sb.ToString(), bold) + 1;
|
||||
var measuredWidth = TextDraw.MeasureTextWidth(font, sb.ToString(), false) + 1;
|
||||
var measuredHeight = TextDraw.MeasureTextHeight(font, sb.ToString(), false) + 1;
|
||||
|
||||
float left = 5;
|
||||
left = ((float)(bmp.Width - measuredWidth * 0.8 + 15) / 2);
|
||||
@ -1665,7 +1662,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
g.FillRectangle(new SolidBrush(Color.Black), left, top, measuredWidth + 3, measuredHeight + 3);
|
||||
}
|
||||
|
||||
TextDraw.DrawText(font, sf, path, sb, italic, bold, underline, left, top, ref newLine, leftMargin, ref pathPointsStart);
|
||||
TextDraw.DrawText(font, sf, path, sb, false, false, false, left, top, ref newLine, leftMargin, ref pathPointsStart);
|
||||
|
||||
int outline = (int)numericUpDownSsaOutline.Value;
|
||||
|
||||
@ -1678,7 +1675,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
sb = new StringBuilder();
|
||||
sb.Append("This is a test!");
|
||||
int pathPointsStart2 = -1;
|
||||
TextDraw.DrawText(font, sf, shadowPath, sb, italic, bold, underline, left + i + outline, top + i + outline, ref newLine, leftMargin, ref pathPointsStart2);
|
||||
TextDraw.DrawText(font, sf, shadowPath, sb, false, false, false, left + i + outline, top + i + outline, ref newLine, leftMargin, ref pathPointsStart2);
|
||||
g.FillPath(new SolidBrush(Color.FromArgb(200, Color.Black)), shadowPath);
|
||||
}
|
||||
}
|
||||
|
@ -235,11 +235,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
splittedIndexes.Add(splittedSubtitle.Paragraphs.Count + 1);
|
||||
|
||||
string p1 = Utilities.RemoveHtmlTags(newParagraph1.Text);
|
||||
bool p1Ends = false;
|
||||
if (p1.EndsWith(".") || p1.EndsWith("!") || p1.EndsWith("?") || p1.EndsWith(":") || p1.EndsWith(")") || p1.EndsWith("]") || p1.EndsWith("♪"))
|
||||
p1Ends = true;
|
||||
|
||||
if (p1Ends)
|
||||
{
|
||||
if (newParagraph1.Text.StartsWith("-") && newParagraph2.Text.StartsWith("-"))
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (s.Length > 1 && hashtable.ContainsKey(s))
|
||||
{
|
||||
int hits = int.Parse(hashtable[s].ToString());
|
||||
int hits = int.Parse(hashtable[s]);
|
||||
hits++;
|
||||
hashtable[s] = hits.ToString();
|
||||
}
|
||||
@ -209,7 +209,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (hashtable.ContainsKey(s))
|
||||
{
|
||||
int hits = int.Parse(hashtable[s].ToString());
|
||||
int hits = int.Parse(hashtable[s]);
|
||||
hits++;
|
||||
hashtable[s] = hits.ToString();
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Text = string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.Title, fileName);
|
||||
foreach (int id in tsParser.SubtitlePacketIds)
|
||||
{
|
||||
string s = string.Format(string.Format("Transport Packet Identifier (PID) = {0}, number of subtitles = {1}", id, tsParser.GetDvbSubtitles(id).Count));
|
||||
string s = string.Format("Transport Packet Identifier (PID) = {0}, number of subtitles = {1}", id, tsParser.GetDvbSubtitles(id).Count);
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.TransportStreamSubtitleChooser.PidLine))
|
||||
s = string.Format(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.PidLine, id, tsParser.GetDvbSubtitles(id).Count));
|
||||
s = string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.PidLine, id, tsParser.GetDvbSubtitles(id).Count);
|
||||
listBoxTracks.Items.Add(s);
|
||||
}
|
||||
listBoxTracks.SelectedIndex = 0;
|
||||
@ -86,9 +86,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var start = new TimeCode(sub.StartMilliseconds);
|
||||
var end = new TimeCode(sub.EndMilliseconds);
|
||||
if (string.IsNullOrEmpty(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine))
|
||||
listBoxSubtitles.Items.Add(string.Format("{0}: {1} --> {2}, {3} image(s)", i, start.ToString(), end.ToString(), sub.NumberOfImages));
|
||||
listBoxSubtitles.Items.Add(string.Format("{0}: {1} --> {2}, {3} image(s)", i, start, end, sub.NumberOfImages));
|
||||
else
|
||||
listBoxSubtitles.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine, i, start.ToString(), end.ToString(), sub.NumberOfImages));
|
||||
listBoxSubtitles.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine, i, start, end, sub.NumberOfImages));
|
||||
}
|
||||
if (list.Count > 0)
|
||||
listBoxSubtitles.SelectedIndex = 0;
|
||||
|
@ -83,7 +83,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||
labelTip.Text = _language.Tip;
|
||||
FixLargeFonts();
|
||||
timerHideSyncLabel.Tick += new EventHandler(timerHideSyncLabel_Tick);
|
||||
timerHideSyncLabel.Tick += timerHideSyncLabel_Tick;
|
||||
timerHideSyncLabel.Interval = 1000;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string name = node.InnerText;
|
||||
foreach (VobSubOcr.ImageCompareAddition a in additions)
|
||||
{
|
||||
if (name == a.Name && text != null)
|
||||
if (name == a.Name)
|
||||
{
|
||||
listBoxFileNames.Items.Add("[" + text + "] " + node.InnerText);
|
||||
_italics.Add(node.Attributes["Italic"] != null);
|
||||
|
@ -212,7 +212,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// display italic
|
||||
var sb = new StringBuilder();
|
||||
int i = 0;
|
||||
bool isItalic = false;
|
||||
float left = 5;
|
||||
if (lefts.Count > 0)
|
||||
left = lefts[0];
|
||||
@ -226,7 +225,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (text.Substring(i).StartsWith(Environment.NewLine))
|
||||
{
|
||||
TextDraw.DrawText(font, sf, path, sb, isItalic, subtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint);
|
||||
TextDraw.DrawText(font, sf, path, sb, false, subtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint);
|
||||
|
||||
top += lineHeight;
|
||||
newLine = true;
|
||||
@ -245,7 +244,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
i++;
|
||||
}
|
||||
if (sb.Length > 0)
|
||||
TextDraw.DrawText(font, sf, path, sb, isItalic, subtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint);
|
||||
TextDraw.DrawText(font, sf, path, sb, false, subtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint);
|
||||
sf.Dispose();
|
||||
|
||||
if (_borderWidth > 0)
|
||||
|
@ -1183,7 +1183,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
double newEndTime = p.StartTime.TotalMilliseconds + Configuration.Settings.VobSubOcr.DefaultMillisecondsForUnknownDurations;
|
||||
if (next == null || (newEndTime < next.StartTime.TotalMilliseconds))
|
||||
p.EndTime.TotalMilliseconds = newEndTime;
|
||||
else if (next != null)
|
||||
else
|
||||
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1;
|
||||
}
|
||||
}
|
||||
@ -2814,18 +2814,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
var cutBitmap = parentBitmap.CopyRectangle(new Rectangle(targetItem.X, minY, compareItem.Bitmap.Width, compareItem.Bitmap.Height));
|
||||
int dif = NikseBitmapImageSplitter.IsBitmapsAlike(compareItem.Bitmap, cutBitmap);
|
||||
if (dif < smallestDifference)
|
||||
if (dif < smallestDifference && (Math.Abs(target.Height - compareItem.Bitmap.Height) <= 5 || compareItem.Text != "\""))
|
||||
{
|
||||
bool allow = true;
|
||||
if (Math.Abs(target.Height - compareItem.Bitmap.Height) > 5 && compareItem.Text == "\"")
|
||||
allow = false;
|
||||
if (allow)
|
||||
{
|
||||
smallestDifference = dif;
|
||||
smallestIndex = index;
|
||||
if (dif == 0)
|
||||
break; // foreach ending
|
||||
}
|
||||
smallestDifference = dif;
|
||||
smallestIndex = index;
|
||||
if (dif == 0)
|
||||
break; // foreach ending
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3629,7 +3623,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe static int CalculateNumberOfForegroundColors(NikseBitmap nikseBitmap)
|
||||
private static int CalculateNumberOfForegroundColors(NikseBitmap nikseBitmap)
|
||||
{
|
||||
int count = 0;
|
||||
for (int y = 0; y < nikseBitmap.Height; y++)
|
||||
@ -3900,7 +3894,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int correctWords;
|
||||
int wordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(line, out correctWords);
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length == 0)
|
||||
{
|
||||
_ocrFixEngine.AutoGuessesUsed.Clear();
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
@ -3938,7 +3932,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
_tesseractOcrAutoFixes++;
|
||||
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
|
||||
LogOcrFix(listViewIndex, textWithOutFixes.ToString(), line);
|
||||
LogOcrFix(listViewIndex, textWithOutFixes, line);
|
||||
}
|
||||
|
||||
return line;
|
||||
@ -3952,65 +3946,101 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (_ocrFixEngine == null)
|
||||
LoadOcrFixEngine(null, LanguageString);
|
||||
|
||||
const string threadText = null;
|
||||
//if (_icThreadResults != null && !string.IsNullOrEmpty(_icThreadResults[listViewIndex]))
|
||||
// threadText = _icThreadResults[listViewIndex];
|
||||
|
||||
string line = string.Empty;
|
||||
if (threadText == null)
|
||||
var matches = new List<CompareMatch>();
|
||||
var parentBitmap = new NikseBitmap(bitmap);
|
||||
int minLineHeight = _binOcrLastLowercaseHeight - 3;
|
||||
if (minLineHeight < 5)
|
||||
minLineHeight = _nocrLastLowercaseHeight;
|
||||
if (minLineHeight < 5)
|
||||
minLineHeight = 6;
|
||||
List<ImageSplitterItem> list = NikseBitmapImageSplitter.SplitBitmapToLettersNew(parentBitmap, (int) numericUpDownPixelsIsSpace.Value, checkBoxRightToLeft.Checked, Configuration.Settings.VobSubOcr.TopToBottom, minLineHeight);
|
||||
int index = 0;
|
||||
bool expandSelection = false;
|
||||
bool shrinkSelection = false;
|
||||
var expandSelectionList = new List<ImageSplitterItem>();
|
||||
while (index < list.Count)
|
||||
{
|
||||
var matches = new List<CompareMatch>();
|
||||
var parentBitmap = new NikseBitmap(bitmap);
|
||||
int minLineHeight = _binOcrLastLowercaseHeight - 3;
|
||||
if (minLineHeight < 5)
|
||||
minLineHeight = _nocrLastLowercaseHeight;
|
||||
if (minLineHeight < 5)
|
||||
minLineHeight = 6;
|
||||
List<ImageSplitterItem> list = NikseBitmapImageSplitter.SplitBitmapToLettersNew(parentBitmap, (int)numericUpDownPixelsIsSpace.Value, checkBoxRightToLeft.Checked, Configuration.Settings.VobSubOcr.TopToBottom, minLineHeight);
|
||||
int index = 0;
|
||||
bool expandSelection = false;
|
||||
bool shrinkSelection = false;
|
||||
var expandSelectionList = new List<ImageSplitterItem>();
|
||||
while (index < list.Count)
|
||||
ImageSplitterItem item = list[index];
|
||||
if (expandSelection || shrinkSelection)
|
||||
{
|
||||
ImageSplitterItem item = list[index];
|
||||
if (expandSelection || shrinkSelection)
|
||||
expandSelection = false;
|
||||
if (shrinkSelection && index > 0)
|
||||
{
|
||||
expandSelection = false;
|
||||
if (shrinkSelection && index > 0)
|
||||
{
|
||||
shrinkSelection = false;
|
||||
}
|
||||
else if (index + 1 < list.Count && list[index + 1].NikseBitmap != null) // only allow expand to EndOfLine or space
|
||||
{
|
||||
shrinkSelection = false;
|
||||
}
|
||||
else if (index + 1 < list.Count && list[index + 1].NikseBitmap != null) // only allow expand to EndOfLine or space
|
||||
{
|
||||
index++;
|
||||
expandSelectionList.Add(list[index]);
|
||||
}
|
||||
item = GetExpandedSelectionNew(parentBitmap, expandSelectionList);
|
||||
|
||||
index++;
|
||||
expandSelectionList.Add(list[index]);
|
||||
}
|
||||
item = GetExpandedSelectionNew(parentBitmap, expandSelectionList);
|
||||
_vobSubOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, expandSelectionList.Count > 1, null, _lastAdditions, this);
|
||||
DialogResult result = _vobSubOcrCharacter.ShowDialog(this);
|
||||
_manualOcrDialogPosition = _vobSubOcrCharacter.FormPosition;
|
||||
if (result == DialogResult.OK && _vobSubOcrCharacter.ShrinkSelection)
|
||||
{
|
||||
shrinkSelection = true;
|
||||
index--;
|
||||
if (expandSelectionList.Count > 0)
|
||||
expandSelectionList.RemoveAt(expandSelectionList.Count - 1);
|
||||
}
|
||||
else if (result == DialogResult.OK && _vobSubOcrCharacter.ExpandSelection)
|
||||
{
|
||||
expandSelection = true;
|
||||
}
|
||||
else if (result == DialogResult.OK)
|
||||
{
|
||||
string text = _vobSubOcrCharacter.ManualRecognizedCharacters;
|
||||
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, expandSelectionList);
|
||||
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
|
||||
_lastAdditions.Add(addition);
|
||||
matches.Add(new CompareMatch(text, _vobSubOcrCharacter.IsItalic, expandSelectionList.Count, null));
|
||||
expandSelectionList = new List<ImageSplitterItem>();
|
||||
}
|
||||
else if (result == DialogResult.Abort)
|
||||
{
|
||||
_abort = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
matches.Add(new CompareMatch("*", false, 0, null));
|
||||
}
|
||||
_italicCheckedLast = _vobSubOcrCharacter.IsItalic;
|
||||
}
|
||||
else if (item.NikseBitmap == null)
|
||||
{
|
||||
matches.Add(new CompareMatch(item.SpecialCharacter, false, 0, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
CompareMatch bestGuess;
|
||||
CompareMatch match = GetCompareMatchNew(item, out bestGuess, list, index);
|
||||
if (match == null) // Try line OCR if no image compare match
|
||||
{
|
||||
if (_nOcrDb != null && _nOcrDb.OcrCharacters.Count > 0)
|
||||
match = GetNOcrCompareMatchNew(item, parentBitmap, _nOcrDb, true, true);
|
||||
}
|
||||
|
||||
_vobSubOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, expandSelectionList.Count > 1, null, _lastAdditions, this);
|
||||
if (match == null)
|
||||
{
|
||||
_vobSubOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, false, bestGuess, _lastAdditions, this);
|
||||
DialogResult result = _vobSubOcrCharacter.ShowDialog(this);
|
||||
_manualOcrDialogPosition = _vobSubOcrCharacter.FormPosition;
|
||||
if (result == DialogResult.OK && _vobSubOcrCharacter.ShrinkSelection)
|
||||
{
|
||||
shrinkSelection = true;
|
||||
index--;
|
||||
if (expandSelectionList.Count > 0)
|
||||
expandSelectionList.RemoveAt(expandSelectionList.Count - 1);
|
||||
}
|
||||
else if (result == DialogResult.OK && _vobSubOcrCharacter.ExpandSelection)
|
||||
if (result == DialogResult.OK && _vobSubOcrCharacter.ExpandSelection)
|
||||
{
|
||||
expandSelectionList.Add(item);
|
||||
expandSelection = true;
|
||||
}
|
||||
else if (result == DialogResult.OK)
|
||||
{
|
||||
string text = _vobSubOcrCharacter.ManualRecognizedCharacters;
|
||||
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, expandSelectionList);
|
||||
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, null);
|
||||
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
|
||||
_lastAdditions.Add(addition);
|
||||
matches.Add(new CompareMatch(text, _vobSubOcrCharacter.IsItalic, expandSelectionList.Count, null));
|
||||
expandSelectionList = new List<ImageSplitterItem>();
|
||||
matches.Add(new CompareMatch(text, _vobSubOcrCharacter.IsItalic, 0, null));
|
||||
SetBinOcrLowercaseUppercase(item.NikseBitmap.Height, text);
|
||||
}
|
||||
else if (result == DialogResult.Abort)
|
||||
{
|
||||
@ -4021,75 +4051,27 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
matches.Add(new CompareMatch("*", false, 0, null));
|
||||
}
|
||||
_italicCheckedLast = _vobSubOcrCharacter.IsItalic;
|
||||
|
||||
}
|
||||
else if (item.NikseBitmap == null)
|
||||
else // found image match
|
||||
{
|
||||
matches.Add(new CompareMatch(item.SpecialCharacter, false, 0, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
CompareMatch bestGuess;
|
||||
CompareMatch match = GetCompareMatchNew(item, out bestGuess, list, index);
|
||||
if (match == null) // Try line OCR if no image compare match
|
||||
{
|
||||
if (_nOcrDb != null && _nOcrDb.OcrCharacters.Count > 0)
|
||||
match = GetNOcrCompareMatchNew(item, parentBitmap, _nOcrDb, true, true);
|
||||
}
|
||||
|
||||
if (match == null)
|
||||
{
|
||||
_vobSubOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, false, bestGuess, _lastAdditions, this);
|
||||
DialogResult result = _vobSubOcrCharacter.ShowDialog(this);
|
||||
_manualOcrDialogPosition = _vobSubOcrCharacter.FormPosition;
|
||||
if (result == DialogResult.OK && _vobSubOcrCharacter.ExpandSelection)
|
||||
{
|
||||
expandSelectionList.Add(item);
|
||||
expandSelection = true;
|
||||
}
|
||||
else if (result == DialogResult.OK)
|
||||
{
|
||||
string text = _vobSubOcrCharacter.ManualRecognizedCharacters;
|
||||
string name = SaveCompareItemNew(item, text, _vobSubOcrCharacter.IsItalic, null);
|
||||
var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrCharacter.IsItalic, listViewIndex);
|
||||
_lastAdditions.Add(addition);
|
||||
matches.Add(new CompareMatch(text, _vobSubOcrCharacter.IsItalic, 0, null));
|
||||
SetBinOcrLowercaseUppercase(item.NikseBitmap.Height, text);
|
||||
}
|
||||
else if (result == DialogResult.Abort)
|
||||
{
|
||||
_abort = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
matches.Add(new CompareMatch("*", false, 0, null));
|
||||
}
|
||||
_italicCheckedLast = _vobSubOcrCharacter.IsItalic;
|
||||
}
|
||||
else // found image match
|
||||
{
|
||||
matches.Add(new CompareMatch(match.Text, match.Italic, 0, null));
|
||||
if (match.ExpandCount > 0)
|
||||
index += match.ExpandCount - 1;
|
||||
}
|
||||
}
|
||||
if (_abort)
|
||||
return string.Empty;
|
||||
if (!expandSelection && !shrinkSelection)
|
||||
index++;
|
||||
if (shrinkSelection && expandSelectionList.Count < 2)
|
||||
{
|
||||
shrinkSelection = false;
|
||||
expandSelectionList = new List<ImageSplitterItem>();
|
||||
matches.Add(new CompareMatch(match.Text, match.Italic, 0, null));
|
||||
if (match.ExpandCount > 0)
|
||||
index += match.ExpandCount - 1;
|
||||
}
|
||||
}
|
||||
|
||||
line = GetStringWithItalicTags(matches);
|
||||
if (_abort)
|
||||
return string.Empty;
|
||||
if (!expandSelection && !shrinkSelection)
|
||||
index++;
|
||||
if (shrinkSelection && expandSelectionList.Count < 2)
|
||||
{
|
||||
shrinkSelection = false;
|
||||
expandSelectionList = new List<ImageSplitterItem>();
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// line = threadText;
|
||||
//}
|
||||
|
||||
line = GetStringWithItalicTags(matches);
|
||||
|
||||
if (checkBoxAutoFixCommonErrors.Checked && _ocrFixEngine != null)
|
||||
line = _ocrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list
|
||||
|
||||
@ -4109,7 +4091,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int correctWords;
|
||||
int wordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(line, out correctWords);
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length == 0)
|
||||
{
|
||||
_ocrFixEngine.AutoGuessesUsed.Clear();
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
@ -4147,7 +4129,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
_tesseractOcrAutoFixes++;
|
||||
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
|
||||
LogOcrFix(listViewIndex, textWithOutFixes.ToString(), line);
|
||||
LogOcrFix(listViewIndex, textWithOutFixes, line);
|
||||
}
|
||||
|
||||
return line;
|
||||
@ -4414,7 +4396,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
int correctWords;
|
||||
int wordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(line, out correctWords);
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length == 0)
|
||||
{
|
||||
_ocrFixEngine.AutoGuessesUsed.Clear();
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
@ -4452,7 +4434,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
_tesseractOcrAutoFixes++;
|
||||
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
|
||||
LogOcrFix(listViewIndex, textWithOutFixes.ToString(), line);
|
||||
LogOcrFix(listViewIndex, textWithOutFixes, line);
|
||||
}
|
||||
|
||||
return line;
|
||||
@ -4772,7 +4754,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
line.Append(temp);
|
||||
}
|
||||
|
||||
paragraph.Append(line.ToString());
|
||||
paragraph.Append(line);
|
||||
paragraph.Append(appendString);
|
||||
}
|
||||
line = new StringBuilder();
|
||||
@ -4797,7 +4779,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
line.Append("</i>");
|
||||
isItalic = false;
|
||||
}
|
||||
line.Append(word.ToString());
|
||||
line.Append(word);
|
||||
line.Append(appendString);
|
||||
wordNonItalics++;
|
||||
}
|
||||
@ -5615,7 +5597,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// change yellow color to white - easier for Tesseract
|
||||
var nbmp = new NikseBitmap(bmp);
|
||||
nbmp.ReplaceYellowWithWhite(); // optimized replace
|
||||
const bool useHocr = true;
|
||||
|
||||
string tempTiffFileName = Path.GetTempPath() + Guid.NewGuid().ToString() + ".png";
|
||||
var b = nbmp.GetBitmap();
|
||||
@ -5634,8 +5615,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrEmpty(psmMode))
|
||||
process.StartInfo.Arguments += " " + psmMode.Trim();
|
||||
|
||||
if (useHocr)
|
||||
process.StartInfo.Arguments += " hocr";
|
||||
process.StartInfo.Arguments += " hocr";
|
||||
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
|
||||
if (Utilities.IsRunningOnLinux() || Utilities.IsRunningOnMac())
|
||||
@ -5661,39 +5641,20 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
process.WaitForExit(5000);
|
||||
|
||||
string result = string.Empty;
|
||||
if (useHocr)
|
||||
string outputFileName = tempTextFileName + ".html";
|
||||
try
|
||||
{
|
||||
string outputFileName = tempTextFileName + ".html";
|
||||
try
|
||||
{
|
||||
if (File.Exists(outputFileName))
|
||||
{
|
||||
result = File.ReadAllText(outputFileName);
|
||||
result = ParseHocr(result);
|
||||
File.Delete(outputFileName);
|
||||
}
|
||||
File.Delete(tempTiffFileName);
|
||||
}
|
||||
catch
|
||||
if (File.Exists(outputFileName))
|
||||
{
|
||||
result = File.ReadAllText(outputFileName);
|
||||
result = ParseHocr(result);
|
||||
File.Delete(outputFileName);
|
||||
}
|
||||
File.Delete(tempTiffFileName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// string outputFileName = tempTextFileName + ".txt";
|
||||
// try
|
||||
// {
|
||||
// if (File.Exists(outputFileName))
|
||||
// {
|
||||
// result = File.ReadAllText(outputFileName);
|
||||
// File.Delete(outputFileName);
|
||||
// }
|
||||
// File.Delete(tempTiffFileName);
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -5847,9 +5808,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// fix italics
|
||||
textWithOutFixes = FixItalics(textWithOutFixes);
|
||||
|
||||
int numberOfWords = textWithOutFixes.ToString().Split((" " + Environment.NewLine).ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
|
||||
int numberOfWords = textWithOutFixes.Split((" " + Environment.NewLine).ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
|
||||
|
||||
string line = textWithOutFixes.ToString().Trim();
|
||||
string line = textWithOutFixes.Trim();
|
||||
if (_ocrFixEngine.IsDictionaryLoaded)
|
||||
{
|
||||
if (checkBoxAutoFixCommonErrors.Checked)
|
||||
@ -5906,7 +5867,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2)
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length < 2)
|
||||
{
|
||||
if (_bluRaySubtitles != null && !line.Contains("<i>"))
|
||||
{
|
||||
@ -5969,7 +5930,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (checkBoxTesseractItalicsOn.Checked)
|
||||
{
|
||||
if (line.Contains("<i>") || wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2)
|
||||
if (line.Contains("<i>") || wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length < 2)
|
||||
{
|
||||
_ocrFixEngine.AutoGuessesUsed.Clear();
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
@ -6281,7 +6242,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length < 2)
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.Replace("~", string.Empty).Trim().Length < 2)
|
||||
{
|
||||
_ocrFixEngine.AutoGuessesUsed.Clear();
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
@ -6410,11 +6371,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
subtitleListView1.SetBackgroundColor(index, Color.LightGreen);
|
||||
}
|
||||
|
||||
if (textWithOutFixes.ToString().Trim() != line.Trim())
|
||||
if (textWithOutFixes.Trim() != line.Trim())
|
||||
{
|
||||
_tesseractOcrAutoFixes++;
|
||||
labelFixesMade.Text = string.Format(" - {0}", _tesseractOcrAutoFixes);
|
||||
LogOcrFix(index, textWithOutFixes.ToString(), line);
|
||||
LogOcrFix(index, textWithOutFixes, line);
|
||||
}
|
||||
|
||||
if (_vobSubMergedPackist != null)
|
||||
@ -6466,7 +6427,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private string TesseractResizeAndRetry(Bitmap bitmap)
|
||||
{
|
||||
string result = Tesseract3DoOcrViaExe(ResizeBitmap(bitmap, bitmap.Width * 3, bitmap.Height * 2), _languageId, null);
|
||||
if (result.ToString().Trim().Length == 0)
|
||||
if (result.Trim().Length == 0)
|
||||
result = Tesseract3DoOcrViaExe(ResizeBitmap(bitmap, bitmap.Width * 4, bitmap.Height * 2), _languageId, "-psm 7");
|
||||
return result.TrimEnd();
|
||||
}
|
||||
@ -6774,7 +6735,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
if (comboBoxOcrMethod.SelectedIndex == 4)
|
||||
{
|
||||
_binaryOcrDbFileName = Configuration.OcrFolder + comboBoxCharacterDatabase.SelectedItem.ToString() + ".db";
|
||||
_binaryOcrDbFileName = Configuration.OcrFolder + comboBoxCharacterDatabase.SelectedItem + ".db";
|
||||
}
|
||||
|
||||
LoadImageCompareBitmaps();
|
||||
@ -7107,11 +7068,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (bmp != null)
|
||||
{
|
||||
bmp.Dispose();
|
||||
bmp = null;
|
||||
}
|
||||
bmp.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7397,7 +7354,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
numericUpDownStartNumber.Value = last.Index + 1;
|
||||
Timer t = new Timer();
|
||||
t.Interval = 200;
|
||||
t.Tick += new EventHandler(t_Tick);
|
||||
t.Tick += t_Tick;
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
@ -7446,9 +7403,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
Subtitle sub = new Subtitle();
|
||||
Encoding encoding = null;
|
||||
SubtitleFormat format = sub.LoadSubtitle(fileName, out encoding, encoding);
|
||||
if (format == null || sub == null)
|
||||
Encoding encoding;
|
||||
SubtitleFormat format = sub.LoadSubtitle(fileName, out encoding, null);
|
||||
if (format == null)
|
||||
return;
|
||||
|
||||
int index = 0;
|
||||
@ -8382,9 +8339,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
Subtitle sub = new Subtitle();
|
||||
Encoding encoding = null;
|
||||
SubtitleFormat format = sub.LoadSubtitle(fileName, out encoding, encoding);
|
||||
if (format == null || sub == null)
|
||||
Encoding encoding;
|
||||
SubtitleFormat format = sub.LoadSubtitle(fileName, out encoding, null);
|
||||
if (format == null)
|
||||
return;
|
||||
|
||||
int index = 0;
|
||||
|
@ -116,7 +116,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (p.Text.Length > 1)
|
||||
p.Text = p.Text.Insert(p.Text.Length / 2, sb.ToString());
|
||||
else
|
||||
p.Text = sb.ToString() + p.Text;
|
||||
p.Text = sb + p.Text;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -145,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (p.Text.Length > 1)
|
||||
p.Text = p.Text.Insert(p.Text.Length / 2, sb.ToString());
|
||||
else
|
||||
p.Text = sb.ToString() + p.Text;
|
||||
p.Text = sb + p.Text;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
@ -50,13 +50,13 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
private static int[] YCbCr2Rgb(int y, int cb, int cr, bool useBt601)
|
||||
{
|
||||
int[] rgb = new int[3];
|
||||
double y1, r, g, b;
|
||||
double r, g, b;
|
||||
|
||||
y -= 16;
|
||||
cb -= 128;
|
||||
cr -= 128;
|
||||
|
||||
y1 = y * 1.164383562;
|
||||
var y1 = y * 1.164383562;
|
||||
if (useBt601)
|
||||
{
|
||||
/* BT.601 for YCbCr 16..235 -> RGB 0..255 (PC) */
|
||||
|
@ -387,9 +387,6 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// <summary>
|
||||
/// Parse an PCS packet which contains width/height info
|
||||
/// </summary>
|
||||
/// <param name="segment">object containing info about the current segment</param>
|
||||
/// <param name="pic">SubPicture object containing info about the current caption</param>
|
||||
/// <param name="msg">reference to message string</param>
|
||||
/// <param name="buffer">Raw data buffer, starting right after segment</param>
|
||||
private static PcsObject ParsePcs(byte[] buffer, int offset)
|
||||
{
|
||||
@ -468,8 +465,6 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// </summary>
|
||||
/// <param name="buffer">Buffer of raw byte data, starting right after segment</param>
|
||||
/// <param name="segment">object containing info about the current segment</param>
|
||||
/// <param name="pic">SubPicture object containing info about the current caption</param>
|
||||
/// <param name="msg">reference to message string</param>
|
||||
/// <returns>number of valid palette entries (-1 for fault)</returns>
|
||||
private static PdsData ParsePds(byte[] buffer, SupSegment segment)
|
||||
{
|
||||
@ -500,8 +495,6 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// </summary>
|
||||
/// <param name="buffer">raw byte date, starting right after segment</param>
|
||||
/// <param name="segment">object containing info about the current segment</param>
|
||||
/// <param name="pic">SubPicture object containing info about the current caption</param>
|
||||
/// <param name="msg">reference to message string</param>
|
||||
/// <returns>true if this is a valid new object (neither invalid nor a fragment)</returns>
|
||||
private static OdsData ParseOds(byte[] buffer, SupSegment segment, bool forceFirst)
|
||||
{
|
||||
@ -529,7 +522,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
ObjectId = objId,
|
||||
ObjectVersion = objVer,
|
||||
Fragment = info,
|
||||
Message = "ObjId: " + objId + ", ver: " + objVer + ", seq: " + (first ? "first" : "") + ((first && last) ? "/" : "") + (last ? "" + "last" : "") + ", width: " + width + ", height: " + height,
|
||||
Message = "ObjId: " + objId + ", ver: " + objVer + ", seq: first" + (last ? "/" : "") + (last ? "" + "last" : "") + ", width: " + width + ", height: " + height,
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -248,7 +248,7 @@ namespace Nikse.SubtitleEdit.Logic.BluRaySup
|
||||
/// Create the binary stream representation of one caption
|
||||
/// </summary>
|
||||
/// <param name="pic">SubPicture object containing caption info</param>
|
||||
/// <param name="bm">bitmap</param>
|
||||
/// <param name="bmp">bitmap</param>
|
||||
/// <param name="fps">frames per second</param>
|
||||
/// <param name="bottomMargin">image bottom margin</param>
|
||||
/// <returns>byte buffer containing the binary stream representation of one caption</returns>
|
||||
|
@ -56,19 +56,15 @@ namespace Nikse.SubtitleEdit.Logic.ColorChooser
|
||||
// point within the circle). HSV.Saturation and HSV.value must be
|
||||
// scaled to be between 0 and 1.
|
||||
|
||||
double h;
|
||||
double s;
|
||||
double v;
|
||||
|
||||
double r = 0;
|
||||
double g = 0;
|
||||
double b = 0;
|
||||
|
||||
// Scale Hue to be between 0 and 360. Saturation
|
||||
// and value scale to be between 0 and 1.
|
||||
h = ((double)HSV.Hue / 255 * 360) % 360;
|
||||
s = (double)HSV.Saturation / 255;
|
||||
v = (double)HSV.Value / 255;
|
||||
var h = ((double)HSV.Hue / 255 * 360) % 360;
|
||||
var s = (double)HSV.Saturation / 255;
|
||||
var v = (double)HSV.Value / 255;
|
||||
|
||||
if (s == 0)
|
||||
{
|
||||
@ -155,13 +151,13 @@ namespace Nikse.SubtitleEdit.Logic.ColorChooser
|
||||
double g = (double)argb.Green / 255;
|
||||
double b = (double)argb.Blue / 255;
|
||||
|
||||
double h;
|
||||
double s;
|
||||
double v;
|
||||
|
||||
double min = Math.Min(Math.Min(r, g), b);
|
||||
double max = Math.Max(Math.Max(r, g), b);
|
||||
v = max;
|
||||
|
||||
double h;
|
||||
double s;
|
||||
var v = max;
|
||||
|
||||
double delta = max - min;
|
||||
if (max == 0 || delta == 0)
|
||||
{
|
||||
|
@ -298,8 +298,7 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
|
||||
try
|
||||
{
|
||||
if (preferredEncodings != null)
|
||||
Marshal.Copy(preferredEncodings, 0, pPrefEncs, preferredEncodings.Length);
|
||||
Marshal.Copy(preferredEncodings, 0, pPrefEncs, preferredEncodings.Length);
|
||||
|
||||
Marshal.Copy(resultCodePages, 0, pDetectedEncs, resultCodePages.Length);
|
||||
|
||||
@ -307,13 +306,12 @@ namespace Nikse.SubtitleEdit.Logic.DetectEncoding
|
||||
if (preserveOrder)
|
||||
options |= MultiLanguage.MLCPF.MLDETECTF_PRESERVE_ORDER;
|
||||
|
||||
if (preferredEncodings != null)
|
||||
options |= MultiLanguage.MLCPF.MLDETECTF_PREFERRED_ONLY;
|
||||
options |= MultiLanguage.MLCPF.MLDETECTF_PREFERRED_ONLY;
|
||||
|
||||
// finally... call to DetectOutboundCodePage
|
||||
multilang3.DetectOutboundCodePage(options,
|
||||
input, (uint)input.Length,
|
||||
pPrefEncs, (uint)(preferredEncodings == null ? 0 : preferredEncodings.Length),
|
||||
pPrefEncs, (uint)preferredEncodings.Length,
|
||||
pDetectedEncs, ref detectedCodepages,
|
||||
ref specialChar);
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, ClassInterface((short)0), TypeLibType((short)2), Guid("D66D6F99-CDAA-11D0-B822-00C04FC9B31F")]
|
||||
public class CMLangConvertCharsetClass : IMLangConvertCharset, CMLangConvertCharset
|
||||
public class CMLangConvertCharsetClass : CMLangConvertCharset
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
public virtual extern void DoConversion([In] ref byte pSrcStr, [In, Out] ref uint pcSrcSize, [In] ref byte pDstStr, [In, Out] ref uint pcDstSize);
|
||||
|
@ -5,7 +5,7 @@ namespace MultiLanguage
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, Guid("C04D65CF-B70D-11D0-B188-00AA0038C969"), ComConversionLoss, ClassInterface((short)0), TypeLibType((short)2)]
|
||||
public class CMLangStringClass : IMLangString, CMLangString, IMLangStringWStr, IMLangStringAStr
|
||||
public class CMLangStringClass : CMLangString, IMLangStringWStr, IMLangStringAStr
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
public virtual extern void GetAStr([In] int lSrcPos, [In] int lSrcLen, [In] uint uCodePageIn, out uint puCodePageOut, out sbyte pszDest, [In] int cchDest, out int pcchActual, out int plActualLen);
|
||||
|
@ -5,7 +5,7 @@ namespace MultiLanguage
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[ComImport, TypeLibType((short)2), ClassInterface((short)0), Guid("275C23E2-3747-11D0-9FEA-00AA003F8646")]
|
||||
public class CMultiLanguageClass : IMultiLanguage, CMultiLanguage, IMLangCodePages, IMLangFontLink, IMLangLineBreakConsole, IMultiLanguage2, IMLangFontLink2, IMultiLanguage3
|
||||
public class CMultiLanguageClass : CMultiLanguage, IMLangFontLink, IMLangLineBreakConsole, IMLangFontLink2, IMultiLanguage3
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
public virtual extern void BreakLineA([In] uint locale, [In] uint uCodePage, [In] ref sbyte pszSrc, [In] int cchSrc, [In] int cMaxColumns, out int pcchLine, out int pcchSkip);
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace MultiLanguage
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
@ -147,10 +147,10 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
public void CheckForUpdates()
|
||||
{
|
||||
// load github release json
|
||||
//StartDownloadString(ReleasesUrl, "application/json", new AsyncCallback(FinishWebRequestReleases));
|
||||
//StartDownloadString(ReleasesUrl, "application/json", FinishWebRequestReleases);
|
||||
|
||||
// load change log
|
||||
StartDownloadString(ChangeLogUrl, null, new AsyncCallback(FinishWebRequestChangeLog));
|
||||
StartDownloadString(ChangeLogUrl, null, FinishWebRequestChangeLog);
|
||||
}
|
||||
|
||||
public bool IsUpdateAvailable()
|
||||
|
@ -201,12 +201,8 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
int colonIndex = s2.IndexOf(":", StringComparison.Ordinal);
|
||||
string start = s2.Substring(0, colonIndex);
|
||||
|
||||
bool doContinue = true;
|
||||
if (Settings.RemoveTextBeforeColonOnlyUppercase && start != start.ToUpper())
|
||||
doContinue = false;
|
||||
if (doContinue)
|
||||
if (!Settings.RemoveTextBeforeColonOnlyUppercase || start == start.ToUpper())
|
||||
{
|
||||
|
||||
int periodIndex = start.LastIndexOf(". ", StringComparison.Ordinal);
|
||||
int questIndex = start.LastIndexOf("? ", StringComparison.Ordinal);
|
||||
int exclaIndex = start.LastIndexOf("! ", StringComparison.Ordinal);
|
||||
@ -276,9 +272,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
|
||||
if (removedInFirstLine && !removedInSecondLine && !text.StartsWith("-") && !text.StartsWith("<i>-"))
|
||||
{
|
||||
if (insertDash && removedInFirstLine && (arr[1].StartsWith("-") || arr[1].StartsWith("<i>-")))
|
||||
insertDash = true;
|
||||
else
|
||||
if (!insertDash || (!arr[1].StartsWith("-") && !arr[1].StartsWith("<i>-")))
|
||||
insertDash = false;
|
||||
}
|
||||
}
|
||||
@ -456,8 +450,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
text = st.Pre + text + st.Post;
|
||||
|
||||
if (oldText.Trim().StartsWith("- ") &&
|
||||
(oldText.Contains(Environment.NewLine + "- ") || oldText.Contains(Environment.NewLine + " - ")) &&
|
||||
text != null && !text.Contains(Environment.NewLine))
|
||||
(oldText.Contains(Environment.NewLine + "- ") || oldText.Contains(Environment.NewLine + " - ")) && !text.Contains(Environment.NewLine))
|
||||
{
|
||||
text = text.TrimStart().TrimStart('-').TrimStart();
|
||||
}
|
||||
@ -586,7 +579,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
_interjectionList.Add(pascalCasing);
|
||||
}
|
||||
}
|
||||
_interjectionList.Sort(new Comparison<string>(CompareLength));
|
||||
_interjectionList.Sort(CompareLength);
|
||||
}
|
||||
|
||||
bool doRepeat = true;
|
||||
|
@ -72,11 +72,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
|
||||
splittedIndexes.Add(splittedSubtitle.Paragraphs.Count + 1);
|
||||
|
||||
string p1 = Utilities.RemoveHtmlTags(newParagraph1.Text);
|
||||
bool p1Ends = false;
|
||||
if (p1.EndsWith(".") || p1.EndsWith("!") || p1.EndsWith("?") || p1.EndsWith(":") || p1.EndsWith(")") || p1.EndsWith("]") || p1.EndsWith("♪"))
|
||||
p1Ends = true;
|
||||
|
||||
if (p1Ends)
|
||||
{
|
||||
if (newParagraph1.Text.StartsWith("-") && newParagraph2.Text.StartsWith("-"))
|
||||
{
|
||||
|
@ -640,7 +640,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct Enumerator : IEnumerator<T>, IDisposable {
|
||||
public struct Enumerator : IEnumerator<T> {
|
||||
|
||||
HashSet<T> hashset;
|
||||
int next;
|
||||
|
@ -131,12 +131,11 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
private void ParseVtsVobs()
|
||||
{
|
||||
string data;
|
||||
byte[] buffer = new byte[16];
|
||||
|
||||
//retrieve video info
|
||||
_fs.Position = 0x200;
|
||||
data = IntToBin(GetEndian(2), 16);
|
||||
var data = IntToBin(GetEndian(2), 16);
|
||||
_vtsVobs.VideoStream.CodingMode = ArrayOfCodingMode[BinToInt(MidStr(data, 0, 2))];
|
||||
_vtsVobs.VideoStream.Standard = ArrayOfStandard[BinToInt(MidStr(data, 2, 2))];
|
||||
_vtsVobs.VideoStream.Aspect = ArrayOfAspect[BinToInt(MidStr(data, 4, 2))];
|
||||
@ -344,12 +343,10 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
private static int TimeToMs(int time)
|
||||
{
|
||||
int result;
|
||||
string temp;
|
||||
double fps;
|
||||
|
||||
temp = IntToBin(time, 32);
|
||||
result = StrToInt(IntToHex(BinToInt(MidStr(temp, 0, 8)), 1)) * 3600000;
|
||||
var temp = IntToBin(time, 32);
|
||||
var result = StrToInt(IntToHex(BinToInt(MidStr(temp, 0, 8)), 1)) * 3600000;
|
||||
result = result + StrToInt(IntToHex(BinToInt(MidStr(temp, 8, 8)), 2)) * 60000;
|
||||
result = result + StrToInt(IntToHex(BinToInt(MidStr(temp, 16, 8)), 2)) * 1000;
|
||||
if (temp.Substring(24, 2) == "11")
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Logic
|
||||
|
@ -292,7 +292,7 @@ namespace NHunspell
|
||||
/// The sample.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="List"/>.
|
||||
/// The <see cref="List{T}"/> of <see cref="String"/>.
|
||||
/// </returns>
|
||||
public List<string> Generate(string word, string sample)
|
||||
{
|
||||
|
@ -228,23 +228,12 @@ namespace NHunspell
|
||||
currentLength = GetLineLength(dictionaryBytes, currentPos);
|
||||
string lineText = enc.GetString(dictionaryBytes, currentPos, currentLength).Trim();
|
||||
|
||||
if (lineText != null && lineText.Length > 0)
|
||||
if (lineText.Length > 0)
|
||||
{
|
||||
string[] tokens = lineText.Split('|');
|
||||
if (tokens.Length > 0)
|
||||
{
|
||||
bool wordLine = true;
|
||||
if (tokens[0].StartsWith("-"))
|
||||
{
|
||||
wordLine = false;
|
||||
}
|
||||
|
||||
if (tokens[0].StartsWith("(") && tokens[0].EndsWith(")"))
|
||||
{
|
||||
wordLine = false;
|
||||
}
|
||||
|
||||
if (wordLine)
|
||||
if (!tokens[0].StartsWith("-") && !(tokens[0].StartsWith("(") && tokens[0].EndsWith(")")))
|
||||
{
|
||||
lock (this.dictionaryLock)
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ namespace NHunspell
|
||||
/// The word.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="List"/>.
|
||||
/// The <see cref="List{T}"/> of <see cref="String"/>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">
|
||||
/// </exception>
|
||||
|
@ -14,7 +14,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public int Length { get { return Buffer1.Length + Buffer2.Length; } }
|
||||
}
|
||||
|
||||
unsafe public class NikseBitmap
|
||||
public class NikseBitmap
|
||||
{
|
||||
public int Width { get; private set; }
|
||||
public int Height { get; private set; }
|
||||
|
@ -834,7 +834,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return list;
|
||||
}
|
||||
|
||||
internal static unsafe int IsBitmapsAlike(ManagedBitmap bmp1, NikseBitmap bmp2)
|
||||
internal static int IsBitmapsAlike(ManagedBitmap bmp1, NikseBitmap bmp2)
|
||||
{
|
||||
int different = 0;
|
||||
int maxDiff = bmp1.Width * bmp1.Height / 5;
|
||||
@ -852,7 +852,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return different;
|
||||
}
|
||||
|
||||
internal static unsafe int IsBitmapsAlike(NikseBitmap bmp1, ManagedBitmap bmp2)
|
||||
internal static int IsBitmapsAlike(NikseBitmap bmp1, ManagedBitmap bmp2)
|
||||
{
|
||||
int different = 0;
|
||||
int maxDiff = bmp1.Width * bmp1.Height / 5;
|
||||
@ -870,7 +870,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return different;
|
||||
}
|
||||
|
||||
internal static unsafe int IsBitmapsAlike(Ocr.Binary.BinaryOcrBitmap bmp1, NikseBitmap bmp2)
|
||||
internal static int IsBitmapsAlike(Ocr.Binary.BinaryOcrBitmap bmp1, NikseBitmap bmp2)
|
||||
{
|
||||
int different = 0;
|
||||
int maxDiff = bmp1.Width * bmp1.Height / 5;
|
||||
@ -889,7 +889,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return different;
|
||||
}
|
||||
|
||||
internal static unsafe int IsBitmapsAlike(NikseBitmap bmp1, Ocr.Binary.BinaryOcrBitmap bmp2)
|
||||
internal static int IsBitmapsAlike(NikseBitmap bmp1, Ocr.Binary.BinaryOcrBitmap bmp2)
|
||||
{
|
||||
int different = 0;
|
||||
int maxDiff = bmp1.Width * bmp1.Height / 5;
|
||||
|
@ -1312,7 +1312,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
}
|
||||
|
||||
// lines ending with ". should often end at ... (of no other quotes exists near by)
|
||||
if ((lastLine == null || !lastLine.Contains("\"")) && input != null &&
|
||||
if ((lastLine == null || !lastLine.Contains("\"")) &&
|
||||
input.EndsWith("\".") && input.IndexOf('"') == input.LastIndexOf('"') && input.Length > 3)
|
||||
{
|
||||
string lastChar = input.Substring(input.Length - 3, 1);
|
||||
|
@ -123,7 +123,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
expecting = ExpectingLine.TimeEndOrText;
|
||||
}
|
||||
else if (expecting == ExpectingLine.TimeStart && line.Trim().Length > 0 && paragraph != null)
|
||||
else if (expecting == ExpectingLine.TimeStart && line.Trim().Length > 0)
|
||||
{
|
||||
int ms = (int)paragraph.EndTime.TotalMilliseconds;
|
||||
int frames = paragraph.EndFrame;
|
||||
|
@ -247,7 +247,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
|
||||
if (styleFound)
|
||||
{
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
|
||||
subtitle.Header = sb.ToString();
|
||||
}
|
||||
else
|
||||
@ -336,7 +336,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
|
||||
if (stylexmlCount > 0)
|
||||
{
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
|
||||
subtitle.Header = sb.ToString();
|
||||
}
|
||||
else
|
||||
@ -941,7 +941,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BGR color like this: &HBBGGRR& (where BB, GG, and RR are hex values in uppercase)
|
||||
/// BGR color like this: &HBBGGRR& (where BB, GG, and RR are hex values in uppercase)
|
||||
/// </summary>
|
||||
/// <param name="f">Input string</param>
|
||||
/// <param name="defaultColor">Default color</param>
|
||||
|
@ -94,7 +94,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
public static void Save(string fileName, Subtitle subtitle)
|
||||
{
|
||||
var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
|
||||
byte[] buffer = new byte[] { 0x38, 0x35, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30, 0x30, 0x30, 0x39 };
|
||||
byte[] buffer = { 0x38, 0x35, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30, 0x30, 0x30, 0x39 };
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
for (int i = 0; i < 0xde; i++)
|
||||
fs.WriteByte(0);
|
||||
|
@ -265,7 +265,6 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
|
||||
private static string EncodeText(string s)
|
||||
{
|
||||
s = s.ToString();
|
||||
s = s.Replace("<b>", string.Empty).Replace("<B>", string.Empty).Replace("</b>", string.Empty).Replace("</B>", string.Empty);
|
||||
s = s.Replace("<u>", string.Empty).Replace("<U>", string.Empty).Replace("</u>", string.Empty).Replace("</U>", string.Empty);
|
||||
s = Utilities.RemoveHtmlFontTag(s);
|
||||
|
@ -75,7 +75,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
|
||||
|
||||
byte[] buffer = new byte[] { 0xEA, 0x22, 1, 0 }; // header
|
||||
byte[] buffer = { 0xEA, 0x22, 1, 0 }; // header
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
int numberOfLines = subtitle.Paragraphs.Count;
|
||||
@ -139,9 +139,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
|
||||
var textBytes = new List<byte>();
|
||||
bool italic = false;
|
||||
if (p.Text.StartsWith("<i>") && p.Text.EndsWith("</i>"))
|
||||
italic = true;
|
||||
var italic = p.Text.StartsWith("<i>") && p.Text.EndsWith("</i>");
|
||||
text = Utilities.RemoveHtmlTags(text);
|
||||
int j = 0;
|
||||
if (italic)
|
||||
|
@ -81,7 +81,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
if (continuation)
|
||||
{
|
||||
if (p != null && p.Text.Length < 300)
|
||||
if (p.Text.Length < 300)
|
||||
p.Text = (p.Text + Environment.NewLine + line.TrimEnd('"')).Trim();
|
||||
continuation = !line.Trim().EndsWith("\"");
|
||||
}
|
||||
|
@ -51,9 +51,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
xml.LoadXml(xmlAsString);
|
||||
|
||||
var subtitles = xml.DocumentElement.SelectNodes("//Subtitle");
|
||||
if (subtitles != null)
|
||||
return subtitles != null && subtitles.Count > 0;
|
||||
return false;
|
||||
return subtitles != null && subtitles.Count > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -372,7 +370,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
else if (html.Length > 0 && html.ToString().StartsWith("<Font "))
|
||||
{
|
||||
XmlDocument temp = new XmlDocument();
|
||||
temp.LoadXml("<root>" + html.ToString() + "</root>");
|
||||
temp.LoadXml("<root>" + html + "</root>");
|
||||
XmlNode fontNode = xml.CreateElement("Font");
|
||||
fontNode.InnerXml = temp.DocumentElement.SelectSingleNode("Font").InnerXml;
|
||||
foreach (XmlAttribute a in temp.DocumentElement.SelectSingleNode("Font").Attributes)
|
||||
@ -521,7 +519,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
string lastVPosition = string.Empty;
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "Text":
|
||||
if (innerNode.Attributes["VPosition"] != null)
|
||||
@ -584,7 +582,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
else if (alignRight)
|
||||
pre = "{\\an3}";
|
||||
}
|
||||
string temp = pre + pText.ToString();
|
||||
string temp = pre + pText;
|
||||
pText = new StringBuilder();
|
||||
pText.Append(temp);
|
||||
}
|
||||
|
@ -67,9 +67,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
xmlAsString = xmlAsString.Replace("xmlns=\"http://www.smpte-ra.org/schemas/428-7/2007/DCST\"", string.Empty);
|
||||
xml.LoadXml(xmlAsString);
|
||||
var subtitles = xml.DocumentElement.SelectNodes("//Subtitle");
|
||||
if (subtitles != null && subtitles.Count >= 0)
|
||||
return subtitles != null && subtitles.Count > 0;
|
||||
return false;
|
||||
return subtitles != null && subtitles.Count > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -566,7 +564,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
string lastVPosition = string.Empty;
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "Text":
|
||||
if (innerNode.Attributes["Vposition"] != null)
|
||||
@ -629,7 +627,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
else if (alignRight)
|
||||
pre = "{\\an3}";
|
||||
}
|
||||
string temp = pre + pText.ToString();
|
||||
string temp = pre + pText;
|
||||
pText = new StringBuilder();
|
||||
pText.Append(temp);
|
||||
}
|
||||
|
@ -67,9 +67,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
xmlAsString = xmlAsString.Replace("xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\"", string.Empty);
|
||||
xml.LoadXml(xmlAsString);
|
||||
var subtitles = xml.DocumentElement.SelectNodes("//Subtitle");
|
||||
if (subtitles != null && subtitles.Count >= 0)
|
||||
return subtitles != null && subtitles.Count > 0;
|
||||
return false;
|
||||
return subtitles != null && subtitles.Count > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -566,7 +564,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
string lastVPosition = string.Empty;
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "Text":
|
||||
if (innerNode.Attributes["Vposition"] != null)
|
||||
@ -629,7 +627,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
else if (alignRight)
|
||||
pre = "{\\an3}";
|
||||
}
|
||||
string temp = pre + pText.ToString();
|
||||
string temp = pre + pText;
|
||||
pText = new StringBuilder();
|
||||
pText.Append(temp);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ $HorzAlign = Center
|
||||
double factor = (1000.0 / Configuration.Settings.General.CurrentFrameRate);
|
||||
string startTime = string.Format(timeFormat, p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, (int)Math.Round(p.StartTime.Milliseconds / factor));
|
||||
string endTime = string.Format(timeFormat, p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, (int)Math.Round(p.EndTime.Milliseconds / factor));
|
||||
sb.Append(string.Format(paragraphWriteFormat, startTime, endTime, EncodeStyles(p.Text)));
|
||||
sb.AppendFormat(paragraphWriteFormat, startTime, endTime, EncodeStyles(p.Text));
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ $HorzAlign = Center
|
||||
double factor = (1000.0 / Configuration.Settings.General.CurrentFrameRate);
|
||||
string startTime = string.Format(timeFormat, p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, (int)Math.Round(p.StartTime.Milliseconds / factor));
|
||||
string endTime = string.Format(timeFormat, p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, (int)Math.Round(p.EndTime.Milliseconds / factor));
|
||||
sb.Append(string.Format(paragraphWriteFormat, startTime, endTime, DvdStudioPro.EncodeStyles(p.Text)));
|
||||
sb.AppendFormat(paragraphWriteFormat, startTime, endTime, DvdStudioPro.EncodeStyles(p.Text));
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ $HorzAlign = Center
|
||||
double factor = (1000.0 / Configuration.Settings.General.CurrentFrameRate);
|
||||
string startTime = string.Format(timeFormat, p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, (int)Math.Round(p.StartTime.Milliseconds / factor));
|
||||
string endTime = string.Format(timeFormat, p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, (int)Math.Round(p.EndTime.Milliseconds / factor));
|
||||
sb.Append(string.Format(paragraphWriteFormat, startTime, endTime, DvdStudioPro.EncodeStyles(p.Text)));
|
||||
sb.AppendFormat(paragraphWriteFormat, startTime, endTime, DvdStudioPro.EncodeStyles(p.Text));
|
||||
}
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
if (fileName.ToLower().EndsWith(".elr"))
|
||||
{
|
||||
byte[] buffer = Utilities.ReadAllBytes(fileName);
|
||||
byte[] compareBuffer = new byte[] { 0x05, 0x01, 0x0D, 0x15, 0x11, 0x00, 0xA9, 0x00, 0x45, 0x00, 0x6C, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x20, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00 };
|
||||
byte[] compareBuffer = { 0x05, 0x01, 0x0D, 0x15, 0x11, 0x00, 0xA9, 0x00, 0x45, 0x00, 0x6C, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x20, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00 };
|
||||
|
||||
for (int i = 6; i < compareBuffer.Length; i++)
|
||||
if (buffer[i] != compareBuffer[i])
|
||||
|
@ -482,7 +482,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
header.TotalNumberOfSubtitles = (subtitle.Paragraphs.Count.ToString()).PadLeft(5, '0'); // seems to be 1 higher than actual number of subtitles
|
||||
header.TotalNumberOfTextAndTimingInformationBlocks = header.TotalNumberOfSubtitles;
|
||||
|
||||
string today = string.Format("{0:00}{1:00}{2:00}", DateTime.Now.Year.ToString().Remove(0, 2), DateTime.Now.Month, DateTime.Now.Day);
|
||||
string today = string.Format("{0}{1:00}{2:00}", DateTime.Now.Year.ToString().Remove(0, 2), DateTime.Now.Month, DateTime.Now.Day);
|
||||
if (today.Length == 6)
|
||||
{
|
||||
header.CreationDate = today;
|
||||
@ -510,9 +510,9 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
if (!int.TryParse(header.MaximumNumberOfDisplayableRows, out rows))
|
||||
rows = 23;
|
||||
|
||||
if (header != null && header.DisplayStandardCode == "1" || header.DisplayStandardCode == "2") // teletext
|
||||
if (header.DisplayStandardCode == "1" || header.DisplayStandardCode == "2") // teletext
|
||||
rows = 23;
|
||||
else if (header != null && header.DisplayStandardCode == "0" && header.MaximumNumberOfDisplayableRows == "02") // open subtitling
|
||||
else if (header.DisplayStandardCode == "0" && header.MaximumNumberOfDisplayableRows == "02") // open subtitling
|
||||
rows = 15;
|
||||
|
||||
if (p.Text.StartsWith("{\\an7}") || p.Text.StartsWith("{\\an8}") || p.Text.StartsWith("{\\an9}"))
|
||||
@ -1011,7 +1011,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b >= 0 && b <= 0x17)
|
||||
if (b <= 0x17)
|
||||
{
|
||||
switch (b)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
// if (p.StartTime.TotalMilliseconds == lastEndTimeMilliseconds)
|
||||
sb.Append(string.Format("{0}{1}", Utilities.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime)));
|
||||
sb.AppendFormat("{0}{1}", Utilities.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime));
|
||||
//else
|
||||
// sb.Append(string.Format("{0}{1}{2}", EncodeTimeCode(p.StartTime), Utilities.RemoveHtmlTags(p.Text), EncodeTimeCode(p.EndTime)));
|
||||
lastEndTimeMilliseconds = p.EndTime.TotalMilliseconds;
|
||||
@ -79,7 +79,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
Paragraph p = null;
|
||||
subtitle.Paragraphs.Clear();
|
||||
var arr = text.ToString().Trim().Split("#".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
var arr = text.Trim().Split("#".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
var currentText = new StringBuilder();
|
||||
foreach (string line in arr)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
var p = new Paragraph();
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "text":
|
||||
p.Text = innerNode.InnerText.Replace("\\N", Environment.NewLine);
|
||||
|
@ -112,7 +112,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
StringBuilder pText = new StringBuilder();
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "br":
|
||||
pText.AppendLine();
|
||||
|
@ -60,11 +60,8 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
count++;
|
||||
bool italic = false;
|
||||
if (p.Text.StartsWith("<i>") && p.Text.EndsWith("</i>"))
|
||||
italic = true;
|
||||
string text = Utilities.RemoveHtmlTags(p.Text);
|
||||
if (italic)
|
||||
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));
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
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);
|
||||
if (next == null || (next != null && Math.Abs(p.EndTime.TotalMilliseconds - next.StartTime.TotalMilliseconds) > 50))
|
||||
if (next == null || Math.Abs(p.EndTime.TotalMilliseconds - next.StartTime.TotalMilliseconds) > 50)
|
||||
{
|
||||
count++;
|
||||
sb.AppendLine(string.Format("{0}\t{1}", count.ToString().PadLeft(5, ' '), MakeTimeCode(p.EndTime)));
|
||||
|
@ -117,8 +117,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
double startSeconds;
|
||||
double endSeconds;
|
||||
if (double.TryParse(start, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out startSeconds) &&
|
||||
double.TryParse(end, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out endSeconds) &&
|
||||
text != null)
|
||||
double.TryParse(end, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out endSeconds))
|
||||
{
|
||||
subtitle.Paragraphs.Add(new Paragraph(DecodeJsonText(text), startSeconds * 1000.0, endSeconds * 1000.0));
|
||||
}
|
||||
|
@ -71,8 +71,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
double startSeconds;
|
||||
double endSeconds;
|
||||
if (double.TryParse(start, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out startSeconds) &&
|
||||
double.TryParse(end, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out endSeconds) &&
|
||||
text != null)
|
||||
double.TryParse(end, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out endSeconds))
|
||||
{
|
||||
subtitle.Paragraphs.Add(new Paragraph(Json.DecodeJsonText(text), startSeconds, endSeconds));
|
||||
}
|
||||
|
@ -74,8 +74,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
double startSeconds;
|
||||
double durationSeconds;
|
||||
if (double.TryParse(start, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out startSeconds) &&
|
||||
double.TryParse(duration, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out durationSeconds) &&
|
||||
content != null)
|
||||
double.TryParse(duration, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out durationSeconds))
|
||||
{
|
||||
subtitle.Paragraphs.Add(new Paragraph(Json.DecodeJsonText(content), startSeconds, startSeconds + durationSeconds));
|
||||
}
|
||||
|
@ -79,8 +79,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
double startSeconds;
|
||||
double endSeconds;
|
||||
if (double.TryParse(start, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out startSeconds) &&
|
||||
double.TryParse(end, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out endSeconds) &&
|
||||
content != null)
|
||||
double.TryParse(end, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out endSeconds))
|
||||
{
|
||||
subtitle.Paragraphs.Add(new Paragraph(Json.DecodeJsonText(content), startSeconds * 1000.0, endSeconds * 1000.0));
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
lineSb.Append(pre + s + singlePost);
|
||||
count++;
|
||||
}
|
||||
text = lineSb.ToString() + post;
|
||||
text = lineSb + post;
|
||||
subtitle.Paragraphs.Add(new Paragraph(startFrame, endFrame, text));
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
StringBuilder pText = new StringBuilder();
|
||||
foreach (XmlNode innerNode in text.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "br":
|
||||
pText.AppendLine();
|
||||
|
@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
StringBuilder pText = new StringBuilder();
|
||||
foreach (XmlNode innerNode in node.ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "key":
|
||||
lastKey = innerNode.InnerText;
|
||||
|
@ -1142,7 +1142,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fix italic tags, lines starting with ">" - whole line is italic, words between <> is italic
|
||||
/// Fix italic tags, lines starting with ">" - whole line is italic, words between <> is italic
|
||||
/// </summary>
|
||||
private static string FixItalics(string text)
|
||||
{
|
||||
@ -1225,7 +1225,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < LatinLetters.Count; i++)
|
||||
sb.Append(LatinLetters[i]);
|
||||
string latinLetters = sb.ToString() + "ABCDEFGHIJKLMNOPPQRSTUVWXYZÆØÅÄÖÜabcdefghijklmnopqrstuvwxyzæøäåü(1234567890, .!?-\r\n'\")";
|
||||
string latinLetters = sb + "ABCDEFGHIJKLMNOPPQRSTUVWXYZÆØÅÄÖÜabcdefghijklmnopqrstuvwxyzæøäåü(1234567890, .!?-\r\n'\")";
|
||||
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
|
||||
{
|
||||
if (!latinLetters.Contains(ch.ToString()))
|
||||
@ -1253,7 +1253,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
sb = new StringBuilder();
|
||||
for (int i = 0; i < ArabicLetters.Count; i++)
|
||||
sb.Append(ArabicLetters[i]);
|
||||
string arabicLetters = sb.ToString() + "(1234567890, .!?-\r\n'\")";
|
||||
string arabicLetters = sb + "(1234567890, .!?-\r\n'\")";
|
||||
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
|
||||
{
|
||||
if (!arabicLetters.Contains(ch.ToString()))
|
||||
@ -1269,7 +1269,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
sb = new StringBuilder();
|
||||
for (int i = 0; i < HebrewLetters.Count; i++)
|
||||
sb.Append(HebrewLetters[i]);
|
||||
string hebrewLetters = sb.ToString() + "(1234567890, .!?-\r\n'\")";
|
||||
string hebrewLetters = sb + "(1234567890, .!?-\r\n'\")";
|
||||
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
|
||||
{
|
||||
if (!hebrewLetters.Contains(ch.ToString()))
|
||||
@ -1285,7 +1285,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
sb = new StringBuilder();
|
||||
for (int i = 0; i < CyrillicLetters.Count; i++)
|
||||
sb.Append(CyrillicLetters[i]);
|
||||
string cyrillicLetters = sb.ToString() + "(1234567890, .!?-\r\n'\")";
|
||||
string cyrillicLetters = sb + "(1234567890, .!?-\r\n'\")";
|
||||
foreach (char ch in Utilities.RemoveHtmlTags(p.Text, true))
|
||||
{
|
||||
if (!cyrillicLetters.Contains(ch.ToString()))
|
||||
|
@ -103,16 +103,13 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
else if (line.Trim().Length == 0)
|
||||
{
|
||||
if (p != null)
|
||||
{
|
||||
if (p.StartTime.TotalMilliseconds == 0 && p.EndTime.TotalMilliseconds == 0)
|
||||
_errorCount++;
|
||||
else
|
||||
subtitle.Paragraphs.Add(p);
|
||||
p = new Paragraph();
|
||||
}
|
||||
if (p.StartTime.TotalMilliseconds == 0 && p.EndTime.TotalMilliseconds == 0)
|
||||
_errorCount++;
|
||||
else
|
||||
subtitle.Paragraphs.Add(p);
|
||||
p = new Paragraph();
|
||||
}
|
||||
else if (line.Trim().Length > 0 && p != null)
|
||||
else if (line.Trim().Length > 0)
|
||||
{
|
||||
expectStartTime = true;
|
||||
p.Text = (p.Text + Environment.NewLine + line).Trim();
|
||||
@ -123,7 +120,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p != null && p.EndTime.TotalMilliseconds > 0)
|
||||
if (p.EndTime.TotalMilliseconds > 0)
|
||||
subtitle.Paragraphs.Add(p);
|
||||
|
||||
bool allNullEndTime = true;
|
||||
|
@ -148,7 +148,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
partial.Append(text.Substring(i, 1));
|
||||
}
|
||||
else if (tagOn)
|
||||
else
|
||||
{
|
||||
total.Append(text.Substring(i, 1));
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
string text = Utilities.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:00}",
|
||||
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,
|
||||
p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10,
|
||||
text));
|
||||
|
@ -39,7 +39,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
string text = Utilities.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:00}",
|
||||
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,
|
||||
p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds,
|
||||
p.Duration.Hours, p.Duration.Minutes, p.Duration.Seconds, p.Duration.Milliseconds,
|
||||
|
@ -52,7 +52,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
count++;
|
||||
string text = Utilities.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:00}" + Environment.NewLine,
|
||||
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),
|
||||
p.Duration.Hours, p.Duration.Minutes, p.Duration.Seconds, MillisecondsToFramesMaxFrameRate(p.Duration.Milliseconds),
|
||||
|
@ -38,7 +38,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
string text = Utilities.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:00}",
|
||||
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,
|
||||
p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10,
|
||||
text));
|
||||
|
@ -39,7 +39,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
string text = Utilities.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:00}" + Environment.NewLine,
|
||||
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,
|
||||
p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10,
|
||||
text, p.Number));
|
||||
|
@ -59,7 +59,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
string s = p.Text.Replace(Environment.NewLine + Environment.NewLine, Environment.NewLine).Replace(Environment.NewLine + Environment.NewLine, Environment.NewLine);
|
||||
sb.Append(string.Format(paragraphWriteFormat, p.Number, p.StartTime, p.EndTime, s));
|
||||
sb.AppendFormat(paragraphWriteFormat, p.Number, p.StartTime, p.EndTime, s);
|
||||
}
|
||||
return sb.ToString().Trim() + Environment.NewLine + Environment.NewLine;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
|
||||
if (styleFound)
|
||||
{
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
|
||||
subtitle.Header = sb.ToString();
|
||||
}
|
||||
else
|
||||
@ -284,7 +284,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
|
||||
if (stylexmlCount > 0)
|
||||
{
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles.ToString()));
|
||||
sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
|
||||
subtitle.Header = sb.ToString();
|
||||
}
|
||||
else
|
||||
|
@ -63,7 +63,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
******** END SCRIPT ********
|
||||
";
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(string.Format(header, title));
|
||||
sb.AppendFormat(header, title);
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
string text = Utilities.RemoveHtmlTags(p.Text.Replace(Environment.NewLine, "|"));
|
||||
|
@ -54,7 +54,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
//00:00:06.61,00:00:13.75
|
||||
//text1[br]text2
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(string.Format(header, title));
|
||||
sb.AppendFormat(header, title);
|
||||
foreach (Paragraph p in subtitle.Paragraphs)
|
||||
{
|
||||
string text = p.Text.Replace(Environment.NewLine, "[br]");
|
||||
|
@ -301,7 +301,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
var pText = new StringBuilder();
|
||||
foreach (XmlNode innerNode in node.SelectSingleNode("Text").ChildNodes)
|
||||
{
|
||||
switch (innerNode.Name.ToString())
|
||||
switch (innerNode.Name)
|
||||
{
|
||||
case "br":
|
||||
pText.AppendLine();
|
||||
|
@ -447,7 +447,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
{
|
||||
if (last.EndTime.TotalMilliseconds == 0)
|
||||
last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + 2500;
|
||||
if (last != null && last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
|
||||
if (last.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
|
||||
last.EndTime.TotalMilliseconds = last.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(last.Text);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
if (i > 0)
|
||||
sb.Append(",");
|
||||
sb.Append("{");
|
||||
sb.Append(string.Format("\"content\":\"{0}\",\"start_time\":{1},\"end_time\":{2}", p.Text.Replace(Environment.NewLine, " <br> "), p.StartTime.TotalMilliseconds, p.EndTime.TotalMilliseconds));
|
||||
sb.AppendFormat("\"content\":\"{0}\",\"start_time\":{1},\"end_time\":{2}", p.Text.Replace(Environment.NewLine, " <br> "), p.StartTime.TotalMilliseconds, p.EndTime.TotalMilliseconds);
|
||||
sb.Append("}");
|
||||
i++;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
lineSb.Append(s);
|
||||
count++;
|
||||
}
|
||||
text = lineSb.ToString() + post;
|
||||
text = lineSb + post;
|
||||
subtitle.Paragraphs.Add(new Paragraph(startTime, endTime, text));
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user