Fix in new format

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2101 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-09-18 19:20:28 +00:00
parent 1142d27837
commit f3efda827a

View File

@ -33,6 +33,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
return subtitle.Paragraphs.Count > _errorCount; return subtitle.Paragraphs.Count > _errorCount;
} }
private int GetMaxCharsForDuration(double durationSeconds)
{
return (int)Math.Round(15.7 * durationSeconds);
}
public override string ToText(Subtitle subtitle, string title) public override string ToText(Subtitle subtitle, string title)
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
@ -58,7 +63,7 @@ ATTENTION : Pas plus de 40 caractères PAR LIGNE
{ {
index++; index++;
string text = Utilities.RemoveHtmlTags(p.Text); string text = Utilities.RemoveHtmlTags(p.Text);
sb.AppendLine(string.Format("* {0} :\t{1}\t{2}\t{3}{4}{5}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), text.Length + "c", Environment.NewLine, text)); sb.AppendLine(string.Format("* {0} :\t{1}\t{2}\t{3}{4}{5}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), GetMaxCharsForDuration(p.Duration.TotalSeconds) + "c", Environment.NewLine, text));
sb.AppendLine(); sb.AppendLine();
if (!text.Contains(Environment.NewLine)) if (!text.Contains(Environment.NewLine))
sb.AppendLine(); sb.AppendLine();