Fix "Overwrite original files" in "Batch convert" - thx Steve :)

This commit is contained in:
niksedk 2019-08-21 08:06:40 +02:00
parent 3792a913d2
commit bc5f89af34

View File

@ -1259,19 +1259,19 @@ namespace Nikse.SubtitleEdit.Forms
try try
{ {
bool success; var binaryParagraphs = new List<IBinaryParagraph>();
List<IBinaryParagraph> binaryParagraphs = new List<IBinaryParagraph>(); if (p.FileName != null && p.FileName.EndsWith(".sup", StringComparison.OrdinalIgnoreCase) && FileUtil.IsBluRaySup(p.FileName) && AllowImageToImage())
if (p.FileName != null && p.FileName.EndsWith(".sup", StringComparison.OrdinalIgnoreCase) &&
FileUtil.IsBluRaySup(p.FileName) && AllowImageToImage())
{ {
binaryParagraphs = BluRaySupParser.ParseBluRaySup(p.FileName, new StringBuilder()).Cast<IBinaryParagraph>().ToList(); binaryParagraphs = BluRaySupParser.ParseBluRaySup(p.FileName, new StringBuilder()).Cast<IBinaryParagraph>().ToList();
} }
var dir = textBoxOutputFolder.Text; var dir = textBoxOutputFolder.Text;
var overwrite = checkBoxOverwrite.Checked;
if (checkBoxOverwriteOriginalFiles.Checked) if (checkBoxOverwriteOriginalFiles.Checked)
{ {
dir = Path.GetDirectoryName(p.FileName); dir = Path.GetDirectoryName(p.FileName);
overwrite = true;
} }
success = CommandLineConvert.BatchConvertSave(targetFormat, TimeSpan.Zero, GetCurrentEncoding(), dir, _count, ref _converted, ref _errors, _allFormats, p.FileName, p.Subtitle, p.SourceFormat, binaryParagraphs, checkBoxOverwrite.Checked, -1, null, null); var success = CommandLineConvert.BatchConvertSave(targetFormat, TimeSpan.Zero, GetCurrentEncoding(), dir, _count, ref _converted, ref _errors, _allFormats, p.FileName, p.Subtitle, p.SourceFormat, binaryParagraphs, overwrite, -1, null, null);
p.Item.SubItems[3].Text = success ? Configuration.Settings.Language.BatchConvert.Converted : Configuration.Settings.Language.BatchConvert.NotConverted; p.Item.SubItems[3].Text = success ? Configuration.Settings.Language.BatchConvert.Converted : Configuration.Settings.Language.BatchConvert.NotConverted;
} }
catch (Exception exception) catch (Exception exception)