Added new subtitle format + ZPosition for Dcinema interop

This commit is contained in:
niksedk 2014-03-01 22:26:07 +01:00
parent ed3c1af017
commit dac14dfb90
13 changed files with 284 additions and 45 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@
/SE*.zip
/SubtitleEdit-*-setup.exe
/src/SubtitleEdit.csproj.user
/src/Languages/Language.xml

View File

@ -3,9 +3,10 @@
3.3.15 (x March 2014)
* NEW:
* Added new subtitle format
* Added new subtitle formats
* IMPROVED:
* Updated French language file - thx JM GBT
* Added ZPosition setting for Dcinema interop - thx Joseph
* FIXED:
* Minor fix for ass import in Matroska (mkv) files

View File

@ -35,6 +35,10 @@
this.numericUpDownReelNumber = new System.Windows.Forms.NumericUpDown();
this.buttonGenerateID = new System.Windows.Forms.Button();
this.groupBoxFont = new System.Windows.Forms.GroupBox();
this.numericUpDownZPosition = new System.Windows.Forms.NumericUpDown();
this.labelZPosition = new System.Windows.Forms.Label();
this.numericUpDownTopBottomMargin = new System.Windows.Forms.NumericUpDown();
this.labelTopBottomMargin = new System.Windows.Forms.Label();
this.buttonFontEffectColor = new System.Windows.Forms.Button();
this.panelFontColor = new System.Windows.Forms.Panel();
this.buttonFontColor = new System.Windows.Forms.Button();
@ -56,13 +60,13 @@
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.numericUpDownTopBottomMargin = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.labelZPositionHelp = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownReelNumber)).BeginInit();
this.groupBoxFont.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownZPosition)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTopBottomMargin)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit();
this.SuspendLayout();
//
// panelFontEffectColor
@ -91,7 +95,7 @@
this.groupBox1.Controls.Add(this.labelSubtitleID);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(537, 364);
this.groupBox1.Size = new System.Drawing.Size(597, 419);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
@ -150,8 +154,11 @@
this.groupBoxFont.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxFont.Controls.Add(this.labelZPositionHelp);
this.groupBoxFont.Controls.Add(this.numericUpDownZPosition);
this.groupBoxFont.Controls.Add(this.labelZPosition);
this.groupBoxFont.Controls.Add(this.numericUpDownTopBottomMargin);
this.groupBoxFont.Controls.Add(this.label2);
this.groupBoxFont.Controls.Add(this.labelTopBottomMargin);
this.groupBoxFont.Controls.Add(this.panelFontEffectColor);
this.groupBoxFont.Controls.Add(this.buttonFontEffectColor);
this.groupBoxFont.Controls.Add(this.panelFontColor);
@ -168,11 +175,74 @@
this.groupBoxFont.Controls.Add(this.labelFontUri);
this.groupBoxFont.Location = new System.Drawing.Point(6, 141);
this.groupBoxFont.Name = "groupBoxFont";
this.groupBoxFont.Size = new System.Drawing.Size(525, 217);
this.groupBoxFont.Size = new System.Drawing.Size(585, 272);
this.groupBoxFont.TabIndex = 5;
this.groupBoxFont.TabStop = false;
this.groupBoxFont.Text = "Font";
//
// numericUpDownZPosition
//
this.numericUpDownZPosition.DecimalPlaces = 2;
this.numericUpDownZPosition.Increment = new decimal(new int[] {
5,
0,
0,
131072});
this.numericUpDownZPosition.Location = new System.Drawing.Point(133, 207);
this.numericUpDownZPosition.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDownZPosition.Minimum = new decimal(new int[] {
10,
0,
0,
-2147483648});
this.numericUpDownZPosition.Name = "numericUpDownZPosition";
this.numericUpDownZPosition.Size = new System.Drawing.Size(112, 20);
this.numericUpDownZPosition.TabIndex = 33;
//
// labelZPosition
//
this.labelZPosition.AutoSize = true;
this.labelZPosition.Location = new System.Drawing.Point(9, 210);
this.labelZPosition.Name = "labelZPosition";
this.labelZPosition.Size = new System.Drawing.Size(53, 13);
this.labelZPosition.TabIndex = 32;
this.labelZPosition.Text = "Z-position";
//
// numericUpDownTopBottomMargin
//
this.numericUpDownTopBottomMargin.Location = new System.Drawing.Point(133, 181);
this.numericUpDownTopBottomMargin.Maximum = new decimal(new int[] {
50,
0,
0,
0});
this.numericUpDownTopBottomMargin.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownTopBottomMargin.Name = "numericUpDownTopBottomMargin";
this.numericUpDownTopBottomMargin.Size = new System.Drawing.Size(112, 20);
this.numericUpDownTopBottomMargin.TabIndex = 31;
this.numericUpDownTopBottomMargin.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// labelTopBottomMargin
//
this.labelTopBottomMargin.AutoSize = true;
this.labelTopBottomMargin.Location = new System.Drawing.Point(9, 184);
this.labelTopBottomMargin.Name = "labelTopBottomMargin";
this.labelTopBottomMargin.Size = new System.Drawing.Size(97, 13);
this.labelTopBottomMargin.TabIndex = 30;
this.labelTopBottomMargin.Text = "Top/bottom margin";
//
// buttonFontEffectColor
//
this.buttonFontEffectColor.Location = new System.Drawing.Point(133, 128);
@ -344,7 +414,7 @@
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(474, 382);
this.buttonCancel.Location = new System.Drawing.Point(534, 437);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
this.buttonCancel.TabIndex = 2;
@ -356,7 +426,7 @@
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(393, 382);
this.buttonOK.Location = new System.Drawing.Point(453, 437);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
this.buttonOK.TabIndex = 1;
@ -364,42 +434,22 @@
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// numericUpDownTopBottomMargin
// labelZPositionHelp
//
this.numericUpDownTopBottomMargin.Location = new System.Drawing.Point(133, 181);
this.numericUpDownTopBottomMargin.Maximum = new decimal(new int[] {
50,
0,
0,
0});
this.numericUpDownTopBottomMargin.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownTopBottomMargin.Name = "numericUpDownTopBottomMargin";
this.numericUpDownTopBottomMargin.Size = new System.Drawing.Size(112, 20);
this.numericUpDownTopBottomMargin.TabIndex = 31;
this.numericUpDownTopBottomMargin.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 184);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(97, 13);
this.label2.TabIndex = 30;
this.label2.Text = "Top/bottom margin";
this.labelZPositionHelp.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelZPositionHelp.ForeColor = System.Drawing.Color.Gray;
this.labelZPositionHelp.Location = new System.Drawing.Point(252, 213);
this.labelZPositionHelp.Name = "labelZPositionHelp";
this.labelZPositionHelp.Size = new System.Drawing.Size(327, 47);
this.labelZPositionHelp.TabIndex = 34;
this.labelZPositionHelp.Text = "Positive numbers moves text away, negative numbers moves text closer, if z-positi" +
"on zeo then it\'s normal \r\n2D";
//
// DCinemaPropertiesInterop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(561, 415);
this.ClientSize = new System.Drawing.Size(621, 470);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
@ -417,8 +467,9 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownReelNumber)).EndInit();
this.groupBoxFont.ResumeLayout(false);
this.groupBoxFont.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownZPosition)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTopBottomMargin)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).EndInit();
this.ResumeLayout(false);
}
@ -454,6 +505,9 @@
private System.Windows.Forms.ComboBox comboBoxLanguage;
private System.Windows.Forms.Label labelLanguage;
private System.Windows.Forms.NumericUpDown numericUpDownTopBottomMargin;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label labelTopBottomMargin;
private System.Windows.Forms.NumericUpDown numericUpDownZPosition;
private System.Windows.Forms.Label labelZPosition;
private System.Windows.Forms.Label labelZPositionHelp;
}
}

View File

@ -32,6 +32,13 @@ namespace Nikse.SubtitleEdit.Forms
buttonFontEffectColor.Text = l.ChooseColor;
labelFontSize.Text = l.FontSize;
if (!string.IsNullOrEmpty(l.TopBottomMargin)) //TODO: Remove in SE 3.4
{
labelTopBottomMargin.Text = l.TopBottomMargin;
labelZPosition.Text = l.ZPosition;
labelZPositionHelp.Text = l.ZPositionHelp;
}
this._subtitle = _subtitle;
this._videoFileName = _videoFileName;
@ -69,6 +76,15 @@ namespace Nikse.SubtitleEdit.Forms
numericUpDownTopBottomMargin.Value = Configuration.Settings.SubtitleSettings.DCinemaBottomMargin;
else
numericUpDownTopBottomMargin.Value = 8;
decimal zPosition = (decimal)Configuration.Settings.SubtitleSettings.DCinemaZPosition;
if (numericUpDownZPosition.Minimum <= zPosition &&
numericUpDownZPosition.Maximum >= zPosition)
numericUpDownZPosition.Value = zPosition;
else
numericUpDownZPosition.Value = 0;
}
FixLargeFonts();
}
@ -130,6 +146,7 @@ namespace Nikse.SubtitleEdit.Forms
ss.CurrentDCinemaFontEffectColor = panelFontEffectColor.BackColor;
ss.CurrentDCinemaFontSize = (int)numericUpDownFontSize.Value;
Configuration.Settings.SubtitleSettings.DCinemaBottomMargin = (int)numericUpDownTopBottomMargin.Value;
Configuration.Settings.SubtitleSettings.DCinemaZPosition = (double)numericUpDownZPosition.Value;
DialogResult = DialogResult.OK;
}

View File

@ -879,7 +879,8 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
else if (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)
else if (Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime &&
prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)
{
if (AllowFix(p, fixAction))
{
@ -922,7 +923,8 @@ namespace Nikse.SubtitleEdit.Forms
AddFixToListView(p, fixAction, oldCurrent, p.ToString());
}
}
else if (temp.Duration.TotalMilliseconds - p.Duration.TotalMilliseconds < 1500 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds ))
else if (Configuration.Settings.Tools.FixShortDisplayTimesAllowMoveStartTime &&
temp.Duration.TotalMilliseconds - p.Duration.TotalMilliseconds < 1500 && (prev == null || prev.EndTime.TotalMilliseconds < p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds ))
{
if (AllowFix(p, fixAction))
{

View File

@ -393,6 +393,9 @@ namespace Nikse.SubtitleEdit.Logic
FontEffect = "Effect",
FontEffectColor = "Effect color",
FontSize = "Size",
TopBottomMargin = "Top/bottom margin",
ZPosition = "Z-position",
ZPositionHelp = "Positive numbers moves text away, negative numbers moves text closer, if z-position is zero then it's 2D",
ChooseColor = "Choose color...",
Generate = "Generate",
};

View File

@ -283,6 +283,9 @@
public string FontEffect { get; set; }
public string FontEffectColor { get; set; }
public string FontSize { get; set; }
public string TopBottomMargin { get; set; }
public string ZPosition { get; set; }
public string ZPositionHelp { get; set; }
public string ChooseColor { get; set; }
public string Generate { get; set; }
}

View File

@ -75,6 +75,7 @@ namespace Nikse.SubtitleEdit.Logic
public int EndSceneIndex { get; set; }
public int VerifyPlaySeconds { get; set; }
public int MergeLinesShorterThan { get; set; }
public bool FixShortDisplayTimesAllowMoveStartTime { get; set; }
public string MusicSymbol { get; set; }
public string MusicSymbolToReplace { get; set; }
public string UnicodeSymbolsToInsert { get; set; }
@ -150,6 +151,7 @@ namespace Nikse.SubtitleEdit.Logic
EndSceneIndex = 1;
VerifyPlaySeconds = 2;
MergeLinesShorterThan = 33;
FixShortDisplayTimesAllowMoveStartTime = true;
MusicSymbol = "♪";
MusicSymbolToReplace = "♪ ⶠ♪ âTª ã¢â™âª ?t×3 ?t¤3 #";
UnicodeSymbolsToInsert = "♪;♫;☺;☹;♥;©;☮;☯;Σ;∞;≡;⇒;π";
@ -218,6 +220,7 @@ namespace Nikse.SubtitleEdit.Logic
public string DCinemaLoadFontResource { get; set; }
public int DCinemaFontSize { get; set; }
public int DCinemaBottomMargin { get; set; }
public double DCinemaZPosition { get; set; }
public int DCinemaFadeUpDownTime { get; set; }
public string CurrentDCinemaSubtitleId { get; set; }
@ -261,6 +264,7 @@ namespace Nikse.SubtitleEdit.Logic
DCinemaLoadFontResource = "urn:uuid:3dec6dc0-39d0-498d-97d0-928d2eb78391";
DCinemaFontSize = 42;
DCinemaBottomMargin = 8;
DCinemaZPosition = 0;
DCinemaFadeUpDownTime = 5;
SamiDisplayTwoClassesAsTwoSubtitles = true;
@ -1415,6 +1419,9 @@ namespace Nikse.SubtitleEdit.Logic
subNode = node.SelectSingleNode("MergeLinesShorterThan");
if (subNode != null)
settings.Tools.MergeLinesShorterThan = Convert.ToInt32(subNode.InnerText);
subNode = node.SelectSingleNode("FixShortDisplayTimesAllowMoveStartTime");
if (subNode != null)
settings.Tools.FixShortDisplayTimesAllowMoveStartTime = Convert.ToBoolean(subNode.InnerText);
subNode = node.SelectSingleNode("MusicSymbol");
if (subNode != null)
settings.Tools.MusicSymbol = subNode.InnerText;
@ -1647,7 +1654,10 @@ namespace Nikse.SubtitleEdit.Logic
settings.SubtitleSettings.DCinemaFontSize = Convert.ToInt32(subNode.InnerText);
subNode = node.SelectSingleNode("DCinemaBottomMargin");
if (subNode != null)
settings.SubtitleSettings.DCinemaBottomMargin = Convert.ToInt32(subNode.InnerText);
settings.SubtitleSettings.DCinemaBottomMargin = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
subNode = node.SelectSingleNode("DCinemaZPosition");
if (subNode != null)
settings.SubtitleSettings.DCinemaZPosition = Convert.ToDouble(subNode.InnerText);
subNode = node.SelectSingleNode("DCinemaFadeUpDownTime");
if (subNode != null)
settings.SubtitleSettings.DCinemaFadeUpDownTime = Convert.ToInt32(subNode.InnerText);
@ -2559,6 +2569,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("EndSceneIndex", settings.Tools.EndSceneIndex.ToString());
textWriter.WriteElementString("VerifyPlaySeconds", settings.Tools.VerifyPlaySeconds.ToString());
textWriter.WriteElementString("MergeLinesShorterThan", settings.Tools.MergeLinesShorterThan.ToString());
textWriter.WriteElementString("FixShortDisplayTimesAllowMoveStartTime", settings.Tools.FixShortDisplayTimesAllowMoveStartTime.ToString());
textWriter.WriteElementString("MusicSymbol", settings.Tools.MusicSymbol);
textWriter.WriteElementString("MusicSymbolToReplace", settings.Tools.MusicSymbolToReplace);
textWriter.WriteElementString("UnicodeSymbolsToInsert", settings.Tools.UnicodeSymbolsToInsert);
@ -2639,6 +2650,7 @@ namespace Nikse.SubtitleEdit.Logic
textWriter.WriteElementString("DCinemaFontFile", settings.SubtitleSettings.DCinemaFontFile);
textWriter.WriteElementString("DCinemaFontSize", settings.SubtitleSettings.DCinemaFontSize.ToString());
textWriter.WriteElementString("DCinemaBottomMargin", settings.SubtitleSettings.DCinemaBottomMargin.ToString());
textWriter.WriteElementString("DCinemaZPosition", settings.SubtitleSettings.DCinemaZPosition.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("DCinemaFadeUpDownTime", settings.SubtitleSettings.DCinemaFadeUpDownTime.ToString());
textWriter.WriteElementString("SamiDisplayTwoClassesAsTwoSubtitles", settings.SubtitleSettings.SamiDisplayTwoClassesAsTwoSubtitles.ToString());
textWriter.WriteElementString("SamiFullHtmlEncode", settings.SubtitleSettings.SamiFullHtmlEncode.ToString());

View File

@ -210,6 +210,13 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
vPosition.InnerText = vPos.ToString();
textNode.Attributes.Append(vPosition);
if (Configuration.Settings.SubtitleSettings.DCinemaZPosition != 0)
{
XmlAttribute zPosition = xml.CreateAttribute("ZPosition");
zPosition.InnerText = string.Format(CultureInfo.InvariantCulture, "{0:0.00}", Configuration.Settings.SubtitleSettings.DCinemaZPosition);
textNode.Attributes.Append(zPosition);
}
XmlAttribute vAlign = xml.CreateAttribute("VAlign");
if (alignVTop)
vAlign.InnerText = "top";

View File

@ -111,6 +111,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
new SwiftTextLineNumber(),
new Tek(),
new TimeXml(),
new TimeXml2(),
new TimedText10(),
new TimedText200604(),
new TimedText(),

View File

@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{
public class TimeXml2 : SubtitleFormat
{
public override string Extension
{
get { return ".xml"; }
}
public override string Name
{
get { return "Xml 2"; }
}
public override bool IsTimeBased
{
get { return true; }
}
public override bool IsMine(List<string> lines, string fileName)
{
Subtitle subtitle = new Subtitle();
this.LoadSubtitle(subtitle, lines, fileName);
return subtitle.Paragraphs.Count > 0;
}
public override string ToText(Subtitle subtitle, string title)
{
string xmlStructure =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + Environment.NewLine +
"<Subtitles/>";
XmlDocument xml = new XmlDocument();
xml.LoadXml(xmlStructure);
foreach (Paragraph p in subtitle.Paragraphs)
{
XmlNode paragraph = xml.CreateElement("Subtitle");
XmlNode number = xml.CreateElement("Number");
number.InnerText = p.Number.ToString();
paragraph.AppendChild(number);
XmlNode start = xml.CreateElement("Start");
start.InnerText = p.StartTime.ToString();
paragraph.AppendChild(start);
XmlNode end = xml.CreateElement("End");
end.InnerText = p.EndTime.ToString();
paragraph.AppendChild(end);
XmlNode duration = xml.CreateElement("Duration");
duration.InnerText = p.Duration.ToShortString();
paragraph.AppendChild(duration);
XmlNode text = xml.CreateElement("Text");
text.InnerText = Utilities.RemoveHtmlTags(p.Text);
paragraph.AppendChild(text);
xml.DocumentElement.AppendChild(paragraph);
}
return ToUtf8XmlString(xml);
}
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
{
_errorCount = 0;
StringBuilder sb = new StringBuilder();
lines.ForEach(line => sb.AppendLine(line));
string xmlString = sb.ToString();
if (!xmlString.Contains("<Subtitles>") || !xmlString.Contains("<Text>") || !xmlString.Contains("<Duration>"))
return;
XmlDocument xml = new XmlDocument();
try
{
xml.LoadXml(xmlString);
}
catch
{
_errorCount = 1;
return;
}
foreach (XmlNode node in xml.DocumentElement.SelectNodes("Subtitle"))
{
try
{
TimeCode startTimeCode = DecodeTimeCode(node.SelectSingleNode("Start").InnerText);
TimeCode endTimeCode = DecodeTimeCode(node.SelectSingleNode("End").InnerText);
string text = node.SelectSingleNode("Text").InnerText;
subtitle.Paragraphs.Add(new Paragraph(startTimeCode, endTimeCode, text));
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
_errorCount++;
}
}
subtitle.Renumber(1);
}
private TimeCode DecodeTimeCode(string p)
{
var parts = p.Split(";.:,".ToCharArray());
string hour = parts[0];
string minutes = parts[1];
string seconds = parts[2];
string ms = parts[3];
TimeCode tc = new TimeCode(int.Parse(hour), int.Parse(minutes), int.Parse(seconds), (int.Parse(ms)));
return tc;
}
}
}

View File

@ -876,6 +876,7 @@
<Compile Include="Logic\SubtitleFormats\CaraokeXml.cs" />
<Compile Include="Logic\SubtitleFormats\Cavena890.cs" />
<Compile Include="Logic\SubtitleFormats\CheetahCaption.cs" />
<Compile Include="Logic\SubtitleFormats\TimeXml2.cs" />
<Compile Include="Logic\SubtitleFormats\OresmeDocXDocument.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle68.cs" />
<Compile Include="Logic\SubtitleFormats\FinalCutProXml13.cs" />

View File

@ -41,7 +41,16 @@ namespace Test
{
string s1 = "Gledaj prema kameri i rici <i>zdravo!";
string s2 = Utilities.FixInvalidItalicTags(s1);
Assert.AreEqual(s1.Replace("<i>", string.Empty), s2);
Assert.AreEqual(s2, "Gledaj prema kameri i rici zdravo!");
}
[TestMethod]
[DeploymentItem("SubtitleEdit.exe")]
public void FixInvalidItalicTags3()
{
string s1 = "<i>Line 1.</i>" + Environment.NewLine + "<i>Line 2.";
string s2 = Utilities.FixInvalidItalicTags(s1);
Assert.AreEqual(s2, "<i>Line 1." + Environment.NewLine + "Line 2.</i>");
}