mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Storage - Display conditions WIP
This commit is contained in:
parent
94f3d84530
commit
f39e4d719c
@ -1,10 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.Conditions.Abstract
|
||||
{
|
||||
public abstract class DisplayConditionPart
|
||||
{
|
||||
public Guid EntityId { get; internal set; }
|
||||
|
||||
private readonly List<DisplayConditionPart> _children;
|
||||
|
||||
protected DisplayConditionPart()
|
||||
|
||||
@ -1,13 +1,42 @@
|
||||
using Artemis.Core.Models.Profile.Conditions.Abstract;
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile.Conditions.Abstract;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.Conditions
|
||||
{
|
||||
public class DisplayConditionGroup : DisplayConditionPart
|
||||
{
|
||||
public DisplayConditionGroup(DisplayConditionPart parent)
|
||||
{
|
||||
Parent = parent;
|
||||
EntityId = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public DisplayConditionGroup(DisplayConditionPart parent, DisplayConditionGroupEntity entity)
|
||||
{
|
||||
DisplayConditionGroupEntity = entity;
|
||||
Parent = parent;
|
||||
EntityId = DisplayConditionGroupEntity.Id;
|
||||
BooleanOperator = (BooleanOperator) DisplayConditionGroupEntity.BooleanOperator;
|
||||
|
||||
foreach (var childEntity in DisplayConditionGroupEntity.Children)
|
||||
{
|
||||
if (childEntity is DisplayConditionGroupEntity groupEntity)
|
||||
AddChild(new DisplayConditionGroup(this, groupEntity));
|
||||
if (childEntity is DisplayConditionPredicateEntity predicateEntity)
|
||||
AddChild(new DisplayConditionPredicate(this, predicateEntity));
|
||||
}
|
||||
}
|
||||
|
||||
public BooleanOperator BooleanOperator { get; set; }
|
||||
public DisplayConditionGroupEntity DisplayConditionGroupEntity { get; set; }
|
||||
|
||||
public override void ApplyToEntity()
|
||||
{
|
||||
DisplayConditionGroupEntity.Id = EntityId;
|
||||
DisplayConditionGroupEntity.ParentId = Parent?.EntityId ?? new Guid();
|
||||
DisplayConditionGroupEntity.BooleanOperator = (int) BooleanOperator;
|
||||
|
||||
foreach (var child in Children)
|
||||
child.ApplyToEntity();
|
||||
}
|
||||
|
||||
@ -4,11 +4,25 @@ using System.Linq.Expressions;
|
||||
using Artemis.Core.Models.Profile.Conditions.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.Conditions
|
||||
{
|
||||
public class DisplayConditionPredicate : DisplayConditionPart
|
||||
{
|
||||
public DisplayConditionPredicate(DisplayConditionPart parent)
|
||||
{
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
public DisplayConditionPredicate(DisplayConditionPart parent, DisplayConditionPredicateEntity entity)
|
||||
{
|
||||
Parent = parent;
|
||||
DisplayConditionPredicateEntity = entity;
|
||||
}
|
||||
|
||||
public DisplayConditionPredicateEntity DisplayConditionPredicateEntity { get; set; }
|
||||
|
||||
public PredicateType PredicateType { get; set; }
|
||||
public DisplayConditionOperator Operator { get; set; }
|
||||
|
||||
@ -96,6 +110,11 @@ namespace Artemis.Core.Models.Profile.Conditions
|
||||
StaticConditionLambda = Expression.Lambda<Func<DataModel, bool>>(conditionExpression, leftSideParameter);
|
||||
CompiledStaticConditionLambda = StaticConditionLambda.Compile();
|
||||
}
|
||||
|
||||
public override void ApplyToEntity()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum PredicateType
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
|
||||
@ -13,6 +13,7 @@ using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
|
||||
@ -6,6 +6,7 @@ using Artemis.Core.Annotations;
|
||||
using Artemis.Core.Models.Profile.Conditions;
|
||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile.Abstract
|
||||
{
|
||||
public abstract class DisplayConditionPartEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ParentId { get; set; }
|
||||
|
||||
public List<DisplayConditionPartEntity> Children { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
namespace Artemis.Storage.Entities.Profile.Abstract
|
||||
{
|
||||
public abstract class EffectsEntity : PropertiesEntity
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
namespace Artemis.Storage.Entities.Profile.Abstract
|
||||
{
|
||||
public abstract class PropertiesEntity
|
||||
{
|
||||
@ -1,11 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class BrushEntity
|
||||
{
|
||||
public Guid BrushPluginGuid { get; set; }
|
||||
public string BrushType { get; set; }
|
||||
public string Configuration { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class DisplayConditionGroupEntity : DisplayConditionPartEntity
|
||||
{
|
||||
public DisplayConditionGroupEntity()
|
||||
{
|
||||
Children = new List<DisplayConditionPartEntity>();
|
||||
}
|
||||
|
||||
public int BooleanOperator { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
public class DisplayConditionPredicateEntity
|
||||
public class DisplayConditionPredicateEntity : DisplayConditionPartEntity
|
||||
{
|
||||
public Guid LeftDataModelGuid { get; set; }
|
||||
public string LeftPropertyPath { get; set; }
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
@ -9,7 +10,6 @@ namespace Artemis.Storage.Entities.Profile
|
||||
public FolderEntity()
|
||||
{
|
||||
PropertyEntities = new List<PropertyEntity>();
|
||||
Conditions = new List<ProfileConditionEntity>();
|
||||
LayerEffects = new List<LayerEffectEntity>();
|
||||
ExpandedPropertyGroups = new List<string>();
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Entities.Profile
|
||||
@ -10,7 +11,6 @@ namespace Artemis.Storage.Entities.Profile
|
||||
{
|
||||
Leds = new List<LedEntity>();
|
||||
PropertyEntities = new List<PropertyEntity>();
|
||||
Conditions = new List<ProfileConditionEntity>();
|
||||
LayerEffects = new List<LayerEffectEntity>();
|
||||
ExpandedPropertyGroups = new List<string>();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user