mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added most of the settings code, doesn't work because SQLite is weird
This commit is contained in:
1 parent
231e5e7517
commit
ac577e87cc
42 files changed
+409
-582
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using System.Linq;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Storage.Repositories;
|
||||
using Ninject.Activation;
|
||||
|
||||
namespace Artemis.Core.Ninject
|
||||
{
|
||||
public class PluginSettingsProvider : Provider<PluginSettings>
|
||||
{
|
||||
private readonly ISettingRepository _settingRepository;
|
||||
|
||||
public PluginSettingsProvider(ISettingRepository settingRepository)
|
||||
{
|
||||
_settingRepository = settingRepository;
|
||||
}
|
||||
|
||||
protected override PluginSettings CreateInstance(IContext context)
|
||||
{
|
||||
var pluginInfo = context.Request.ParentRequest?.Parameters.FirstOrDefault(p => p.Name == "PluginInfo")?.GetValue(context, null) as PluginInfo;
|
||||
if (pluginInfo == null)
|
||||
throw new ArtemisCoreException("A plugin needs to be initialized with PluginInfo as a parameter");
|
||||
|
||||
return new PluginSettings(pluginInfo, _settingRepository);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user