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