diff --git a/Shared/General/Config.cs b/Shared/General/Config.cs index abd1f5a..d336b0d 100644 --- a/Shared/General/Config.cs +++ b/Shared/General/Config.cs @@ -44,13 +44,17 @@ public class JsonConfigProvider : IConfigProvider { if (value is null) { // 直接在 JSON 中表示为 null json.Value[key] = JValue.CreateNull(); + Logger.Trace($"配置已修改:{key} = null({filePath})"); } else if (encrypted) { // 需要加密,在 JSON 中保存密文字符串 throw new NotImplementedException("加密需要改为使用识别码,现在尚未实现。"); + Logger.Trace($"配置已修改:{key} = 已加密({filePath})"); json.Value[key] = CryptographyUtils.AesEncrypt(value is string str ? str : JsonConvert.SerializeObject(value)); } else { // 用 JToken 保留原始结构 - json.Value[key] = JToken.FromObject(value); + JToken token = JToken.FromObject(value); + json.Value[key] = token; + Logger.Trace($"配置已修改:{key} = {token.ToString(Formatting.None)}({filePath})"); } } MakeDirty(); @@ -125,7 +129,7 @@ public static class ConfigUtils { /// 从 secret.json 中读取特定密钥,如果未找到对应密钥则抛出异常。 /// public static string GetSecret(string key) - => secret.Read(key, null, false) ?? throw new KeyNotFoundException($"Secret not found: {key}"); + => secret.Read(key, null, false) ?? throw new KeyNotFoundException($"未找到密钥:{key}"); private static readonly JsonConfigProvider secret = new(Path.Combine(Paths.AppData, "secret.json")); } diff --git a/Shared/General/Workers/RedoableWorker.cs b/Shared/General/Workers/RedoableWorker.cs index d283bba..dd7b1c5 100644 --- a/Shared/General/Workers/RedoableWorker.cs +++ b/Shared/General/Workers/RedoableWorker.cs @@ -68,6 +68,7 @@ public abstract class RedoableWorkerBase(Func : RedoableWorkerBase { } /// -public class RedoableWorker : RedoableWorkerBase { +public class RedoableWorker : RedoableWorkerBase { public RedoableWorker(Action workload, [CallerMemberName] string creatorMemberName = "") : base((c, p) => { workload(c, p); return null; }, creatorMemberName: creatorMemberName) { } public RedoableWorker(Action workload, [CallerMemberName] string creatorMemberName = "") @@ -204,3 +205,6 @@ public class RedoableWorker : RedoableWorkerBase { public RedoableWorker(Action workload, [CallerMemberName] string creatorMemberName = "") : base((_, _) => { workload(); return null; }, creatorMemberName: creatorMemberName) { } } + +/// 指示没有该类型,用于泛型参数。 +public class NoType { } \ No newline at end of file