Added a layer of abstraction between RGB.NET and Artemis

This means Artemis can add extra functionality
It also avoid having to reference RGB.NET for basic rendering
Implemented rendering scaling
This commit is contained in:
SpoinkyNL committed 2019-10-30 23:20:06 +01:00
1 parent 4126f5622e
commit f72f145c7e
41 files changed
+725 -494

No files matched your search

@@ -0,0 +1,30 @@
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services;
using Ninject;
using Ninject.Activation;
namespace Artemis.Core.Ninject
{
public class SettingsServiceProvider : Provider<ISettingsService>
{
private readonly SettingsService _instance;
public SettingsServiceProvider(IKernel kernel)
{
// This is not lazy, but the core is always going to be using this anyway
_instance = kernel.Get<SettingsService>();
}
protected override ISettingsService CreateInstance(IContext context)
{
var parentRequest = context.Request.ParentRequest;
if (parentRequest == null || typeof(Plugin).IsAssignableFrom(parentRequest.Service))
throw new ArtemisPluginException($"SettingsService can not be injected into a plugin. Inject {nameof(PluginSettings)} instead.");
return _instance;
}
}
}