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