Core - Flattened namespaces

Shared UI - Flattened namespaces
Shared UI - General housekeeping
Project - Code cleanup
This commit is contained in:
SpoinkyNL committed 2020-09-01 00:14:08 +02:00
1 parent 029e39ec1d
commit 8718d01eae
454 files changed
+1678 -1938

No files matched your search

+13 -21
View File
@@ -4,24 +4,16 @@ using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.JsonConverters;
using Artemis.Core.Models.Profile;
using Artemis.Core.Ninject;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Plugins.DataModelExpansions.Internal;
using Artemis.Core.Plugins.Settings;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Core.Utilities;
using Artemis.Storage;
using Newtonsoft.Json;
using RGB.NET.Core;
using Serilog;
using Serilog.Events;
using SkiaSharp;
using Module = Artemis.Core.Plugins.Modules.Module;
using Module = Artemis.Core.Modules.Module;
namespace Artemis.Core.Services
{
@@ -38,8 +30,8 @@ namespace Artemis.Core.Services
private readonly IRgbService _rgbService;
private readonly ISurfaceService _surfaceService;
private List<BaseDataModelExpansion> _dataModelExpansions;
private List<Module> _modules;
private IntroAnimation _introAnimation;
private List<Module> _modules;
// ReSharper disable once UnusedParameter.Local - Storage migration service is injected early to ensure it runs before anything else
public CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
@@ -99,6 +91,16 @@ 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 PlayIntroAnimation()
{
FrameRendering += DrawOverlay;
@@ -126,16 +128,6 @@ namespace Artemis.Core.Services
});
}
protected virtual void OnFrameRendering(FrameRenderingEventArgs e)
{
FrameRendering?.Invoke(this, e);
}
protected virtual void OnFrameRendered(FrameRenderedEventArgs e)
{
FrameRendered?.Invoke(this, e);
}
private void UpdatePluginCache()
{
_modules = _pluginService.GetPluginsOfType<Module>().Where(p => p.Enabled).ToList();
@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile.DataBindings;
using Artemis.Core.Models.Profile.DataBindings.Modifiers;
using Artemis.Core.Plugins;
using Artemis.Core.Services.Interfaces;
using Newtonsoft.Json;
using Serilog;
+3 -13
View File
@@ -1,18 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Profile.Conditions;
using Artemis.Core.Models.Profile.Conditions.Operators;
using Artemis.Core.Plugins;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Plugins.DataModelExpansions.Internal;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Modules;
using Newtonsoft.Json;
using Serilog;
@@ -24,8 +14,8 @@ namespace Artemis.Core.Services
internal class DataModelService : IDataModelService
{
private readonly List<DataModel> _dataModelExpansions;
private readonly IPluginService _pluginService;
private readonly ILogger _logger;
private readonly IPluginService _pluginService;
private readonly List<DisplayConditionOperator> _registeredConditionOperators;
public DataModelService(IPluginService pluginService, ILogger logger)
@@ -1,7 +1,4 @@
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.Models.Surface;
using Artemis.Core.Services.Interfaces;
using SkiaSharp;
namespace Artemis.Core.Services
@@ -1,4 +1,4 @@
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
/// <summary>
/// A singleton service
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Artemis.Core.Events;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
public interface ICoreService : IArtemisService, IDisposable
{
@@ -16,7 +14,7 @@ namespace Artemis.Core.Services.Interfaces
/// The time the last frame took to render
/// </summary>
TimeSpan FrameTime { get; }
/// <summary>
/// Gets or sets whether modules are rendered each frame by calling their Render method
/// </summary>
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Annotations;
using Artemis.Core.Models.Profile.DataBindings;
using Artemis.Core.Models.Profile.DataBindings.Modifiers;
using Artemis.Core.Plugins;
using Artemis.Core.Properties;
using Newtonsoft.Json;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
public interface IDataBindingService : IArtemisService
{
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Annotations;
using Artemis.Core.Models.Profile.Conditions;
using Artemis.Core.Plugins;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Properties;
using Newtonsoft.Json;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
public interface IDataModelService : IArtemisService
{
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Modules;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
/// <summary>
/// A service providing module activation functionality
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Artemis.Core.Events;
using Artemis.Core.Plugins;
using RGB.NET.Core;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
/// <summary>
/// A service providing plugin management
/// A service providing plugin management
/// </summary>
public interface IPluginService : IArtemisService, IDisposable
{
@@ -1,4 +1,4 @@
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
/// <summary>
/// A singleton service that cannot be used by plugins
@@ -1,9 +1,7 @@
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.LayerBrushes;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.LayerBrushes;
using Artemis.Core.LayerEffects;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
public interface IRenderElementService : IArtemisService
{
@@ -17,13 +15,13 @@ namespace Artemis.Core.Services.Interfaces
Layer CreateLayer(Profile profile, ProfileElement parent, string name);
/// <summary>
/// Removes the currently active layer brush from the <see cref="Layer" /> and deletes any settings
/// Removes the currently active layer brush from the <see cref="Layer" /> and deletes any settings
/// </summary>
/// <param name="layer">The layer to remove the active brush from</param>
void RemoveLayerBrush(Layer layer);
/// <summary>
/// Deactivates the currently active layer brush from the <see cref="Layer" /> but keeps all settings
/// Deactivates the currently active layer brush from the <see cref="Layer" /> but keeps all settings
/// </summary>
/// <param name="layer">The layer to deactivate the active brush on</param>
void DeactivateLayerBrush(Layer layer);
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Events;
using Artemis.Core.RGB.NET;
using RGB.NET.Core;
namespace Artemis.Core.Services.Interfaces
namespace Artemis.Core.Services
{
public interface IRgbService : IArtemisService
{
+1 -7
View File
@@ -5,13 +5,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Storage.Entities.Module;
using Artemis.Core.Modules;
using Artemis.Storage.Repositories.Interfaces;
using Serilog;
using Timer = System.Timers.Timer;
+2 -9
View File
@@ -3,14 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins;
using Artemis.Core.Plugins.DeviceProviders;
using Artemis.Core.Plugins.Exceptions;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Utilities;
using Artemis.Core.DeviceProviders;
using Artemis.Storage.Entities.Plugins;
using Artemis.Storage.Repositories.Interfaces;
using McMaster.NETCore.Plugins;
@@ -328,7 +321,7 @@ namespace Artemis.Core.Services
_pluginRepository.SavePlugin(plugin.PluginInfo.PluginEntity);
_logger.Debug("Shutting down for device provider disable {pluginInfo}", plugin.PluginInfo);
CurrentProcessUtilities.Shutdown(2, true);
ApplicationUtilities.Shutdown(2, true);
return;
}
@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.Conditions;
using Artemis.Core.Plugins.LayerBrushes;
using Artemis.Core.Plugins.LayerBrushes.Internal;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Entities.Profile;
using Artemis.Core.LayerBrushes;
using Artemis.Core.LayerEffects;
using Ninject;
using Serilog;
@@ -16,10 +9,10 @@ namespace Artemis.Core.Services
{
internal class RenderElementService : IRenderElementService
{
private readonly IDataModelService _dataModelService;
private readonly IKernel _kernel;
private readonly ILogger _logger;
private readonly IPluginService _pluginService;
private readonly IDataModelService _dataModelService;
public RenderElementService(IKernel kernel, ILogger logger, IPluginService pluginService, IDataModelService dataModelService)
{
@@ -160,7 +153,7 @@ namespace Artemis.Core.Services
}
catch (Exception e)
{
_logger.Warning(e, $"Failed to init display conditions for {renderElement}");
_logger.Warning(e, $"Failed to init display conditions for {renderElement}");
}
}
}
+2 -7
View File
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Artemis.Core.Events;
using Artemis.Core.Plugins.Settings;
using Artemis.Core.RGB.NET;
using Artemis.Core.Services.Interfaces;
using RGB.NET.Core;
using RGB.NET.Groups;
using Serilog;
@@ -67,10 +62,10 @@ namespace Artemis.Core.Services
_logger.Warning("Device provider {deviceProvider} has no devices", deviceProvider.GetType().Name);
return;
}
foreach (var surfaceDevice in deviceProvider.Devices)
{
_logger.Debug("Device provider {deviceProvider} added {deviceName}",
_logger.Debug("Device provider {deviceProvider} added {deviceName}",
deviceProvider.GetType().Name, surfaceDevice.DeviceInfo?.DeviceName);
if (!_loadedDevices.Contains(surfaceDevice))
{
+1 -3
View File
@@ -1,6 +1,4 @@
using Artemis.Core.Plugins.Settings;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Repositories.Interfaces;
using Artemis.Storage.Repositories.Interfaces;
namespace Artemis.Core.Services
{
@@ -1,10 +1,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Artemis.Core.Models.Profile;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Modules;
namespace Artemis.Core.Services.Storage.Interfaces
namespace Artemis.Core.Services
{
/// <summary>
/// Provides access to profile storage and is responsible for activating default profiles
@@ -56,7 +54,6 @@ namespace Artemis.Core.Services.Storage.Interfaces
/// </summary>
/// <param name="profileModule"></param>
/// <returns></returns>
Task ActivateLastProfileAnimated(ProfileModule profileModule);
/// <summary>
@@ -1,10 +1,7 @@
using System;
using System.Collections.ObjectModel;
using Artemis.Core.Events;
using Artemis.Core.Models.Surface;
using Artemis.Core.Services.Interfaces;
namespace Artemis.Core.Services.Storage.Interfaces
namespace Artemis.Core.Services
{
public interface ISurfaceService : IArtemisService
{
@@ -2,21 +2,15 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.LayerBrushes;
using Artemis.Core.Plugins.LayerEffects;
using Artemis.Core.Plugins.Modules;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Core.LayerBrushes;
using Artemis.Core.LayerEffects;
using Artemis.Core.Modules;
using Artemis.Storage.Entities.Profile;
using Artemis.Storage.Repositories.Interfaces;
using Newtonsoft.Json;
using Serilog;
namespace Artemis.Core.Services.Storage
namespace Artemis.Core.Services
{
internal class ProfileService : IProfileService
{
@@ -101,8 +95,15 @@ namespace Artemis.Core.Services.Storage
var profile = new Profile(profileDescriptor.ProfileModule, profileEntity);
InstantiateProfile(profile);
void ActivatingProfileSurfaceUpdate(object sender, SurfaceConfigurationEventArgs e) => profile.PopulateLeds(e.Surface);
void ActivatingProfilePluginToggle(object sender, PluginEventArgs e) => InstantiateProfile(profile);
void ActivatingProfileSurfaceUpdate(object sender, SurfaceConfigurationEventArgs e)
{
profile.PopulateLeds(e.Surface);
}
void ActivatingProfilePluginToggle(object sender, PluginEventArgs e)
{
InstantiateProfile(profile);
}
// This could happen during activation so subscribe to it
_pluginService.PluginEnabled += ActivatingProfilePluginToggle;
@@ -2,18 +2,11 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Artemis.Core.Events;
using Artemis.Core.Exceptions;
using Artemis.Core.Extensions;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Settings;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Storage.Repositories.Interfaces;
using RGB.NET.Core;
using Serilog;
namespace Artemis.Core.Services.Storage
namespace Artemis.Core.Services
{
public class SurfaceService : ISurfaceService
{