回读图像功能优化

This commit is contained in:
“hsc”
2026-07-30 16:33:32 +08:00
parent f350058f53
commit e90dc805fc
11 changed files with 674 additions and 11 deletions

View File

@@ -61,6 +61,37 @@ namespace UIShare.GlobalVariable
}
}
/// <summary>
/// 保存全局配置
/// </summary>
public static void SaveGlobalConfig(GlobalConfig config)
{
if (config == null) return;
lock (_fileLock)
{
try
{
if (!Directory.Exists(config.SystemPath))
Directory.CreateDirectory(config.SystemPath);
string configPath = Path.Combine(config.SystemPath, "GlobalConfig.json");
string json = JsonConvert.SerializeObject(config, Formatting.Indented, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All
});
File.WriteAllText(configPath, json);
}
catch (Exception ex)
{
}
}
}
/// <summary>
/// 确保配置中至少包含一个 CAN 设备(对应 SystemConfig.CANFD
/// 旧配置或空配置会自动升级,使用户在设置界面能看到 CAN 设备。