mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 18:47:55 +08:00
perf: 旧config移除简化
This commit is contained in:
@@ -107,7 +107,7 @@ namespace MaaWpfGui.Helper
|
||||
{
|
||||
_logger.Information("Read global configuration key {Key} with current configuration value {Value}, configuration hit: {HasValue}, configuration value {Value}", key, value, true, value);
|
||||
SetGlobalValue(key, value);
|
||||
DeleteValue(key, out _);
|
||||
DeleteValue(key);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -170,6 +170,14 @@ namespace MaaWpfGui.Helper
|
||||
|
||||
public static bool ContainsKey(string key, bool isGlobal = false) => isGlobal ? _globalKvs.ContainsKey(key) : _kvs.ContainsKey(key);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a configuration
|
||||
/// </summary>
|
||||
/// <param name="key">The configuration key.</param>
|
||||
/// <returns>The return value of <see cref="Save"/>.</returns>
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public static bool DeleteValue(string key) => DeleteValue(key, out _);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a configuration
|
||||
/// </summary>
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
// TODO: 删除老数据节省 gui.json 的大小,后续版本可以删除
|
||||
// var json = ConfigurationHelper.GetValue(ConfigurationKeys.DepotResult, string.Empty);
|
||||
ConfigurationHelper.DeleteValue(ConfigurationKeys.DepotResult, out _);
|
||||
ConfigurationHelper.DeleteValue(ConfigurationKeys.DepotResult);
|
||||
var json = JsonDataHelper.Get(JsonDataKey.DepotData, string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
@@ -644,7 +644,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
// TODO: 删除老数据节省 gui.json 的大小,后续版本可以删除
|
||||
// var json = ConfigurationHelper.GetValue(ConfigurationKeys.OperBoxData, string.Empty);
|
||||
ConfigurationHelper.DeleteValue(ConfigurationKeys.OperBoxData, out _);
|
||||
ConfigurationHelper.DeleteValue(ConfigurationKeys.OperBoxData);
|
||||
var json = JsonDataHelper.Get(JsonDataKey.OperBoxData, string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user