GFramework/GFramework.Core/configuration/ConfigWatcherUnRegister.cs
GeWuYou 54bed12056 fix(config): 修复配置管理器变更检测和资源配置优化
- 修改 ConfigurationManager 中的 AddOrUpdate 逻辑,先获取旧值再更新以正确检测变更
- 只有在配置值真正发生变化时才触发监听器回调
- 更新异常日志记录方式,移除冗余的标签前缀
- 将 ConfigWatcherUnRegister 移动到正确的命名空间
- 修复 ResourceManager 中的引用计数逻辑,移除重复的 AddReference 调用
- 优化资源加载和卸载时的异常处理和日志记录
- 更新测试注释以反映正确的引用计数行为
2026-03-05 08:34:05 +08:00

21 lines
515 B
C#

using GFramework.Core.Abstractions.events;
namespace GFramework.Core.configuration;
/// <summary>
/// 配置监听取消注册接口
/// </summary>
internal sealed class ConfigWatcherUnRegister : IUnRegister
{
private readonly Action _unRegisterAction;
public ConfigWatcherUnRegister(Action unRegisterAction)
{
_unRegisterAction = unRegisterAction ?? throw new ArgumentNullException(nameof(unRegisterAction));
}
public void UnRegister()
{
_unRegisterAction();
}
}