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,7 +1383,24 @@ 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);
} }
FileUtil.WriteAllText(outputFileName, sub.ToText(sf), targetEncoding); try
{
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)