Fixes for new JSON Aeneas - thx Cedric :)

This commit is contained in:
niksedk 2021-11-03 06:34:51 +01:00
parent 027328ea05
commit e3ea68ed11

View File

@ -15,7 +15,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
public override string ToText(Subtitle subtitle, string title)
{
var sb = new StringBuilder();
sb.AppendLine("{ \"fragments\": [");
sb.AppendLine("{" + Environment.NewLine + " \"fragments\": [");
for (int i = 0; i < subtitle.Paragraphs.Count; i++)
{
@ -33,9 +33,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
},");
}
var result = sb.ToString().TrimEnd(',') + @" ]
}";
var result = sb.ToString().Trim().TrimEnd(',') + Environment.NewLine + " ]" + Environment.NewLine + "}";
return result;
}
@ -44,10 +42,10 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var sb = new StringBuilder();
foreach (var line in text.SplitToLines())
{
sb.Append("\" " + Json.EncodeJsonText(line) + " \",");
sb.Append("\"" + Json.EncodeJsonText(line) + "\", ");
}
return sb.ToString().TrimEnd(',');
return sb.ToString().Trim().TrimEnd(',');
}
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)