From a8697a14a31e7a20047dd5694a03eb0297b47ee9 Mon Sep 17 00:00:00 2001 From: Glax Date: Wed, 28 Feb 2024 02:13:53 +0100 Subject: [PATCH] GlobalBase static is FileInUse --- Tranga/GlobalBase.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tranga/GlobalBase.cs b/Tranga/GlobalBase.cs index ebf4cd3..3e0e1b0 100644 --- a/Tranga/GlobalBase.cs +++ b/Tranga/GlobalBase.cs @@ -102,7 +102,9 @@ public abstract class GlobalBase File.WriteAllText(settings.libraryConnectorsFilePath, JsonConvert.SerializeObject(libraryConnectors)); } - protected bool IsFileInUse(string filePath) + protected bool IsFileInUse(string filePath) => IsFileInUse(filePath, this.logger); + + public static bool IsFileInUse(string filePath, Logger? logger) { if (!File.Exists(filePath)) return false; @@ -114,7 +116,7 @@ public abstract class GlobalBase } catch (IOException) { - Log($"File is in use {filePath}"); + logger?.WriteLine($"File is in use {filePath}"); return true; } }