Add some retry when batch writing files

This commit is contained in:
niksedk 2023-02-01 09:35:18 +01:00
parent 166a56f7f7
commit aca715115f

View File

@ -1383,8 +1383,25 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
sub.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResY", "PlayResY: " + resolution.Value.Y.ToString(CultureInfo.InvariantCulture), "[Script Info]", sub.Header); sub.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResY", "PlayResY: " + resolution.Value.Y.ToString(CultureInfo.InvariantCulture), "[Script Info]", sub.Header);
} }
try
{
FileUtil.WriteAllText(outputFileName, sub.ToText(sf), targetEncoding); FileUtil.WriteAllText(outputFileName, sub.ToText(sf), targetEncoding);
} }
catch
{
Thread.Sleep(100);
try
{
FileUtil.WriteAllText(outputFileName, sub.ToText(sf), targetEncoding);
}
catch
{
Thread.Sleep(500);
FileUtil.WriteAllText(outputFileName, sub.ToText(sf), targetEncoding);
}
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {