From c0f69b906f6e9837ec1aaa63e19a6f858a5b7413 Mon Sep 17 00:00:00 2001 From: denglihong2007 <98096191+denglihong2007@users.noreply.github.com> Date: Sun, 14 Dec 2025 11:49:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(settings):=20=E8=AE=BE=E7=BD=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=B3=A8=E5=86=8C=E8=A1=A8=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CRSim.Core/Services/SettingsService.cs | 9 +++++---- Directory.Build.props | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CRSim.Core/Services/SettingsService.cs b/CRSim.Core/Services/SettingsService.cs index c4975b5..a9e8a95 100644 --- a/CRSim.Core/Services/SettingsService.cs +++ b/CRSim.Core/Services/SettingsService.cs @@ -1,8 +1,6 @@ using CRSim.Core.Abstractions; using CRSim.Core.Models; using CRSim.Core.Utils; -using System; -using System.IO; using System.Text.Json; namespace CRSim.Core.Services @@ -24,11 +22,15 @@ namespace CRSim.Core.Services _settings.ApiName = _settings.Api.Name; - var options = new JsonSerializerOptions { WriteIndented = true }; string jsonString = JsonSerializer.Serialize(_settings, options); File.WriteAllText(_settingsFilePath, jsonString); } + private readonly JsonSerializerOptions options = new() + { + WriteIndented = true, + }; + public void LoadSettings() { try @@ -47,7 +49,6 @@ namespace CRSim.Core.Services } catch (JsonException) { - // Handle the case where the json is corrupted, load default settings _settings = new Settings(); SaveSettings(); } diff --git a/Directory.Build.props b/Directory.Build.props index 132428b..76027a4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 3.1.4.1 + 3.1.4.0 电排骨 https://github.com/denglihong2007/CRSim