using Artemis.Storage.Repositories.Interfaces;
namespace Artemis.Core.Services
{
///
internal class SettingsService : ISettingsService
{
private readonly PluginSettings _pluginSettings;
internal SettingsService(IPluginRepository pluginRepository)
{
_pluginSettings = new PluginSettings(Constants.CorePlugin, pluginRepository);
}
public PluginSetting GetSetting(string name, T defaultValue = default)
{
return _pluginSettings.GetSetting(name, defaultValue);
}
}
///
/// 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
/// The default value to use if the setting does not exist yet
///
PluginSetting GetSetting(string name, T defaultValue = default);
}
}