using System; namespace BepInEx.Configuration { /// /// Provides access to a single setting inside of a . /// /// Type of the setting. [Obsolete("Use ConfigFile from new AddSetting overloads instead")] public sealed class ConfigWrapper { /// /// Entry of this setting in the . /// public ConfigEntry ConfigEntry { get; } /// /// Unique definition of this setting. /// public ConfigDefinition Definition => ConfigEntry.Definition; /// /// Config file this setting is inside of. /// public ConfigFile ConfigFile => ConfigEntry.ConfigFile; /// /// Fired when the setting is changed. Does not detect changes made outside from this object. /// public event EventHandler SettingChanged; /// /// Value of this setting. /// public T Value { get => ConfigEntry.Value; set => ConfigEntry.Value = value; } internal ConfigWrapper(ConfigEntry configEntry) { ConfigEntry = configEntry ?? throw new ArgumentNullException(nameof(configEntry)); configEntry.ConfigFile.SettingChanged += (sender, args) => { if (args.ChangedSetting == configEntry) SettingChanged?.Invoke(sender, args); }; } } }