diff --git a/BepInEx/Configuration/ConfigFile.cs b/BepInEx/Configuration/ConfigFile.cs index bf7df93..15e7de0 100644 --- a/BepInEx/Configuration/ConfigFile.cs +++ b/BepInEx/Configuration/ConfigFile.cs @@ -185,6 +185,37 @@ namespace BepInEx.Configuration #region Wraps + /// + /// Access one of the existing settings. If the setting has not been added yet, null is returned. + /// If the setting exists but has a different type than T, an exception is thrown. + /// New settings should be added with . + /// + /// Type of the value contained in this setting. + /// Section and Key of the setting. + [Obsolete("Use ConfigFile[key] or TryGetEntry instead")] + public ConfigEntry GetSetting(ConfigDefinition configDefinition) + { + return TryGetEntry(configDefinition, out var entry) + ? entry + : null; + } + + /// + /// Access one of the existing settings. If the setting has not been added yet, null is returned. + /// If the setting exists but has a different type than T, an exception is thrown. + /// New settings should be added with . + /// + /// Type of the value contained in this setting. + /// Section/category/group of the setting. Settings are grouped by this. + /// Name of the setting. + [Obsolete("Use ConfigFile[key] or TryGetEntry instead")] + public ConfigEntry GetSetting(string section, string key) + { + return TryGetEntry(section, key, out var entry) + ? entry + : null; + } + /// /// Access one of the existing settings. If the setting has not been added yet, false is returned. Otherwise, true. /// If the setting exists but has a different type than T, an exception is thrown. @@ -289,7 +320,7 @@ namespace BepInEx.Configuration /// Section and Key of the setting. /// Value of the setting if the setting was not created yet. /// Description of the setting shown to the user and other metadata. - [Obsolete("Use bind instead")] + [Obsolete("Use Bind instead")] public ConfigEntry AddSetting(ConfigDefinition configDefinition, T defaultValue, ConfigDescription configDescription = null) => Bind(configDefinition, defaultValue, configDescription); @@ -302,7 +333,7 @@ namespace BepInEx.Configuration /// Name of the setting. /// Value of the setting if the setting was not created yet. /// Description of the setting shown to the user and other metadata. - [Obsolete("Use bind instead")] + [Obsolete("Use Bind instead")] public ConfigEntry AddSetting(string section, string key, T defaultValue, ConfigDescription configDescription = null) => Bind(new ConfigDefinition(section, key), defaultValue, configDescription); @@ -315,7 +346,7 @@ namespace BepInEx.Configuration /// Name of the setting. /// Value of the setting if the setting was not created yet. /// Simple description of the setting shown to the user. - [Obsolete("Use bind instead")] + [Obsolete("Use Bind instead")] public ConfigEntry AddSetting(string section, string key, T defaultValue, string description) => Bind(new ConfigDefinition(section, key), defaultValue, new ConfigDescription(description));