From 0f17615b10f33ad4c5c3e06c58697f698b2f9476 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 2 Sep 2023 23:14:16 +0200 Subject: [PATCH] Fix FileInUse --- Tranga/Jobs/JobBoss.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index 3be3204..d3d5583 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -151,9 +151,10 @@ public class JobBoss : GlobalBase public void ExportJobsList() { Log($"Exporting {settings.jobsFilePath}"); + string content = JsonConvert.SerializeObject(this.jobs); while(IsFileInUse(settings.jobsFilePath)) Thread.Sleep(10); - File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs)); + File.WriteAllText(settings.jobsFilePath, content); } public void CheckJobs()