Meta - Code cleanup

This commit is contained in:
SpoinkyNL committed 2020-06-13 22:27:51 +02:00
1 parent 18593853d8
commit fd991112a9
105 files changed
+3097 -2624

No files matched your search

+21 -23
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.JsonConverters;
@@ -10,7 +9,6 @@ using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Storage;
using Artemis.Storage.Migrations.Interfaces;
using Newtonsoft.Json;
using RGB.NET.Core;
using Serilog;
@@ -29,11 +27,11 @@ namespace Artemis.Core.Services
private readonly IProfileService _profileService;
private readonly IRgbService _rgbService;
private readonly ISurfaceService _surfaceService;
private readonly PluginSetting<LogEventLevel> _loggingLevel;
private List<Module> _modules;
private PluginSetting<LogEventLevel> _loggingLevel;
// ReSharper disable once UnusedParameter.Local - Storage migration service is injected early to ensure it runs before anything else
internal CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
internal CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
IRgbService rgbService, ISurfaceService surfaceService, IProfileService profileService)
{
_logger = logger;
@@ -51,7 +49,7 @@ namespace Artemis.Core.Services
_pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
_pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
ConfigureJsonConvert();
}
@@ -66,24 +64,6 @@ namespace Artemis.Core.Services
public bool IsInitialized { get; set; }
protected virtual void OnFrameRendering(FrameRenderingEventArgs e)
{
FrameRendering?.Invoke(this, e);
}
protected virtual void OnFrameRendered(FrameRenderedEventArgs e)
{
FrameRendered?.Invoke(this, e);
}
private void ConfigureJsonConvert()
{
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = new List<JsonConverter> {new SKColorConverter()}
};
}
public void Initialize()
{
if (IsInitialized)
@@ -107,6 +87,24 @@ namespace Artemis.Core.Services
OnInitialized();
}
protected virtual void OnFrameRendering(FrameRenderingEventArgs e)
{
FrameRendering?.Invoke(this, e);
}
protected virtual void OnFrameRendered(FrameRenderedEventArgs e)
{
FrameRendered?.Invoke(this, e);
}
private void ConfigureJsonConvert()
{
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = new List<JsonConverter> {new SKColorConverter()}
};
}
private void ApplyLoggingLevel()
{
_logger.Information("Setting logging level to {loggingLevel}", _loggingLevel.Value);