using System; using System.Threading.Tasks; using JetBrains.Annotations; using Kyoo.Abstractions.Models; using Kyoo.Abstractions.Models.Exceptions; namespace Kyoo.Abstractions.Controllers { /// /// A class to ease configuration management. This work WITH Microsoft's package, you can still use IOptions patterns /// to access your options, this manager ease dynamic work and editing. /// It works with . /// public interface IConfigurationManager { /// /// Add an editable configuration to the editable configuration list /// /// The root path of the editable configuration. It should not be a nested type. /// The type of the configuration void AddTyped(string path); /// /// Add an editable configuration to the editable configuration list. /// WARNING: this method allow you to add an unmanaged type. This type won't be editable. This can be used /// for external libraries or variable arguments. /// /// The root path of the editable configuration. It should not be a nested type. void AddUntyped(string path); /// /// An helper method of and . /// This register a typed value if is not null and registers an untyped type /// if is null. /// /// The root path of the editable configuration. It should not be a nested type. /// The type of the configuration or null. void Register(string path, [CanBeNull] Type type); /// /// Get the value of a setting using it's path. /// /// The path of the resource (can be separated by ':' or '__') /// No setting found at the given path. /// The value of the settings (if it's a strongly typed one, the given type is instantiated object GetValue(string path); /// /// Get the value of a setting using it's path. /// If your don't need a strongly typed value, see . /// /// The path of the resource (can be separated by ':' or '__') /// A type to strongly type your option. /// If your type is not the same as the registered type /// No setting found at the given path. /// The value of the settings (if it's a strongly typed one, the given type is instantiated T GetValue(string path); /// /// Edit the value of a setting using it's path. Save it to the json file. /// /// The path of the resource (can be separated by ':' or '__') /// The new value of the resource /// No setting found at the given path. Task EditValue(string path, object value); } }