回读图像功能优化
This commit is contained in:
@@ -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 设备。
|
||||
|
||||
Reference in New Issue
Block a user