feat(settings): 设置改为注册表存储

This commit is contained in:
denglihong2007
2025-12-14 11:49:38 +08:00
parent 107ac41812
commit c0f69b906f
2 changed files with 6 additions and 5 deletions

View File

@@ -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();
}

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>3.1.4.1</Version>
<Version>3.1.4.0</Version>
<Authors>电排骨</Authors>
<RepositoryUrl>https://github.com/denglihong2007/CRSim</RepositoryUrl>
</PropertyGroup>