Make sure temp files deleted

This commit is contained in:
Jaex 2022-09-03 19:15:49 +03:00
parent 0b2a4a7411
commit 804f1beab2

View file

@ -262,6 +262,7 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings);
screenshot.CaptureCursor = taskSettings.CaptureSettings.ScreenRecordShowCursor;
screenRecorder?.Dispose();
screenRecorder = new ScreenRecorder(ScreenRecordOutput.FFmpeg, options, screenshot, captureRectangle);
screenRecorder.RecordingStarted += ScreenRecorder_RecordingStarted;
screenRecorder.EncodingProgressChanged += ScreenRecorder_EncodingProgressChanged;
@ -313,12 +314,15 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
{
screenRecorder.Dispose();
screenRecorder = null;
if (abortRequested && !string.IsNullOrEmpty(path) && File.Exists(path))
{
File.Delete(path);
}
}
if (abortRequested)
{
FileHelpers.DeleteFile(path);
}
FileHelpers.DeleteFile(concatPath);
FileHelpers.DeleteFile(tempPath);
}).ContinueInCurrentContext(() =>
{
if (!abortRequested && !string.IsNullOrEmpty(path) && File.Exists(path) && TaskHelpers.ShowAfterCaptureForm(taskSettings, out string customFileName, null, path))