From 1e7477b5cb2f660d3c01747ddd94fa3f2d68cd86 Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 7 Jun 2023 00:57:20 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=87=E4=BB=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Helper/ConfigurationHelper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MaaWpfGui/Helper/ConfigurationHelper.cs b/src/MaaWpfGui/Helper/ConfigurationHelper.cs index 6fd916bc14..3d8cc58700 100644 --- a/src/MaaWpfGui/Helper/ConfigurationHelper.cs +++ b/src/MaaWpfGui/Helper/ConfigurationHelper.cs @@ -177,7 +177,7 @@ namespace MaaWpfGui.Helper /// Save configuration file /// /// The result of saving process - private static bool Save() + private static bool Save(string file = null) { if (Released) { @@ -195,7 +195,7 @@ namespace MaaWpfGui.Helper { lock (_lock) { - File.WriteAllText(_configurationFile, jsonStr); + File.WriteAllText(file ?? _configurationFile, jsonStr); } } catch (Exception e) @@ -270,7 +270,7 @@ namespace MaaWpfGui.Helper public static void Release() { Save(); - File.Copy(_configurationFile, _configurationBakFile, true); + Save(_configurationBakFile); Released = true; }