mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-17 01:44:59 +03:00
2c90ed1a94
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.
43 lines
805 B
C#
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;
|
|
}
|
|
}
|
|
}
|