Files
v2rayN/v2rayN/ServiceLib/Handler/Data/ConfigState.cs
T
2dust 2c90ed1a94 Move configuration data classes to handlers
Rename the database and text configuration managers as handlers, move configuration data classes into Handler.Data, and relocate ProfileExManager. Update references across applications and tests.
2026-11-14 20:35:50 +08:00

43 lines
805 B
C#

namespace ServiceLib.Handler.Data;
public sealed class ConfigState
{
private static readonly Lazy<ConfigState> _instance = new(() => new());
private readonly Lock _lock = new();
private Config? _current;
public static ConfigState Instance => _instance.Value;
public Config Current
{
get
{
lock (_lock)
{
return _current ??= new Config();
}
}
}
public bool IsInitialized
{
get
{
lock (_lock)
{
return _current is not null;
}
}
}
public void SetCurrent(Config config)
{
ArgumentNullException.ThrowIfNull(config);
lock (_lock)
{
_current = config;
}
}
}