mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Added shared UI library and finished the ColorPicker
This commit is contained in:
1 parent
5e876dc8ca
commit
b9471abdec
30 files changed
+875
-321
No files matched your search
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.JsonConverters;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
using RGB.NET.Core;
|
||||
using Serilog;
|
||||
using SkiaSharp;
|
||||
@@ -36,9 +38,18 @@ namespace Artemis.Core.Services
|
||||
_pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
|
||||
_pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
|
||||
|
||||
ConfigureJsonConvert();
|
||||
Task.Run(Initialize);
|
||||
}
|
||||
|
||||
private void ConfigureJsonConvert()
|
||||
{
|
||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||
{
|
||||
Converters = new List<JsonConverter> { new SKColorConverter() }
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Dispose services
|
||||
|
||||
@@ -8,16 +8,19 @@ using Artemis.Core.Services.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
using Serilog;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
public class LayerService : ILayerService
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public LayerService(IKernel kernel)
|
||||
public LayerService(IKernel kernel, ILogger logger)
|
||||
{
|
||||
_kernel = kernel;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public LayerElement InstantiateLayerElement(Layer layer, LayerElementDescriptor layerElementDescriptor, string settings, Guid? guid)
|
||||
@@ -42,7 +45,19 @@ namespace Artemis.Core.Services
|
||||
$"Settings where provided but layer element of type {layerElementDescriptor.LayerElementType.Name} has no Settings property."
|
||||
);
|
||||
}
|
||||
settingsInstance = JsonConvert.DeserializeObject(settings, settingsType);
|
||||
|
||||
try
|
||||
{
|
||||
settingsInstance = JsonConvert.DeserializeObject(settings, settingsType);
|
||||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
_logger.Warning(e, "Failed to deserialize settings for layer type {type}, resetting element settings - Plugin info: {pluginInfo}",
|
||||
layerElementDescriptor.LayerElementType.Name,
|
||||
layerElementDescriptor.LayerElementProvider.PluginInfo);
|
||||
|
||||
settingsInstance = Activator.CreateInstance(settingsType);
|
||||
}
|
||||
}
|
||||
// If no settings found, provide a fresh instance of the settings type
|
||||
else if (settingsType != null)
|
||||
|
||||
Reference in new issue
Block a user