using System;
using System.Collections.Generic;
namespace Robust.Shared.Configuration
{
///
/// Stores and manages global configuration variables.
///
public interface IConfigurationManager
{
///
/// Saves the configuration file to disk.
///
void SaveToFile();
///
/// Register a CVar with the system. This must be done before the CVar is accessed.
///
/// The name of the CVar. This needs to contain only printable characters.
/// Periods '.' are reserved. Everything before the last period is a nested table identifier,
/// everything after is the CVar name in the TOML document.
/// The default Value of the CVar.
/// Optional flags to change behavior of the CVar.
/// Invoked whenever the CVar value changes.
void RegisterCVar(string name, T defaultValue, CVar flags = CVar.NONE, Action? onValueChanged = null)
where T : notnull;
///
/// Is the named CVar already registered?
///
/// The name of the CVar.
///
bool IsCVarRegistered(string name);
///
/// Gets a list of all registered cvars
///
///
IEnumerable GetRegisteredCVars();
///
/// Sets a CVars value.
///
/// The name of the CVar.
/// The value to set.
void SetCVar(string name, object value);
void SetCVar(CVarDef def, T value) where T : notnull;
///
/// Get the value of a CVar.
///
/// The Type of the CVar value.
/// The name of the CVar.
///
T GetCVar(string name);
T GetCVar(CVarDef def) where T : notnull;
///
/// Gets the type of a value stored in a CVar.
///
/// The name of the CVar
Type GetCVarType(string name);
///
/// Listen for an event for if the config value changes.
///
/// The CVar to listen for.
/// The delegate to run when the value was changed.
///
/// Whether to run the callback immediately in this method. Can help reduce boilerplate
///
/// The type of value contained in this CVar.
///
void OnValueChanged(CVarDef cVar, Action onValueChanged, bool invokeImmediately = false)
where T : notnull;
///
/// Listen for an event for if the config value changes.
///
/// The name of the CVar to listen for.
/// The delegate to run when the value was changed.
///
/// Whether to run the callback immediately in this method. Can help reduce boilerplate
///
/// The type of value contained in this CVar.
///
void OnValueChanged(string name, Action onValueChanged, bool invokeImmediately = false)
where T : notnull;
///
/// Unsubscribe an event previously registered with .
///
/// The CVar to unsubscribe from.
/// The delegate to unsubscribe.
/// The type of value contained in this CVar.
void UnsubValueChanged(CVarDef cVar, Action onValueChanged)
where T : notnull;
///
/// Unsubscribe an event previously registered with .
///
/// The name of the CVar to unsubscribe from.
/// The delegate to unsubscribe.
/// The type of value contained in this CVar.
void UnsubValueChanged(string name, Action onValueChanged)
where T : notnull;
}
}