using Artemis.Storage.Repositories.Interfaces; namespace Artemis.Core.Services; /// internal class SettingsService : ISettingsService { private readonly PluginSettings _pluginSettings; public SettingsService(IPluginRepository pluginRepository) { _pluginSettings = new PluginSettings(Constants.CorePlugin, pluginRepository); } public PluginSetting GetSetting(string name, T? defaultValue = default) { return _pluginSettings.GetSetting(name, defaultValue); } /// public void SaveAllSettings() { _pluginSettings.SaveAllSettings(); } } /// /// A wrapper around plugin settings for miscellaneous use outside plugins /// Do not inject into a plugin, for plugins inject instead. /// public interface ISettingsService : IProtectedArtemisService { /// /// Gets the setting with the provided name. If the setting does not exist yet, it is created. /// /// The type of the setting, can be any serializable type /// The name of the setting, may not be longer than 128 characters /// The default value to use if the setting does not exist yet /// PluginSetting GetSetting(string name, T? defaultValue = default); /// /// Saves all settings, obviously /// void SaveAllSettings(); }