feat: IConfiguration for system and other configurations

This commit is contained in:
2026-02-09 13:15:13 +03:00
parent 32a7e9be24
commit 3b1c291588
4 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace Engine.Core.Config;
public interface IConfiguration
{
static IConfiguration System { get; set; } = new SystemConfiguration();
static IConfiguration Shared { get; set; } = new BasicConfiguration();
Event<IConfiguration, ConfigUpdateArguments> OnAdded { get; }
Event<IConfiguration, ConfigUpdateArguments> OnSet { get; }
Event<IConfiguration, ConfigUpdateArguments> OnRemoved { get; }
IReadOnlyDictionary<string, object?> Values { get; }
bool Has(string key);
object? Get(string key);
T? Get<T>(string key, T? defaultValue = default);
void Set<T>(string key, T value);
void Remove<T>(string key);
readonly record struct ConfigUpdateArguments(string Key);
}