Core - Added stores for the different register-able types

Profiles - Refactored large parts of the profile structure to use these stores
This commit is contained in:
Robert authored and SpoinkyNL committed 2020-09-09 19:56:06 +02:00
1 parent 4cfe71796c
commit 11de30318e
75 files changed
+1526 -934

No files matched your search

@@ -3,6 +3,9 @@ using System.Collections.Generic;
namespace Artemis.Core.Services
{
/// <summary>
/// A service that initializes the Core and manages the render loop
/// </summary>
public interface ICoreService : IArtemisService, IDisposable
{
/// <summary>
@@ -1,48 +0,0 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Properties;
using Newtonsoft.Json;
namespace Artemis.Core.Services
{
public interface IDataBindingService : IArtemisService
{
/// <summary>
/// Gets a read-only collection of all registered modifier types
/// </summary>
IReadOnlyCollection<DataBindingModifierType> RegisteredDataBindingModifierTypes { get; }
/// <summary>
/// Registers a new modifier type for use in data bindings
/// </summary>
/// <param name="pluginInfo">The PluginInfo of the plugin this modifier type belongs to</param>
/// <param name="dataBindingModifierType">The modifier type to register</param>
void RegisterModifierType([NotNull] PluginInfo pluginInfo, [NotNull] DataBindingModifierType dataBindingModifierType);
/// <summary>
/// Removes a modifier type so it is no longer available for use in data bindings
/// </summary>
/// <param name="dataBindingModifierType">The modifier type to remove</param>
void RemoveModifierType([NotNull] DataBindingModifierType dataBindingModifierType);
/// <summary>
/// Returns all the data binding modifier types compatible with the provided type
/// </summary>
List<DataBindingModifierType> GetCompatibleModifierTypes(Type type);
/// <summary>
/// Gets a modifier type by its plugin GUID and type name
/// </summary>
/// <param name="modifierTypePluginGuid">The modifier type's plugin GUID</param>
/// <param name="modifierType">The type name of the modifier type</param>
/// <returns></returns>
DataBindingModifierType GetModifierType(Guid modifierTypePluginGuid, string modifierType);
/// <summary>
/// Logs a modifier deserialization failure
/// </summary>
/// <param name="modifierName">The modifier that failed to deserialize</param>
/// <param name="exception">The JSON exception that occurred</param>
void LogModifierDeserializationFailure(string modifierName, JsonSerializationException exception);
}
}
@@ -1,91 +0,0 @@
using System;
using System.Collections.Generic;
using Artemis.Core.DataModelExpansions;
using Artemis.Core.Properties;
using Newtonsoft.Json;
namespace Artemis.Core.Services
{
public interface IDataModelService : IArtemisService
{
/// <summary>
/// Gets a read-only collection of all registered condition operators
/// </summary>
IReadOnlyCollection<DisplayConditionOperator> RegisteredConditionOperators { get; }
/// <summary>
/// Gets a read-only collection of all registered data model expansions
/// </summary>
IReadOnlyCollection<DataModel> DataModelExpansions { get; }
/// <summary>
/// Add an expansion to the datamodel to be available for use after the next update
/// </summary>
/// <param name="baseDataModelExpansion"></param>
void AddExpansion(DataModel baseDataModelExpansion);
/// <summary>
/// Remove a previously added expansion so that it is no longer available and updated
/// </summary>
/// <param name="baseDataModelExpansion"></param>
void RemoveExpansion(DataModel baseDataModelExpansion);
/// <summary>
/// If found, returns the data model of the provided plugin
/// </summary>
/// <param name="plugin">Should be a module with a data model or a data model expansion</param>
DataModel GetPluginDataModel(Plugin plugin);
/// <summary>
/// If found, returns the data model of the provided plugin
/// </summary>
/// <param name="pluginGuid">Should be a module with a data model or a data model expansion</param>
DataModel GetPluginDataModelByGuid(Guid pluginGuid);
/// <summary>
/// Determines whether the given plugin expands the main data model
/// </summary>
/// <param name="plugin"></param>
/// <returns></returns>
bool GetPluginExtendsDataModel(Plugin plugin);
/// <summary>
/// Registers a new condition operator for use in layer conditions
/// </summary>
/// <param name="pluginInfo">The PluginInfo of the plugin this condition operator belongs to</param>
/// <param name="displayConditionOperator">The condition operator to register</param>
void RegisterConditionOperator([NotNull] PluginInfo pluginInfo, [NotNull] DisplayConditionOperator displayConditionOperator);
/// <summary>
/// Removes a condition operator so it is no longer available for use in layer conditions
/// </summary>
/// <param name="displayConditionOperator">The layer condition operator to remove</param>
void RemoveConditionOperator([NotNull] DisplayConditionOperator displayConditionOperator);
/// <summary>
/// Returns all the display condition operators compatible with the provided type
/// </summary>
List<DisplayConditionOperator> GetCompatibleConditionOperators(Type type);
/// <summary>
/// Gets a condition operator by its plugin GUID and type name
/// </summary>
/// <param name="operatorPluginGuid">The operator's plugin GUID</param>
/// <param name="operatorType">The type name of the operator</param>
DisplayConditionOperator GetConditionOperator(Guid operatorPluginGuid, string operatorType);
/// <summary>
/// Logs a predicate deserialization failure
/// </summary>
/// <param name="displayConditionPredicate">The predicate that failed to deserialize</param>
/// <param name="exception">The JSON exception that occurred</param>
void LogPredicateDeserializationFailure(DisplayConditionPredicate displayConditionPredicate, JsonException exception);
/// <summary>
/// Logs a list predicate deserialization failure
/// </summary>
/// <param name="displayConditionListPredicate">The list predicate that failed to deserialize</param>
/// <param name="exception">The JSON exception that occurred</param>
void LogListPredicateDeserializationFailure(DisplayConditionListPredicate displayConditionListPredicate, JsonException exception);
}
}
@@ -1,5 +1,8 @@
namespace Artemis.Core.Services
{
/// <summary>
/// A service that allows you manage an <see cref="ArtemisDevice"/>
/// </summary>
public interface IDeviceService : IArtemisService
{
/// <summary>
@@ -1,59 +0,0 @@
using Artemis.Core.LayerBrushes;
using Artemis.Core.LayerEffects;
namespace Artemis.Core.Services
{
public interface IRenderElementService : IArtemisService
{
/// <summary>
/// Creates a new layer
/// </summary>
/// <param name="profile"></param>
/// <param name="parent"></param>
/// <param name="name"></param>
/// <returns></returns>
Layer CreateLayer(Profile profile, ProfileElement parent, string name);
/// <summary>
/// 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
/// </summary>
/// <param name="layer">The layer to deactivate the active brush on</param>
void DeactivateLayerBrush(Layer layer);
/// <summary>
/// Instantiates and adds the <see cref="BaseLayerBrush" /> described by the provided
/// <see cref="LayerBrushDescriptor" />
/// to the <see cref="Layer" />.
/// </summary>
/// <param name="layer">The layer to instantiate the brush for</param>
/// <returns></returns>
BaseLayerBrush InstantiateLayerBrush(Layer layer);
/// <summary>
/// Instantiates and adds the <see cref="BaseLayerEffect" /> described by the provided
/// <see cref="LayerEffectDescriptor" /> to the <see cref="Layer" />.
/// </summary>
/// <param name="renderProfileElement">The layer/folder to instantiate the effect for</param>
void InstantiateLayerEffects(RenderProfileElement renderProfileElement);
/// <summary>
/// Adds the <see cref="BaseLayerEffect" /> described by the provided <see cref="LayerEffectDescriptor" /> to the
/// <see cref="Layer" />.
/// </summary>
/// <param name="renderProfileElement">The layer/folder to instantiate the effect for</param>
/// <param name="layerEffectDescriptor"></param>
/// <returns></returns>
BaseLayerEffect AddLayerEffect(RenderProfileElement renderProfileElement, LayerEffectDescriptor layerEffectDescriptor);
void RemoveLayerEffect(BaseLayerEffect layerEffect);
void InstantiateDisplayConditions(RenderProfileElement renderElement);
void InstantiateDataBindings(RenderProfileElement renderElement);
}
}
@@ -4,7 +4,10 @@ using RGB.NET.Core;
namespace Artemis.Core.Services
{
public interface IRgbService : IArtemisService
/// <summary>
/// A service that allows you to manage the <see cref="RGBSurface" /> and its contents
/// </summary>
public interface IRgbService : IArtemisService, IDisposable
{
/// <summary>
/// Gets or sets the RGB surface rendering is performed on
@@ -26,7 +29,14 @@ namespace Artemis.Core.Services
/// </summary>
IReadOnlyCollection<IRGBDevice> LoadedDevices { get; }
/// <summary>
/// Gets the update trigger that drives the render loop
/// </summary>
TimerUpdateTrigger UpdateTrigger { get; }
/// <summary>
/// Gets or sets whether rendering should be paused
/// </summary>
bool IsRenderPaused { get; set; }
/// <summary>
@@ -35,8 +45,6 @@ namespace Artemis.Core.Services
/// <param name="deviceProvider"></param>
void AddDeviceProvider(IRGBDeviceProvider deviceProvider);
void Dispose();
/// <summary>
/// Occurs when a single device has loaded
/// </summary>
@@ -47,6 +55,9 @@ namespace Artemis.Core.Services
/// </summary>
event EventHandler<DeviceEventArgs> DeviceReloaded;
/// <summary>
/// Recalculates the LED group used by the <see cref="BitmapBrush" />
/// </summary>
void UpdateSurfaceLedGroup();
}
}