Basic implementation of a few editor tools

This commit is contained in:
Robert committed 2019-12-16 22:46:11 +01:00
1 parent 580db3185e
commit 8539f05d90
26 files changed
+634 -174

No files matched your search

+14 -2
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using AppDomainToolkit;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
@@ -215,8 +216,19 @@ namespace Artemis.Core.Services
}
// Get the Plugin implementation from the main assembly and if there is only one, instantiate it
var mainAssembly = pluginInfo.Context.Domain.GetAssemblies().First(a => a.Location == mainFile);
var pluginTypes = mainAssembly.GetTypes().Where(t => typeof(Plugin).IsAssignableFrom(t)).ToList();
List<Type> pluginTypes;
var mainAssembly = pluginInfo.Context.Domain.GetAssemblies().FirstOrDefault(a => a.Location == mainFile);
if (mainAssembly == null)
throw new ArtemisPluginException(pluginInfo, "Found no supported assembly in the plugins main file");
try
{
pluginTypes = mainAssembly.GetTypes().Where(t => typeof(Plugin).IsAssignableFrom(t)).ToList();
}
catch (ReflectionTypeLoadException e)
{
throw new ArtemisPluginException(pluginInfo, "Failed to initialize the plugin assembly", new AggregateException(e.LoaderExceptions));
}
if (pluginTypes.Count > 1)
throw new ArtemisPluginException(pluginInfo, $"Plugin contains {pluginTypes.Count} implementations of Plugin, only 1 allowed");
if (pluginTypes.Count == 0)
+6 -4
View File
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Events;
using Artemis.Core.Plugins.Models;
using Artemis.Core.RGB.NET;
using Artemis.Core.Services.Interfaces;
using RGB.NET.Brushes;
using RGB.NET.Brushes.Gradients;
using RGB.NET.Core;
using RGB.NET.Groups;
using Serilog;
@@ -30,7 +32,7 @@ namespace Artemis.Core.Services
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25);
Surface = RGBSurface.Instance;
// Let's throw these for now
Surface.Exception += SurfaceOnException;
_renderScaleSetting.SettingChanged += RenderScaleSettingOnSettingChanged;
@@ -104,7 +106,7 @@ namespace Artemis.Core.Services
{
// Apply the application wide brush and decorator
BitmapBrush = new BitmapBrush(new Scale(_renderScaleSetting.Value));
_surfaceLedGroup = new ListLedGroup(Surface.Leds) { Brush = BitmapBrush };
_surfaceLedGroup = new ListLedGroup(Surface.Leds) {Brush = BitmapBrush};
return;
}
@@ -115,11 +117,11 @@ namespace Artemis.Core.Services
// Apply the application wide brush and decorator
BitmapBrush.Scale = new Scale(_renderScaleSetting.Value);
_surfaceLedGroup = new ListLedGroup(Surface.Leds) { Brush = BitmapBrush };
_surfaceLedGroup = new ListLedGroup(Surface.Leds) {Brush = BitmapBrush};
}
lock (BitmapBrush)
{
}
}