mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
UI - Moved exception viewer to its own seperate window
Conditions - Started adding list conditions
This commit is contained in:
1 parent
f21ade955d
commit
cb69760971
36 files changed
+930
-471
No files matched your search
@@ -25,8 +25,10 @@ namespace Artemis.Core.Models.Profile.Conditions
|
||||
{
|
||||
if (childEntity is DisplayConditionGroupEntity groupEntity)
|
||||
AddChild(new DisplayConditionGroup(this, groupEntity));
|
||||
if (childEntity is DisplayConditionPredicateEntity predicateEntity)
|
||||
else if (childEntity is DisplayConditionPredicateEntity predicateEntity)
|
||||
AddChild(new DisplayConditionPredicate(this, predicateEntity));
|
||||
else if (childEntity is DisplayConditionListPredicateEntity listPredicateEntity)
|
||||
AddChild(new DisplayConditionListPredicate(this, listPredicateEntity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,100 @@
|
||||
using Artemis.Core.Models.Profile.Conditions.Abstract;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Profile.Conditions.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.Conditions
|
||||
{
|
||||
public class DisplayConditionListPredicate : DisplayConditionPart
|
||||
{
|
||||
public DisplayConditionListPredicate(DisplayConditionPart parent)
|
||||
{
|
||||
Parent = parent;
|
||||
DisplayConditionListPredicateEntity = new DisplayConditionListPredicateEntity();
|
||||
}
|
||||
|
||||
public DisplayConditionListPredicate(DisplayConditionPart parent, DisplayConditionListPredicateEntity entity)
|
||||
{
|
||||
Parent = parent;
|
||||
DisplayConditionListPredicateEntity = entity;
|
||||
ListOperator = (ListOperator) entity.ListOperator;
|
||||
|
||||
foreach (var childEntity in DisplayConditionListPredicateEntity.Children)
|
||||
{
|
||||
if (childEntity is DisplayConditionGroupEntity groupEntity)
|
||||
AddChild(new DisplayConditionGroup(this, groupEntity));
|
||||
else if (childEntity is DisplayConditionPredicateEntity predicateEntity)
|
||||
AddChild(new DisplayConditionPredicate(this, predicateEntity));
|
||||
else if (childEntity is DisplayConditionListPredicateEntity listPredicateEntity)
|
||||
AddChild(new DisplayConditionListPredicate(this, listPredicateEntity));
|
||||
}
|
||||
}
|
||||
|
||||
public DisplayConditionListPredicateEntity DisplayConditionListPredicateEntity { get; set; }
|
||||
|
||||
public ListOperator ListOperator { get; set; }
|
||||
public DataModel ListDataModel { get; private set; }
|
||||
public string ListPropertyPath { get; private set; }
|
||||
|
||||
public override bool Evaluate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
{
|
||||
// Target list
|
||||
DisplayConditionListPredicateEntity.ListDataModelGuid = ListDataModel?.PluginInfo?.Guid;
|
||||
DisplayConditionListPredicateEntity.ListPropertyPath = ListPropertyPath;
|
||||
|
||||
// Operator
|
||||
DisplayConditionListPredicateEntity.ListOperator = (int) ListOperator;
|
||||
|
||||
// Children
|
||||
DisplayConditionListPredicateEntity.Children.Clear();
|
||||
DisplayConditionListPredicateEntity.Children.AddRange(Children.Select(c => c.GetEntity()));
|
||||
foreach (var child in Children)
|
||||
child.ApplyToEntity();
|
||||
}
|
||||
|
||||
internal override DisplayConditionPartEntity GetEntity()
|
||||
{
|
||||
return null;
|
||||
return DisplayConditionListPredicateEntity;
|
||||
}
|
||||
|
||||
internal override void Initialize(IDataModelService dataModelService)
|
||||
{
|
||||
// Target list
|
||||
if (DisplayConditionListPredicateEntity.ListDataModelGuid != null)
|
||||
{
|
||||
var dataModel = dataModelService.GetPluginDataModelByGuid(DisplayConditionListPredicateEntity.ListDataModelGuid.Value);
|
||||
if (dataModel != null && dataModel.ContainsPath(DisplayConditionListPredicateEntity.ListPropertyPath))
|
||||
UpdateList(dataModel, DisplayConditionListPredicateEntity.ListPropertyPath);
|
||||
}
|
||||
|
||||
// Children
|
||||
foreach (var child in Children)
|
||||
child.Initialize(dataModelService);
|
||||
}
|
||||
|
||||
public void UpdateList(DataModel dataModel, string path)
|
||||
{
|
||||
if (dataModel != null && path == null)
|
||||
throw new ArtemisCoreException("If a data model is provided, a path is also required");
|
||||
if (dataModel == null && path != null)
|
||||
throw new ArtemisCoreException("If path is provided, a data model is also required");
|
||||
|
||||
if (dataModel != null)
|
||||
{
|
||||
if (!dataModel.ContainsPath(path))
|
||||
throw new ArtemisCoreException($"Data model of type {dataModel.GetType().Name} does not contain a property at path '{path}'");
|
||||
}
|
||||
|
||||
ListDataModel = dataModel;
|
||||
ListPropertyPath = path;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
"Id": "2464a52c-4cec-4f17-87ed-edfe4bfed6f6",
|
||||
"ParentId": "cc21b67c-3485-4dc6-b2af-105fda42a915",
|
||||
"Order": 1,
|
||||
"Name": "Teal layer",
|
||||
"Name": "Noise",
|
||||
"Enabled": true,
|
||||
"Leds": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.LedEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
@@ -149,14 +149,14 @@
|
||||
"$values": [
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:02.5000000",
|
||||
"Position": "00:00:01.3200000",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":300.0,\"Height\":0.0}",
|
||||
"EasingFunction": 3
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:03.7500000",
|
||||
"Position": "00:00:03",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":300.0,\"Height\":400.0}",
|
||||
"EasingFunction": 0
|
||||
@@ -193,7 +193,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:04.4000000",
|
||||
"Position": "00:00:04.9100000",
|
||||
"Timeline": 0,
|
||||
"Value": "0.0",
|
||||
"EasingFunction": 0
|
||||
@@ -205,7 +205,7 @@
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "61cbbf01-8d69-4ede-a972-f3f269da66d9",
|
||||
"Path": "LayerBrush.ColorType",
|
||||
"Value": "0",
|
||||
"Value": "1",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
@@ -238,7 +238,7 @@
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "61cbbf01-8d69-4ede-a972-f3f269da66d9",
|
||||
"Path": "LayerBrush.GradientColor",
|
||||
"Value": "{\"Stops\":[{\"Color\":\"#ffff0000\",\"Position\":0.0},{\"Color\":\"#ffff8800\",\"Position\":0.125},{\"Color\":\"#ffedff00\",\"Position\":0.25},{\"Color\":\"#ff65ff00\",\"Position\":0.375},{\"Color\":\"#ff00ff22\",\"Position\":0.5},{\"Color\":\"#ff00ffaa\",\"Position\":0.625},{\"Color\":\"#ff00cbff\",\"Position\":0.75},{\"Color\":\"#ff0043ff\",\"Position\":0.875},{\"Color\":\"#ffff0000\",\"Position\":1.0}],\"Rotation\":0.0}",
|
||||
"Value": "{\"Stops\":[{\"Color\":\"#ff0b4a40\",\"Position\":0.0},{\"Color\":\"#ff00897c\",\"Position\":0.242},{\"Color\":\"#ffffffff\",\"Position\":1.0},{\"Color\":\"#ff00ffe6\",\"Position\":0.67391306}],\"Rotation\":0.0}",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
@@ -249,7 +249,7 @@
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "61cbbf01-8d69-4ede-a972-f3f269da66d9",
|
||||
"Path": "LayerBrush.Scale",
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":100.0,\"Height\":100.0}",
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":44.9,\"Height\":31.0}",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
@@ -260,7 +260,7 @@
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "61cbbf01-8d69-4ede-a972-f3f269da66d9",
|
||||
"Path": "LayerBrush.Hardness",
|
||||
"Value": "300.0",
|
||||
"Value": "228.5",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
@@ -294,267 +294,6 @@
|
||||
"ExpandedPropertyGroups": {
|
||||
"$type": "System.Collections.Generic.List`1[[System.String, System.Private.CoreLib]], System.Private.CoreLib",
|
||||
"$values": [
|
||||
"Transform",
|
||||
"General"
|
||||
]
|
||||
},
|
||||
"RootDisplayCondition": {
|
||||
"$type": "Artemis.Storage.Entities.Profile.DisplayConditionGroupEntity, Artemis.Storage",
|
||||
"BooleanOperator": 0,
|
||||
"Children": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.Abstract.DisplayConditionPartEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.LayerEntity, Artemis.Storage",
|
||||
"Id": "8d5fa358-88ed-4501-8cb2-fd9c31a34274",
|
||||
"ParentId": "cc21b67c-3485-4dc6-b2af-105fda42a915",
|
||||
"Order": 2,
|
||||
"Name": "RGB layer",
|
||||
"Enabled": true,
|
||||
"Leds": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.LedEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
},
|
||||
"Profile": null,
|
||||
"ProfileId": "eb4f487b-475b-408f-a84f-733412d41b44",
|
||||
"StartSegmentLength": "00:00:00",
|
||||
"MainSegmentLength": "00:00:03.7500000",
|
||||
"EndSegmentLength": "00:00:00",
|
||||
"DisplayContinuously": false,
|
||||
"AlwaysFinishTimeline": false,
|
||||
"LayerEffects": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.LayerEffectEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
},
|
||||
"PropertyEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": [
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "General.ShapeType",
|
||||
"Value": "1",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "General.ResizeMode",
|
||||
"Value": "0",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "General.BlendMode",
|
||||
"Value": "3",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "General.BrushReference",
|
||||
"Value": "{\"BrushPluginGuid\":\"92a9d6ba-6f7a-4937-94d5-c1d715b4141a\",\"BrushType\":\"ColorBrush\"}",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "Transform.AnchorPoint",
|
||||
"Value": "{\"IsEmpty\":true,\"Length\":0.0,\"LengthSquared\":0.0,\"X\":0.0,\"Y\":0.0}",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "Transform.Position",
|
||||
"Value": "{\"IsEmpty\":false,\"Length\":0.5,\"LengthSquared\":0.25,\"X\":-0.5,\"Y\":-0.0}",
|
||||
"KeyframesEnabled": true,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": [
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:01.2500000",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Length\":0.25,\"LengthSquared\":0.0625,\"X\":-0.25,\"Y\":0.0}",
|
||||
"EasingFunction": 0
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:03.7500000",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Length\":0.25,\"LengthSquared\":0.0625,\"X\":0.25,\"Y\":0.0}",
|
||||
"EasingFunction": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "Transform.Scale",
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":200.0,\"Height\":0.0}",
|
||||
"KeyframesEnabled": true,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": [
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:01.2500000",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":150.0,\"Height\":0.0}",
|
||||
"EasingFunction": 5
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:02.2700000",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":150.0,\"Height\":100.0}",
|
||||
"EasingFunction": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "Transform.Rotation",
|
||||
"Value": "0.0",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "ffffffff-ffff-ffff-ffff-ffffffffffff",
|
||||
"Path": "Transform.Opacity",
|
||||
"Value": "100.0",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.GradientType",
|
||||
"Value": "1",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.TileMode",
|
||||
"Value": "0",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.Color",
|
||||
"Value": "\"#ffff0000\"",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.Colors",
|
||||
"Value": "{\"Stops\":[{\"Color\":\"#ffff0000\",\"Position\":0.0},{\"Color\":\"#ffff8800\",\"Position\":0.125},{\"Color\":\"#ffedff00\",\"Position\":0.25},{\"Color\":\"#ff65ff00\",\"Position\":0.375},{\"Color\":\"#ff00ff22\",\"Position\":0.5},{\"Color\":\"#ff00ffaa\",\"Position\":0.625},{\"Color\":\"#ff00cbff\",\"Position\":0.75},{\"Color\":\"#ff0043ff\",\"Position\":0.875},{\"Color\":\"#ffff0000\",\"Position\":1.0}],\"Rotation\":0.0}",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.ColorsMultiplier",
|
||||
"Value": "2",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.LinearGradientRotation",
|
||||
"Value": "0.0",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.RadialGradient.CenterOffset",
|
||||
"Value": "{\"IsEmpty\":true,\"Length\":0.0,\"LengthSquared\":0.0,\"X\":0.0,\"Y\":0.0}",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.PropertyEntity, Artemis.Storage",
|
||||
"PluginGuid": "92a9d6ba-6f7a-4937-94d5-c1d715b4141a",
|
||||
"Path": "LayerBrush.RadialGradient.ResizeMode",
|
||||
"Value": "0",
|
||||
"KeyframesEnabled": false,
|
||||
"KeyframeEntities": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
"$values": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ExpandedPropertyGroups": {
|
||||
"$type": "System.Collections.Generic.List`1[[System.String, System.Private.CoreLib]], System.Private.CoreLib",
|
||||
"$values": [
|
||||
"Transform",
|
||||
"LayerBrush"
|
||||
]
|
||||
},
|
||||
@@ -571,8 +310,8 @@
|
||||
"$type": "Artemis.Storage.Entities.Profile.LayerEntity, Artemis.Storage",
|
||||
"Id": "72a7e56c-0649-4449-8dca-eb937161f228",
|
||||
"ParentId": "cc21b67c-3485-4dc6-b2af-105fda42a915",
|
||||
"Order": 3,
|
||||
"Name": "Exploison layer",
|
||||
"Order": 2,
|
||||
"Name": "Exploison",
|
||||
"Enabled": true,
|
||||
"Leds": {
|
||||
"$type": "System.Collections.Generic.List`1[[Artemis.Storage.Entities.Profile.LedEntity, Artemis.Storage]], System.Private.CoreLib",
|
||||
@@ -581,7 +320,7 @@
|
||||
"Profile": null,
|
||||
"ProfileId": "eb4f487b-475b-408f-a84f-733412d41b44",
|
||||
"StartSegmentLength": "00:00:00",
|
||||
"MainSegmentLength": "00:00:02.2500000",
|
||||
"MainSegmentLength": "00:00:03",
|
||||
"EndSegmentLength": "00:00:00",
|
||||
"DisplayContinuously": false,
|
||||
"AlwaysFinishTimeline": false,
|
||||
@@ -676,9 +415,9 @@
|
||||
},
|
||||
{
|
||||
"$type": "Artemis.Storage.Entities.Profile.KeyframeEntity, Artemis.Storage",
|
||||
"Position": "00:00:02",
|
||||
"Position": "00:00:01.5000000",
|
||||
"Timeline": 0,
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":200.0,\"Height\":200.0}",
|
||||
"Value": "{\"IsEmpty\":false,\"Width\":300.0,\"Height\":300.0}",
|
||||
"EasingFunction": 0
|
||||
}
|
||||
]
|
||||
@@ -798,9 +537,7 @@
|
||||
},
|
||||
"ExpandedPropertyGroups": {
|
||||
"$type": "System.Collections.Generic.List`1[[System.String, System.Private.CoreLib]], System.Private.CoreLib",
|
||||
"$values": [
|
||||
"LayerBrush"
|
||||
]
|
||||
"$values": []
|
||||
},
|
||||
"RootDisplayCondition": {
|
||||
"$type": "Artemis.Storage.Entities.Profile.DisplayConditionGroupEntity, Artemis.Storage",
|
||||
@@ -815,7 +552,7 @@
|
||||
"$type": "Artemis.Storage.Entities.Profile.LayerEntity, Artemis.Storage",
|
||||
"Id": "f046f56f-a236-4ed6-bbd9-b5a4731878cf",
|
||||
"ParentId": "cc21b67c-3485-4dc6-b2af-105fda42a915",
|
||||
"Order": 4,
|
||||
"Order": 2,
|
||||
"Name": "Background",
|
||||
"Enabled": true,
|
||||
"Leds": {
|
||||
@@ -825,7 +562,7 @@
|
||||
"Profile": null,
|
||||
"ProfileId": "eb4f487b-475b-408f-a84f-733412d41b44",
|
||||
"StartSegmentLength": "00:00:00",
|
||||
"MainSegmentLength": "00:00:03.7500000",
|
||||
"MainSegmentLength": "00:00:03",
|
||||
"EndSegmentLength": "00:00:00",
|
||||
"DisplayContinuously": false,
|
||||
"AlwaysFinishTimeline": false,
|
||||
|
||||
@@ -88,9 +88,26 @@ namespace Artemis.Core.Services.Storage.Interfaces
|
||||
bool RedoUpdateProfile(Profile profile);
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the profile for rendering. You should not need to call this, it is exposed for some niche usage in the core
|
||||
/// Prepares the profile for rendering. You should not need to call this, it is exposed for some niche usage in the
|
||||
/// core
|
||||
/// </summary>
|
||||
/// <param name="profile"></param>
|
||||
void InstantiateProfile(Profile profile);
|
||||
|
||||
/// <summary>
|
||||
/// [Placeholder] Exports the profile described in the given <see cref="ProfileDescriptor" /> in a JSON format
|
||||
/// </summary>
|
||||
/// <param name="profileDescriptor">The descriptor of the profile to export</param>
|
||||
/// <returns>The resulting JSON</returns>
|
||||
string ExportProfile(ProfileDescriptor profileDescriptor);
|
||||
|
||||
/// <summary>
|
||||
/// [Placeholder] Imports the provided base64 encoded GZIPed JSON as a profile for the given
|
||||
/// <see cref="ProfileModule" />
|
||||
/// </summary>
|
||||
/// <param name="json">The content of the profile as JSON</param>
|
||||
/// <param name="profileModule">The module to import the profile in to</param>
|
||||
/// <returns></returns>
|
||||
ProfileDescriptor ImportProfile(string json, ProfileModule profileModule);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
@@ -10,6 +11,7 @@ using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.Core.Utilities;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
@@ -40,6 +42,7 @@ namespace Artemis.Core.Services.Storage
|
||||
}
|
||||
|
||||
public JsonSerializerSettings MementoSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
|
||||
public JsonSerializerSettings ExportSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All, Formatting = Formatting.Indented};
|
||||
|
||||
public void ActivateLastActiveProfiles()
|
||||
{
|
||||
@@ -222,6 +225,26 @@ namespace Artemis.Core.Services.Storage
|
||||
InstantiateFolders(profile);
|
||||
}
|
||||
|
||||
public string ExportProfile(ProfileDescriptor profileDescriptor)
|
||||
{
|
||||
var profileEntity = _profileRepository.Get(profileDescriptor.Id);
|
||||
if (profileEntity == null)
|
||||
throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}");
|
||||
|
||||
return JsonConvert.SerializeObject(profileEntity, ExportSettings);
|
||||
}
|
||||
|
||||
public ProfileDescriptor ImportProfile(string json, ProfileModule profileModule)
|
||||
{
|
||||
var profileEntity = JsonConvert.DeserializeObject<ProfileEntity>(json, ExportSettings);
|
||||
|
||||
// Assign a new GUID to make sure it is unique in case of a previous import of the same content
|
||||
profileEntity.Id = Guid.NewGuid();
|
||||
|
||||
_profileRepository.Add(profileEntity);
|
||||
return new ProfileDescriptor(profileModule, profileEntity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the properties on the layers of the given profile
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user