mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Conditions - Removed old systems
Data bindings - Removed old systems Data bindings - Implemented node system
This commit is contained in:
1 parent
32d4ec2812
commit
5675d1895b
157 files changed
+784
-8802
No files matched your search
@@ -210,8 +210,6 @@ namespace Artemis.Core.Services
|
||||
Version? hidSharpVersion = Assembly.GetAssembly(typeof(HidDevice))!.GetName().Version;
|
||||
_logger.Debug("Forcing plugins to use HidSharp {hidSharpVersion}", hidSharpVersion);
|
||||
|
||||
DeserializationLogger.Initialize(Kernel!);
|
||||
|
||||
// Initialize the services
|
||||
_pluginManagementService.CopyBuiltInPlugins();
|
||||
_pluginManagementService.LoadPlugins(StartupArguments, IsElevated);
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
internal class ConditionOperatorService : IConditionOperatorService
|
||||
{
|
||||
public ConditionOperatorService()
|
||||
{
|
||||
RegisterBuiltInConditionOperators();
|
||||
}
|
||||
|
||||
public ConditionOperatorRegistration RegisterConditionOperator(Plugin plugin, BaseConditionOperator conditionOperator)
|
||||
{
|
||||
if (plugin == null)
|
||||
throw new ArgumentNullException(nameof(plugin));
|
||||
if (conditionOperator == null)
|
||||
throw new ArgumentNullException(nameof(conditionOperator));
|
||||
|
||||
conditionOperator.Plugin = plugin;
|
||||
return ConditionOperatorStore.Add(conditionOperator);
|
||||
}
|
||||
|
||||
public void RemoveConditionOperator(ConditionOperatorRegistration registration)
|
||||
{
|
||||
if (registration == null)
|
||||
throw new ArgumentNullException(nameof(registration));
|
||||
ConditionOperatorStore.Remove(registration);
|
||||
}
|
||||
|
||||
public List<BaseConditionOperator> GetConditionOperatorsForType(Type type, ConditionParameterSide side)
|
||||
{
|
||||
return ConditionOperatorStore.GetForType(type, side).Select(r => r.ConditionOperator).ToList();
|
||||
}
|
||||
|
||||
public BaseConditionOperator? GetConditionOperator(Guid operatorPluginGuid, string operatorType)
|
||||
{
|
||||
return ConditionOperatorStore.Get(operatorPluginGuid, operatorType)?.ConditionOperator;
|
||||
}
|
||||
|
||||
private void RegisterBuiltInConditionOperators()
|
||||
{
|
||||
// General usage for any type
|
||||
RegisterConditionOperator(Constants.CorePlugin, new EqualsConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new NotEqualConditionOperator());
|
||||
|
||||
// Numeric operators
|
||||
RegisterConditionOperator(Constants.CorePlugin, new NumberEqualsConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new NumberNotEqualConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new LessThanConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new GreaterThanConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new LessThanOrEqualConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new GreaterThanOrEqualConditionOperator());
|
||||
|
||||
// String operators
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringEqualsConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringNotEqualConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringContainsConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringNotContainsConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringStartsWithConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringEndsWithConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringMatchesRegexConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringNullConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new StringNotNullConditionOperator());
|
||||
|
||||
// Enum operators
|
||||
RegisterConditionOperator(Constants.CorePlugin, new EnumContainsConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new EnumNotContainsConditionOperator());
|
||||
|
||||
// Null checks, at the bottom
|
||||
// TODO: Implement a priority mechanism
|
||||
RegisterConditionOperator(Constants.CorePlugin, new NullConditionOperator());
|
||||
RegisterConditionOperator(Constants.CorePlugin, new NotNullConditionOperator());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
internal class DataBindingService : IDataBindingService
|
||||
{
|
||||
public DataBindingService()
|
||||
{
|
||||
RegisterBuiltInModifiers();
|
||||
}
|
||||
|
||||
public DataBindingModifierTypeRegistration RegisterModifierType(Plugin plugin, BaseDataBindingModifierType dataBindingModifierType)
|
||||
{
|
||||
if (plugin == null)
|
||||
throw new ArgumentNullException(nameof(plugin));
|
||||
if (dataBindingModifierType == null)
|
||||
throw new ArgumentNullException(nameof(dataBindingModifierType));
|
||||
|
||||
dataBindingModifierType.Plugin = plugin;
|
||||
return DataBindingModifierTypeStore.Add(dataBindingModifierType);
|
||||
}
|
||||
|
||||
public void RemoveModifierType(DataBindingModifierTypeRegistration registration)
|
||||
{
|
||||
if (registration == null)
|
||||
throw new ArgumentNullException(nameof(registration));
|
||||
DataBindingModifierTypeStore.Remove(registration);
|
||||
}
|
||||
|
||||
public List<BaseDataBindingModifierType> GetCompatibleModifierTypes(Type type, ModifierTypePart part)
|
||||
{
|
||||
return DataBindingModifierTypeStore.GetForType(type, part).Select(r => r.DataBindingModifierType).ToList();
|
||||
}
|
||||
|
||||
public BaseDataBindingModifierType? GetModifierType(Guid modifierTypePluginGuid, string modifierType)
|
||||
{
|
||||
return DataBindingModifierTypeStore.Get(modifierTypePluginGuid, modifierType)?.DataBindingModifierType;
|
||||
}
|
||||
|
||||
private void RegisterBuiltInModifiers()
|
||||
{
|
||||
// Numbers - General
|
||||
RegisterModifierType(Constants.CorePlugin, new SumModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SubtractModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new MultiplicationModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new DivideModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new PercentageOfModifierType());
|
||||
|
||||
// Numbers - Advanced
|
||||
RegisterModifierType(Constants.CorePlugin, new MaxModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new MinModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new ModuloModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new AbsoluteModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new PowerModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SquareRootModifierType());
|
||||
|
||||
// Numbers - Rounding
|
||||
RegisterModifierType(Constants.CorePlugin, new FloorModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new RoundModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new CeilingModifierType());
|
||||
|
||||
// Numbers - Trigonometric
|
||||
RegisterModifierType(Constants.CorePlugin, new SineModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new CosineModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new TangentModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new CotangentModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SecantModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new CosecantModifierType());
|
||||
|
||||
// Colors
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorSumModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorSaturateModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorDesaturateModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorBrightenModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorDarkenModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorRotateHueModifierType());
|
||||
RegisterModifierType(Constants.CorePlugin, new SKColorInvertModifierType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Properties;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// A service that allows you to register and retrieve conditions operators used by display conditions
|
||||
/// </summary>
|
||||
public interface IConditionOperatorService : IArtemisService
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers a new condition operator for use in layer conditions
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin this condition operator belongs to</param>
|
||||
/// <param name="conditionOperator">The condition operator to register</param>
|
||||
ConditionOperatorRegistration RegisterConditionOperator([NotNull] Plugin plugin, [NotNull] BaseConditionOperator conditionOperator);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a condition operator so it is no longer available for use in layer conditions
|
||||
/// </summary>
|
||||
/// <param name="registration">The registration of the condition operator to remove</param>
|
||||
void RemoveConditionOperator([NotNull] ConditionOperatorRegistration registration);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all the condition operators compatible with the provided type
|
||||
/// </summary>
|
||||
List<BaseConditionOperator> GetConditionOperatorsForType(Type type, ConditionParameterSide side);
|
||||
|
||||
/// <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>
|
||||
BaseConditionOperator? GetConditionOperator(Guid operatorPluginGuid, string operatorType);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Properties;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// A service that allows you to register and retrieve data binding modifiers used by the data bindings system
|
||||
/// </summary>
|
||||
public interface IDataBindingService : IArtemisService
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers a new modifier type for use in data bindings
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin this modifier type belongs to</param>
|
||||
/// <param name="dataBindingModifierType">The modifier type to register</param>
|
||||
DataBindingModifierTypeRegistration RegisterModifierType([NotNull] Plugin plugin, [NotNull] BaseDataBindingModifierType dataBindingModifierType);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a modifier type so it is no longer available for use in data bindings
|
||||
/// </summary>
|
||||
/// <param name="dataBindingModifierType">The registration of the modifier type to remove</param>
|
||||
void RemoveModifierType([NotNull] DataBindingModifierTypeRegistration dataBindingModifierType);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all the data binding modifier types compatible with the provided type
|
||||
/// </summary>
|
||||
List<BaseDataBindingModifierType> GetCompatibleModifierTypes(Type type, ModifierTypePart part);
|
||||
|
||||
/// <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>
|
||||
BaseDataBindingModifierType? GetModifierType(Guid modifierTypePluginGuid, string modifierType);
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,6 @@ namespace Artemis.Core.Services
|
||||
|
||||
public ProfileService(ILogger logger,
|
||||
IRgbService rgbService,
|
||||
// TODO: Move these two
|
||||
IConditionOperatorService conditionOperatorService,
|
||||
IDataBindingService dataBindingService,
|
||||
IProfileCategoryRepository profileCategoryRepository,
|
||||
IPluginManagementService pluginManagementService,
|
||||
IInputService inputService,
|
||||
|
||||
Reference in new issue
Block a user