mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
commit
bc8b3b5482
@ -8,8 +8,8 @@ using Artemis.Core.Services.Core;
|
||||
using Artemis.Core.SkiaSharp;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A few useful constant values
|
||||
/// </summary>
|
||||
@ -33,7 +33,9 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// The base path for Artemis application data folder
|
||||
/// </summary>
|
||||
public static readonly string BaseFolder = Environment.GetFolderPath(OperatingSystem.IsWindows() ? Environment.SpecialFolder.CommonApplicationData : Environment.SpecialFolder.LocalApplicationData);
|
||||
public static readonly string BaseFolder = Environment.GetFolderPath(OperatingSystem.IsWindows()
|
||||
? Environment.SpecialFolder.CommonApplicationData
|
||||
: Environment.SpecialFolder.LocalApplicationData);
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis data folder
|
||||
@ -55,6 +57,11 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public static readonly string LayoutsFolder = Path.Combine(DataFolder, "User Layouts");
|
||||
|
||||
/// <summary>
|
||||
/// The current API version for plugins
|
||||
/// </summary>
|
||||
public static readonly Version PluginApi = new(1, 0);
|
||||
|
||||
/// <summary>
|
||||
/// The plugin info used by core components of Artemis
|
||||
/// </summary>
|
||||
@ -146,4 +153,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public static IManagedGraphicsContext? ManagedGraphicsContext { get; internal set; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class BoolLayerProperty : LayerProperty<bool>
|
||||
{
|
||||
@ -7,13 +7,6 @@
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
KeyframesSupported = false;
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="BoolLayerProperty" /> to a <see cref="bool" />
|
||||
/// </summary>
|
||||
@ -22,10 +15,16 @@
|
||||
return p.CurrentValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
KeyframesSupported = false;
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
throw new ArtemisCoreException("Boolean properties do not support keyframes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class EnumLayerProperty<T> : LayerProperty<T> where T : Enum
|
||||
{
|
||||
@ -32,4 +32,3 @@ namespace Artemis.Core
|
||||
throw new ArtemisCoreException("Enum properties do not support keyframes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class FloatLayerProperty : LayerProperty<float>
|
||||
{
|
||||
@ -7,12 +7,6 @@
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="FloatLayerProperty" /> to a <see cref="float" />
|
||||
/// </summary>
|
||||
@ -29,6 +23,12 @@
|
||||
return p.CurrentValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
@ -36,4 +36,3 @@
|
||||
CurrentValue = CurrentKeyframe!.Value + diff * keyframeProgressEased;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class FloatRangeLayerProperty : LayerProperty<FloatRange>
|
||||
{
|
||||
@ -16,9 +16,8 @@
|
||||
float startDiff = NextKeyframe!.Value.Start - CurrentKeyframe!.Value.Start;
|
||||
float endDiff = NextKeyframe!.Value.End - CurrentKeyframe!.Value.End;
|
||||
CurrentValue = new FloatRange(
|
||||
(float) (CurrentKeyframe!.Value.Start + startDiff * keyframeProgressEased),
|
||||
(float) (CurrentKeyframe!.Value.End + endDiff * keyframeProgressEased)
|
||||
CurrentKeyframe!.Value.Start + startDiff * keyframeProgressEased,
|
||||
CurrentKeyframe!.Value.End + endDiff * keyframeProgressEased
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class IntLayerProperty : LayerProperty<int>
|
||||
{
|
||||
@ -9,12 +9,6 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="IntLayerProperty" /> to an <see cref="int" />
|
||||
/// </summary>
|
||||
@ -39,6 +33,12 @@ namespace Artemis.Core
|
||||
return p.CurrentValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
@ -46,4 +46,3 @@ namespace Artemis.Core
|
||||
CurrentValue = (int) Math.Round(CurrentKeyframe!.Value + diff * keyframeProgressEased, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class IntRangeLayerProperty : LayerProperty<IntRange>
|
||||
{
|
||||
@ -21,4 +21,3 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A special layer property used to configure the selected layer brush
|
||||
/// </summary>
|
||||
@ -24,4 +24,3 @@
|
||||
throw new ArtemisCoreException("Layer brush references do not support keyframes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class SKColorLayerProperty : LayerProperty<SKColor>
|
||||
{
|
||||
@ -9,12 +9,6 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="SKColorLayerProperty" /> to an <see cref="SKColor" />¶
|
||||
/// </summary>
|
||||
@ -25,10 +19,15 @@ namespace Artemis.Core
|
||||
return p.CurrentValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue, value => CurrentValue = value, "Value");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
CurrentValue = CurrentKeyframe!.Value.Interpolate(NextKeyframe!.Value, keyframeProgressEased);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class SKPointLayerProperty : LayerProperty<SKPoint>
|
||||
{
|
||||
@ -9,13 +9,6 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.X, value => CurrentValue = new SKPoint(value, CurrentValue.Y), "X");
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.Y, value => CurrentValue = new SKPoint(CurrentValue.X, value), "Y");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="SKPointLayerProperty" /> to an <see cref="SKPoint" />
|
||||
/// </summary>
|
||||
@ -24,6 +17,13 @@ namespace Artemis.Core
|
||||
return p.CurrentValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.X, value => CurrentValue = new SKPoint(value, CurrentValue.Y), "X");
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.Y, value => CurrentValue = new SKPoint(CurrentValue.X, value), "Y");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
@ -32,4 +32,3 @@ namespace Artemis.Core
|
||||
CurrentValue = new SKPoint(CurrentKeyframe!.Value.X + xDiff * keyframeProgressEased, CurrentKeyframe!.Value.Y + yDiff * keyframeProgressEased);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class SKSizeLayerProperty : LayerProperty<SKSize>
|
||||
{
|
||||
@ -9,13 +9,6 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.Width, (value) => CurrentValue = new SKSize(value, CurrentValue.Height), "Width");
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.Height, (value) => CurrentValue = new SKSize(CurrentValue.Width, value), "Height");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="SKSizeLayerProperty" /> to an <see cref="SKSize" />
|
||||
/// </summary>
|
||||
@ -24,6 +17,13 @@ namespace Artemis.Core
|
||||
return p.CurrentValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.Width, value => CurrentValue = new SKSize(value, CurrentValue.Height), "Width");
|
||||
DataBinding.RegisterDataBindingProperty(() => CurrentValue.Height, value => CurrentValue = new SKSize(CurrentValue.Width, value), "Height");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
@ -32,4 +32,3 @@ namespace Artemis.Core
|
||||
CurrentValue = new SKSize(CurrentKeyframe!.Value.Width + widthDiff * keyframeProgressEased, CurrentKeyframe!.Value.Height + heightDiff * keyframeProgressEased);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about data model path related events
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public DataModelPath DataModelPath { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about device related events
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public ArtemisDevice Device { get; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using Artemis.Core.Modules;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about dynamic data model child related events
|
||||
/// </summary>
|
||||
@ -24,4 +24,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public string Key { get; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about frame rendering related events
|
||||
/// </summary>
|
||||
@ -24,4 +24,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public RGBSurface RgbSurface { get; }
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about frame rendered related events
|
||||
/// </summary>
|
||||
@ -31,4 +31,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public RGBSurface RgbSurface { get; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using Artemis.Core.Modules;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about module events
|
||||
/// </summary>
|
||||
@ -18,4 +18,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public Module Module { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about plugin related events
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public Plugin Plugin { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about plugin feature related events
|
||||
/// </summary>
|
||||
@ -33,4 +33,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public PluginFeatureInfo PluginFeatureInfo { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data for data binding events.
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public IDataBinding DataBinding { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data for the <see langword='DataBindingPropertyUpdatedEvent' /> event.
|
||||
/// </summary>
|
||||
@ -18,4 +18,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public T Value { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data for layer property events.
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public ILayerProperty LayerProperty { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data for profile configuration events.
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public ProfileConfiguration ProfileConfiguration { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data for profile element events.
|
||||
/// </summary>
|
||||
@ -17,4 +17,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public ProfileElement ProfileElement { get; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about application restart events
|
||||
/// </summary>
|
||||
@ -30,4 +30,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public List<string>? ExtraArgs { get; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal class DataModelStoreEvent
|
||||
{
|
||||
public DataModelStoreEvent(DataModelRegistration registration)
|
||||
@ -9,4 +9,3 @@
|
||||
|
||||
public DataModelRegistration Registration { get; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal class LayerBrushStoreEvent
|
||||
{
|
||||
public LayerBrushStoreEvent(LayerBrushRegistration registration)
|
||||
@ -9,4 +9,3 @@
|
||||
|
||||
public LayerBrushRegistration Registration { get; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal class LayerEffectStoreEvent
|
||||
{
|
||||
public LayerEffectStoreEvent(LayerEffectRegistration registration)
|
||||
@ -9,4 +9,3 @@
|
||||
|
||||
public LayerEffectRegistration Registration { get; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal class NodeTypeStoreEvent
|
||||
{
|
||||
public NodeTypeStoreEvent(NodeTypeRegistration typeRegistration)
|
||||
@ -9,4 +9,3 @@
|
||||
|
||||
public NodeTypeRegistration TypeRegistration { get; }
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides data about device configuration related events
|
||||
/// </summary>
|
||||
@ -18,4 +18,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public List<ArtemisDevice> Devices { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents errors that occur within the Artemis Core
|
||||
/// </summary>
|
||||
@ -15,4 +15,3 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents SkiaSharp graphics-context related errors
|
||||
/// </summary>
|
||||
@ -22,4 +22,3 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// An exception thrown when a plugin-related error occurs
|
||||
/// </summary>
|
||||
@ -50,4 +50,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public Plugin? Plugin { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// An exception thrown when a plugin feature-related error occurs
|
||||
/// </summary>
|
||||
@ -27,4 +27,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public PluginFeature PluginFeature { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// An exception thrown when a plugin lock file error occurs
|
||||
/// </summary>
|
||||
@ -18,4 +18,3 @@ namespace Artemis.Core
|
||||
: "Found a lock file, skipping load.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// An exception thrown when a plugin prerequisite-related error occurs
|
||||
/// </summary>
|
||||
@ -27,4 +27,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public IPrerequisitesSubject Subject { get; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal static class DirectoryInfoExtensions
|
||||
{
|
||||
public static void CopyFilesRecursively(this DirectoryInfo source, DirectoryInfo target)
|
||||
@ -29,4 +29,3 @@ namespace Artemis.Core
|
||||
baseDir.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A static class providing <see cref="double" /> extensions
|
||||
/// </summary>
|
||||
@ -19,4 +19,3 @@ namespace Artemis.Core
|
||||
return (int) Math.Round(number, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A static class providing <see cref="float" /> extensions
|
||||
/// </summary>
|
||||
@ -19,4 +19,3 @@ namespace Artemis.Core
|
||||
return (int) MathF.Round(number, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19,11 +19,10 @@
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A static class providing <see cref="IEnumerable{T}" /> extensions
|
||||
/// </summary>
|
||||
@ -50,4 +49,3 @@ namespace Artemis.Core
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,15 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A static class providing <see cref="Process" /> extensions
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1060:Move pinvokes to native methods class", Justification = "I don't care, piss off")]
|
||||
[SuppressMessage("Design", "CA1060:Move pinvokes to native methods class", Justification = "I don't care, piss off")]
|
||||
public static class ProcessExtensions
|
||||
{
|
||||
/// <summary>
|
||||
@ -38,4 +39,3 @@ namespace Artemis.Core
|
||||
QueryLimitedInformation = 0x00001000
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal static class RgbDeviceExtensions
|
||||
{
|
||||
public static string GetDeviceIdentifier(this IRGBDevice rgbDevice)
|
||||
@ -37,4 +37,3 @@ namespace Artemis.Core
|
||||
return SKRectI.Round(ToSKRect(rectangle));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A static class providing <see cref="SKColor" /> extensions
|
||||
/// </summary>
|
||||
@ -75,4 +75,3 @@ namespace Artemis.Core
|
||||
return (byte) Math.Clamp(value, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal static class SKPaintExtensions
|
||||
{
|
||||
internal static void DisposeSelfAndProperties(this SKPaint paint)
|
||||
@ -13,4 +13,3 @@ namespace Artemis.Core
|
||||
paint.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,13 +25,12 @@
|
||||
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
internal static class StreamExtensions
|
||||
{
|
||||
private const int DefaultBufferSize = 81920;
|
||||
@ -131,4 +130,3 @@ namespace Artemis.Core
|
||||
return CopyToAsync(source, 0L, destination, 0, progress, default);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,8 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using Humanizer;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A static class providing <see cref="Type" /> extensions
|
||||
/// </summary>
|
||||
@ -192,6 +192,28 @@ namespace Artemis.Core
|
||||
return typeToCheck.IsOfGenericType(genericType, out Type? _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines a display name for the given type
|
||||
/// </summary>
|
||||
/// <param name="type">The type to determine the name for</param>
|
||||
/// <param name="humanize">Whether or not to humanize the result, defaults to false</param>
|
||||
/// <returns></returns>
|
||||
public static string GetDisplayName(this Type type, bool humanize = false)
|
||||
{
|
||||
if (!type.IsGenericType)
|
||||
{
|
||||
string displayValue = TypeKeywords.TryGetValue(type, out string? keyword) ? keyword! : type.Name;
|
||||
return humanize ? displayValue.Humanize() : displayValue;
|
||||
}
|
||||
|
||||
Type genericTypeDefinition = type.GetGenericTypeDefinition();
|
||||
if (genericTypeDefinition == typeof(Nullable<>))
|
||||
return type.GenericTypeArguments[0].GetDisplayName(humanize) + "?";
|
||||
|
||||
string stripped = genericTypeDefinition.Name.Split('`')[0];
|
||||
return $"{stripped}<{string.Join(", ", type.GenericTypeArguments.Select(t => t.GetDisplayName(humanize)))}>";
|
||||
}
|
||||
|
||||
private static bool IsOfGenericType(this Type? typeToCheck, Type genericType, out Type? concreteGenericType)
|
||||
{
|
||||
while (true)
|
||||
@ -221,33 +243,12 @@ namespace Artemis.Core
|
||||
|
||||
if (genericType.IsInterface)
|
||||
foreach (Type i in typeToCheck.GetInterfaces())
|
||||
{
|
||||
if (i.IsOfGenericType(genericType, out concreteGenericType))
|
||||
return true;
|
||||
}
|
||||
|
||||
typeToCheck = typeToCheck.BaseType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines a display name for the given type
|
||||
/// </summary>
|
||||
/// <param name="type">The type to determine the name for</param>
|
||||
/// <param name="humanize">Whether or not to humanize the result, defaults to false</param>
|
||||
/// <returns></returns>
|
||||
public static string GetDisplayName(this Type type, bool humanize = false)
|
||||
{
|
||||
if (!type.IsGenericType)
|
||||
{
|
||||
string displayValue = TypeKeywords.TryGetValue(type, out string? keyword) ? keyword! : type.Name;
|
||||
return humanize ? displayValue.Humanize() : displayValue;
|
||||
}
|
||||
|
||||
Type genericTypeDefinition = type.GetGenericTypeDefinition();
|
||||
if (genericTypeDefinition == typeof(Nullable<>))
|
||||
return type.GenericTypeArguments[0].GetDisplayName(humanize) + "?";
|
||||
|
||||
string stripped = genericTypeDefinition.Name.Split('`')[0];
|
||||
return $"{stripped}<{string.Join(", ", type.GenericTypeArguments.Select(t => t.GetDisplayName(humanize)))}>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@ using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Artemis.Core.JsonConverters
|
||||
{
|
||||
namespace Artemis.Core.JsonConverters;
|
||||
|
||||
/// <summary>
|
||||
/// An int converter that, if required, will round float values
|
||||
/// </summary>
|
||||
@ -30,4 +30,3 @@ namespace Artemis.Core.JsonConverters
|
||||
throw new JsonReaderException("Failed to deserialize forgiving int value");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core.JsonConverters
|
||||
{
|
||||
namespace Artemis.Core.JsonConverters;
|
||||
|
||||
internal class NumericJsonConverter : JsonConverter<Numeric>
|
||||
{
|
||||
#region Overrides of JsonConverter<Numeric>
|
||||
@ -22,4 +22,3 @@ namespace Artemis.Core.JsonConverters
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.JsonConverters
|
||||
{
|
||||
namespace Artemis.Core.JsonConverters;
|
||||
|
||||
internal class SKColorConverter : JsonConverter<SKColor>
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, SKColor value, JsonSerializer serializer)
|
||||
@ -19,4 +19,3 @@ namespace Artemis.Core.JsonConverters
|
||||
return SKColor.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core.JsonConverters
|
||||
{
|
||||
namespace Artemis.Core.JsonConverters;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class StreamConverter : JsonConverter<Stream>
|
||||
{
|
||||
@ -42,4 +42,3 @@ namespace Artemis.Core.JsonConverters
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -2,22 +2,18 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Artemis.Core.Properties;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a basic bindable class which notifies when a property value changes.
|
||||
/// </summary>
|
||||
public abstract class CorePropertyChanged : INotifyPropertyChanged
|
||||
{
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
@ -71,4 +67,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a default implementation for models that can have a broken state
|
||||
/// </summary>
|
||||
@ -89,4 +89,3 @@ namespace Artemis.Core
|
||||
/// <inheritdoc />
|
||||
public event EventHandler? BrokenStateChanged;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a model that can have a broken state
|
||||
/// </summary>
|
||||
@ -56,4 +56,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
event EventHandler BrokenStateChanged;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a model that can be loaded and saved to persistent storage
|
||||
/// </summary>
|
||||
@ -15,4 +15,3 @@
|
||||
/// </summary>
|
||||
void Save();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a model that updates using a delta time
|
||||
/// </summary>
|
||||
@ -11,4 +11,3 @@
|
||||
/// <param name="timeline">The timeline to apply during update</param>
|
||||
void Update(Timeline timeline);
|
||||
}
|
||||
}
|
||||
@ -2,17 +2,17 @@
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Entities.Profile.AdaptionHints;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a hint that adapts layers to a certain category of devices
|
||||
/// </summary>
|
||||
public class CategoryAdaptionHint : CorePropertyChanged, IAdaptionHint
|
||||
{
|
||||
private DeviceCategory _category;
|
||||
private int _skip;
|
||||
private bool _limitAmount;
|
||||
private int _amount;
|
||||
private DeviceCategory _category;
|
||||
private bool _limitAmount;
|
||||
private int _skip;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="CategoryAdaptionHint" /> class
|
||||
@ -96,4 +96,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -3,17 +3,17 @@ using System.Linq;
|
||||
using Artemis.Storage.Entities.Profile.AdaptionHints;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a hint that adapts layers to a certain type of devices
|
||||
/// </summary>
|
||||
public class DeviceAdaptionHint : CorePropertyChanged, IAdaptionHint
|
||||
{
|
||||
private RGBDeviceType _deviceType;
|
||||
private int _skip;
|
||||
private bool _limitAmount;
|
||||
private int _amount;
|
||||
private RGBDeviceType _deviceType;
|
||||
private bool _limitAmount;
|
||||
private int _skip;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="DeviceAdaptionHint" /> class
|
||||
@ -97,4 +97,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Storage.Entities.Profile.AdaptionHints;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an adaption hint that's used to adapt a layer to a set of devices
|
||||
/// </summary>
|
||||
@ -20,4 +20,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
IAdaptionHintEntity GetEntry();
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,8 @@ using System.Linq;
|
||||
using Artemis.Storage.Entities.Profile.AdaptionHints;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a hint that adapts layers to a certain region of keyboards
|
||||
/// </summary>
|
||||
@ -89,4 +89,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
Extra
|
||||
}
|
||||
}
|
||||
@ -83,14 +83,10 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
||||
{
|
||||
List<SKColor> result = new();
|
||||
if (timesToRepeat == 0)
|
||||
{
|
||||
result = this.Select(c => c.Color).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i <= timesToRepeat; i++)
|
||||
result.AddRange(this.Select(c => c.Color));
|
||||
}
|
||||
|
||||
if (seamless && !IsSeamless())
|
||||
result.Add(result[0]);
|
||||
@ -413,8 +409,10 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (!Equals(this[i], other[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,41 +1,13 @@
|
||||
using System;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A color with a position, usually contained in a <see cref="ColorGradient" />
|
||||
/// </summary>
|
||||
public class ColorGradientStop : CorePropertyChanged
|
||||
{
|
||||
#region Equality members
|
||||
|
||||
/// <inheritdoc cref="object.Equals(object)" />
|
||||
protected bool Equals(ColorGradientStop other)
|
||||
{
|
||||
return _color.Equals(other._color) && _position.Equals(other._position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
return false;
|
||||
if (ReferenceEquals(this, obj))
|
||||
return true;
|
||||
if (obj.GetType() != GetType())
|
||||
return false;
|
||||
return Equals((ColorGradientStop) obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(_color, _position);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private SKColor _color;
|
||||
private float _position;
|
||||
|
||||
@ -65,5 +37,32 @@ namespace Artemis.Core
|
||||
get => _position;
|
||||
set => SetAndNotify(ref _position, value);
|
||||
}
|
||||
|
||||
#region Equality members
|
||||
|
||||
/// <inheritdoc cref="object.Equals(object)" />
|
||||
protected bool Equals(ColorGradientStop other)
|
||||
{
|
||||
return _color.Equals(other._color) && _position.Equals(other._position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
return false;
|
||||
if (ReferenceEquals(this, obj))
|
||||
return true;
|
||||
if (obj.GetType() != GetType())
|
||||
return false;
|
||||
return Equals((ColorGradientStop) obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(_color, _position);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using Artemis.Storage.Entities.Profile.Conditions;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a condition that is always true.
|
||||
/// </summary>
|
||||
@ -30,15 +30,11 @@ namespace Artemis.Core
|
||||
Entity = alwaysOnConditionEntity;
|
||||
}
|
||||
|
||||
#region Implementation of IDisposable
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IStorageModel
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -87,4 +83,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -14,15 +14,15 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
||||
{
|
||||
private readonly string _displayName;
|
||||
private readonly EventConditionEntity _entity;
|
||||
private IEventConditionNode _startNode;
|
||||
private DataModelPath? _eventPath;
|
||||
private NodeScript<bool> _script;
|
||||
private bool _wasMet;
|
||||
private DateTime _lastProcessedTrigger;
|
||||
private object? _lastProcessedValue;
|
||||
private EventOverlapMode _overlapMode;
|
||||
private EventTriggerMode _triggerMode;
|
||||
private NodeScript<bool> _script;
|
||||
private IEventConditionNode _startNode;
|
||||
private EventToggleOffMode _toggleOffMode;
|
||||
private EventTriggerMode _triggerMode;
|
||||
private bool _wasMet;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="EventCondition" /> class
|
||||
@ -87,7 +87,8 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mode for render elements when toggling off the event when using <see cref="EventTriggerMode.Toggle"/>.
|
||||
/// Gets or sets the mode for render elements when toggling off the event when using
|
||||
/// <see cref="EventTriggerMode.Toggle" />.
|
||||
/// </summary>
|
||||
public EventToggleOffMode ToggleOffMode
|
||||
{
|
||||
@ -119,7 +120,9 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
||||
_startNode = eventNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
eventNode = node;
|
||||
}
|
||||
|
||||
IDataModelEvent? dataModelEvent = EventPath?.GetValue() as IDataModelEvent;
|
||||
eventNode.CreatePins(dataModelEvent);
|
||||
@ -136,13 +139,25 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
||||
ReplaceStartNode(valueChangedNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
valueChangedNode = node;
|
||||
}
|
||||
|
||||
valueChangedNode.UpdateOutputPins(EventPath);
|
||||
}
|
||||
|
||||
Script.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the start node of the event script, if any
|
||||
/// </summary>
|
||||
/// <returns>The start node of the event script, if any.</returns>
|
||||
public INode GetStartNode()
|
||||
{
|
||||
return _startNode;
|
||||
}
|
||||
|
||||
private void ReplaceStartNode(IEventConditionNode newStartNode)
|
||||
{
|
||||
if (Script.Nodes.Contains(_startNode))
|
||||
@ -153,15 +168,6 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
||||
Script.AddNode(_startNode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the start node of the event script, if any
|
||||
/// </summary>
|
||||
/// <returns>The start node of the event script, if any.</returns>
|
||||
public INode GetStartNode()
|
||||
{
|
||||
return _startNode;
|
||||
}
|
||||
|
||||
private bool Evaluate()
|
||||
{
|
||||
if (EventPath == null)
|
||||
@ -356,7 +362,8 @@ public enum EventOverlapMode
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a mode for render elements when toggling off the event when using <see cref="EventTriggerMode.Toggle"/>.
|
||||
/// Represents a mode for render elements when toggling off the event when using <see cref="EventTriggerMode.Toggle" />
|
||||
/// .
|
||||
/// </summary>
|
||||
public enum EventToggleOffMode
|
||||
{
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using Artemis.Storage.Entities.Profile.Conditions;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a condition that plays once when its script evaluates to <see langword="true" />.
|
||||
/// </summary>
|
||||
@ -30,15 +30,11 @@ namespace Artemis.Core
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
#region Implementation of IDisposable
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IStorageModel
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -87,4 +83,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,8 @@ using System.Linq;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using Artemis.Storage.Entities.Profile.Conditions;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a condition that is based on a data model value
|
||||
/// </summary>
|
||||
@ -44,15 +44,6 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public NodeScript<bool> Script { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IConditionEntity Entity => _entity;
|
||||
|
||||
/// <inheritdoc />
|
||||
public RenderProfileElement ProfileElement { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMet { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mode in which the render element starts its timeline when display conditions are met
|
||||
/// </summary>
|
||||
@ -71,6 +62,15 @@ namespace Artemis.Core
|
||||
set => SetAndNotify(ref _stopMode, value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IConditionEntity Entity => _entity;
|
||||
|
||||
/// <inheritdoc />
|
||||
public RenderProfileElement ProfileElement { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMet { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Update()
|
||||
{
|
||||
@ -85,7 +85,9 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
if (!Script.ExitNodeConnected)
|
||||
{
|
||||
IsMet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Script.Run();
|
||||
@ -190,4 +192,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
SkipToEnd
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,8 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Entities.Profile.DataBindings;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class DataBinding<TLayerProperty> : IDataBinding
|
||||
{
|
||||
@ -40,9 +40,6 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public LayerProperty<TLayerProperty> LayerProperty { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public INodeScript Script => _script;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data binding entity this data binding uses for persistent storage
|
||||
/// </summary>
|
||||
@ -152,6 +149,9 @@ namespace Artemis.Core
|
||||
return LayerProperty.PropertyDescription.Name ?? LayerProperty.Path;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public INodeScript Script => _script;
|
||||
|
||||
/// <inheritdoc />
|
||||
public ILayerProperty BaseLayerProperty => LayerProperty;
|
||||
|
||||
@ -237,9 +237,10 @@ namespace Artemis.Core
|
||||
Entity.NodeScript = _script.Entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity.NodeScript = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class DataBindingProperty<TProperty> : IDataBindingProperty
|
||||
{
|
||||
@ -60,4 +60,3 @@ namespace Artemis.Core
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Modules;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data binding that binds a certain <see cref="LayerProperty{T}" /> to a value inside a
|
||||
/// <see cref="DataModel" />
|
||||
@ -60,4 +60,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public event EventHandler<DataBindingEventArgs>? DataBindingDisabled;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data binding registration
|
||||
/// </summary>
|
||||
@ -29,4 +29,3 @@ namespace Artemis.Core
|
||||
/// <param name="value">A value matching the type of <see cref="ValueType" /></param>
|
||||
void SetValue(object? value);
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Modules;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data model event with event arguments of type <typeparamref name="T" />
|
||||
/// </summary>
|
||||
@ -28,24 +28,12 @@ namespace Artemis.Core
|
||||
_trackHistory = trackHistory;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Last trigger", Description = "The time at which the event last triggered")]
|
||||
public DateTime LastTrigger { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Time since trigger", Description = "The time that has passed since the last trigger")]
|
||||
public TimeSpan TimeSinceLastTrigger => DateTime.Now - LastTrigger;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event arguments of the last time the event was triggered
|
||||
/// </summary>
|
||||
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
|
||||
public T? LastEventArguments { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Description = "The total amount of times this event has triggered since the module was activated")]
|
||||
public int TriggerCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a queue of the last 20 event arguments
|
||||
/// <para>Always empty if <see cref="TrackHistory" /> is <see langword="false" /></para>
|
||||
@ -67,14 +55,12 @@ namespace Artemis.Core
|
||||
TriggerCount++;
|
||||
|
||||
if (TrackHistory)
|
||||
{
|
||||
lock (EventArgumentsHistory)
|
||||
{
|
||||
if (EventArgumentsHistory.Count == 20)
|
||||
EventArgumentsHistory.Dequeue();
|
||||
EventArgumentsHistory.Enqueue(eventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
OnEventTriggered();
|
||||
}
|
||||
@ -84,6 +70,18 @@ namespace Artemis.Core
|
||||
EventTriggered?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Last trigger", Description = "The time at which the event last triggered")]
|
||||
public DateTime LastTrigger { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Time since trigger", Description = "The time that has passed since the last trigger")]
|
||||
public TimeSpan TimeSinceLastTrigger => DateTime.Now - LastTrigger;
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Description = "The total amount of times this event has triggered since the module was activated")]
|
||||
public int TriggerCount { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelIgnore]
|
||||
public Type ArgumentsType => typeof(T);
|
||||
@ -151,24 +149,12 @@ namespace Artemis.Core
|
||||
_trackHistory = trackHistory;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Last trigger", Description = "The time at which the event last triggered")]
|
||||
public DateTime LastTrigger { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Time since trigger", Description = "The time that has passed since the last trigger")]
|
||||
public TimeSpan TimeSinceLastTrigger => DateTime.Now - LastTrigger;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event arguments of the last time the event was triggered
|
||||
/// </summary>
|
||||
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
|
||||
public DataModelEventArgs? LastTriggerArguments { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Description = "The total amount of times this event has triggered since the module was activated")]
|
||||
public int TriggerCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a queue of the last 20 event arguments
|
||||
/// <para>Always empty if <see cref="TrackHistory" /> is <see langword="false" /></para>
|
||||
@ -188,14 +174,12 @@ namespace Artemis.Core
|
||||
TriggerCount++;
|
||||
|
||||
if (TrackHistory)
|
||||
{
|
||||
lock (EventArgumentsHistory)
|
||||
{
|
||||
if (EventArgumentsHistory.Count == 20)
|
||||
EventArgumentsHistory.Dequeue();
|
||||
EventArgumentsHistory.Enqueue(eventArgs);
|
||||
}
|
||||
}
|
||||
|
||||
OnEventTriggered();
|
||||
}
|
||||
@ -205,6 +189,18 @@ namespace Artemis.Core
|
||||
EventTriggered?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Last trigger", Description = "The time at which the event last triggered")]
|
||||
public DateTime LastTrigger { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Name = "Time since trigger", Description = "The time that has passed since the last trigger")]
|
||||
public TimeSpan TimeSinceLastTrigger => DateTime.Now - LastTrigger;
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelProperty(Description = "The total amount of times this event has triggered since the module was activated")]
|
||||
public int TriggerCount { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[DataModelIgnore]
|
||||
public Type ArgumentsType => typeof(DataModelEventArgs);
|
||||
@ -248,4 +244,3 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using Artemis.Core.Modules;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the base class for data model events that contain event data
|
||||
/// </summary>
|
||||
@ -14,4 +14,3 @@ namespace Artemis.Core
|
||||
[DataModelIgnore]
|
||||
public DateTime TriggerTime { get; internal set; }
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,8 @@ using System.Reflection;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a path that points to a property in data model
|
||||
/// </summary>
|
||||
@ -365,7 +365,8 @@ namespace Artemis.Core
|
||||
|
||||
#region Equality members
|
||||
|
||||
/// <inheritdoc cref="Equals(object)"/>>
|
||||
/// <inheritdoc cref="Equals(object)" />
|
||||
/// >
|
||||
protected bool Equals(DataModelPath other)
|
||||
{
|
||||
return ReferenceEquals(Target, other.Target) && Path == other.Path;
|
||||
@ -390,4 +391,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,8 @@ using System.Reflection;
|
||||
using Artemis.Core.Modules;
|
||||
using Humanizer;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a segment of a data model path
|
||||
/// </summary>
|
||||
@ -15,8 +15,8 @@ namespace Artemis.Core
|
||||
{
|
||||
private Expression<Func<object, object>>? _accessorLambda;
|
||||
private DataModel? _dynamicDataModel;
|
||||
private Type? _dynamicDataModelType;
|
||||
private DataModelPropertyAttribute? _dynamicDataModelAttribute;
|
||||
private Type? _dynamicDataModelType;
|
||||
private PropertyInfo? _property;
|
||||
|
||||
internal DataModelPathSegment(DataModelPath dataModelPath, string identifier, string path)
|
||||
@ -157,6 +157,30 @@ namespace Artemis.Core
|
||||
return type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// <see langword="true" /> to release both managed and unmanaged resources;
|
||||
/// <see langword="false" /> to release only unmanaged resources.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_dynamicDataModel != null)
|
||||
{
|
||||
_dynamicDataModel.DynamicChildAdded -= DynamicChildOnDynamicChildAdded;
|
||||
_dynamicDataModel.DynamicChildRemoved -= DynamicChildOnDynamicChildRemoved;
|
||||
}
|
||||
|
||||
Type = DataModelPathSegmentType.Invalid;
|
||||
|
||||
_accessorLambda = null;
|
||||
Accessor = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal Expression? Initialize(ParameterExpression parameter, Expression expression, Expression nullCondition)
|
||||
{
|
||||
if (IsStartSegment)
|
||||
@ -210,21 +234,17 @@ namespace Artemis.Core
|
||||
accessorExpression = expression;
|
||||
// A static segment just needs to access the property or filed
|
||||
else if (Type == DataModelPathSegmentType.Static)
|
||||
{
|
||||
accessorExpression = _property != null
|
||||
? Expression.Property(expression, _property)
|
||||
: Expression.PropertyOrField(expression, Identifier);
|
||||
}
|
||||
// A dynamic segment calls the generic method DataModel.DynamicChild<T> and provides the identifier as an argument
|
||||
else
|
||||
{
|
||||
accessorExpression = Expression.Call(
|
||||
expression,
|
||||
nameof(DataModel.GetDynamicChildValue),
|
||||
_dynamicDataModelType != null ? new[] {_dynamicDataModelType} : null,
|
||||
Expression.Constant(Identifier)
|
||||
);
|
||||
}
|
||||
|
||||
_accessorLambda = Expression.Lambda<Func<object, object>>(
|
||||
// Wrap with a null check
|
||||
@ -255,43 +275,6 @@ namespace Artemis.Core
|
||||
Type = _property == null ? DataModelPathSegmentType.Invalid : DataModelPathSegmentType.Static;
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Releases the unmanaged resources used by the object and optionally releases the managed resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// <see langword="true" /> to release both managed and unmanaged resources;
|
||||
/// <see langword="false" /> to release only unmanaged resources.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_dynamicDataModel != null)
|
||||
{
|
||||
_dynamicDataModel.DynamicChildAdded -= DynamicChildOnDynamicChildAdded;
|
||||
_dynamicDataModel.DynamicChildRemoved -= DynamicChildOnDynamicChildRemoved;
|
||||
}
|
||||
|
||||
Type = DataModelPathSegmentType.Invalid;
|
||||
|
||||
_accessorLambda = null;
|
||||
Accessor = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void DynamicChildOnDynamicChildAdded(object? sender, DynamicDataModelChildEventArgs e)
|
||||
{
|
||||
if (e.Key == Identifier)
|
||||
@ -307,6 +290,10 @@ namespace Artemis.Core
|
||||
DataModelPath.Invalidate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a type of data model path
|
||||
/// </summary>
|
||||
@ -20,4 +20,3 @@
|
||||
/// </summary>
|
||||
Dynamic
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an event that is part of a data model
|
||||
/// </summary>
|
||||
@ -66,4 +66,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
void Update();
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Artemis.Core.LayerEffects;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a folder in a <see cref="Profile" />
|
||||
/// </summary>
|
||||
@ -264,7 +263,8 @@ namespace Artemis.Core
|
||||
{
|
||||
DisplayCondition.OverrideTimeline(position);
|
||||
foreach (BaseLayerEffect baseLayerEffect in LayerEffects.Where(e => !e.Suspended))
|
||||
baseLayerEffect.InternalUpdate(Timeline); ;
|
||||
baseLayerEffect.InternalUpdate(Timeline);
|
||||
;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -272,6 +272,16 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public event EventHandler? RenderPropertiesUpdated;
|
||||
|
||||
#region Overrides of BreakableModel
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<IBreakableModel> GetBrokenHierarchy()
|
||||
{
|
||||
return LayerEffects.Where(e => e.BrokenState != null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
@ -346,15 +356,4 @@ namespace Artemis.Core
|
||||
{
|
||||
RenderPropertiesUpdated?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#region Overrides of BreakableModel
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<IBreakableModel> GetBrokenHierarchy()
|
||||
{
|
||||
return LayerEffects.Where(e => e.BrokenState != null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -9,8 +9,8 @@ using Artemis.Storage.Entities.Profile.Abstract;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layer in a <see cref="Profile" />
|
||||
/// </summary>
|
||||
@ -180,8 +180,10 @@ namespace Artemis.Core
|
||||
if (LayerBrush?.BaseProperties != null)
|
||||
result.AddRange(LayerBrush.BaseProperties.GetAllLayerProperties());
|
||||
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
||||
{
|
||||
if (layerEffect.BaseProperties != null)
|
||||
result.AddRange(layerEffect.BaseProperties.GetAllLayerProperties());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -802,7 +804,7 @@ namespace Artemis.Core
|
||||
{
|
||||
BaseLayerBrush? oldLayerBrush = LayerBrush;
|
||||
|
||||
General.BrushReference.SetCurrentValue(layerBrush != null ? new LayerBrushReference(layerBrush.Descriptor) : null, null);
|
||||
General.BrushReference.SetCurrentValue(layerBrush != null ? new LayerBrushReference(layerBrush.Descriptor) : null);
|
||||
LayerBrush = layerBrush;
|
||||
|
||||
oldLayerBrush?.InternalDisable();
|
||||
@ -892,4 +894,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
Clip
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,8 @@ using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Entities.Profile.AdaptionHints;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an adapter that adapts a layer to a certain set of devices using <see cref="IAdaptionHint" />s
|
||||
/// </summary>
|
||||
@ -116,11 +116,6 @@ namespace Artemis.Core
|
||||
return newHints;
|
||||
}
|
||||
|
||||
private bool DoesLayerCoverDevice(ArtemisDevice device)
|
||||
{
|
||||
return device.Leds.All(l => Layer.Leds.Contains(l));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an adaption hint to the adapter.
|
||||
/// </summary>
|
||||
@ -153,6 +148,21 @@ namespace Artemis.Core
|
||||
Remove(_adaptionHints.First());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a new adapter hint is added to the adapter.
|
||||
/// </summary>
|
||||
public event EventHandler<LayerAdapterHintEventArgs>? AdapterHintAdded;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever an adapter hint is removed from the adapter.
|
||||
/// </summary>
|
||||
public event EventHandler<LayerAdapterHintEventArgs>? AdapterHintRemoved;
|
||||
|
||||
private bool DoesLayerCoverDevice(ArtemisDevice device)
|
||||
{
|
||||
return device.Leds.All(l => Layer.Leds.Contains(l));
|
||||
}
|
||||
|
||||
#region Implementation of IStorageModel
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -162,6 +172,7 @@ namespace Artemis.Core
|
||||
// Kind of meh.
|
||||
// This leaves the adapter responsible for finding the right hint for the right entity, but it's gotta be done somewhere..
|
||||
foreach (IAdaptionHintEntity hintEntity in Layer.LayerEntity.AdaptionHints)
|
||||
{
|
||||
switch (hintEntity)
|
||||
{
|
||||
case DeviceAdaptionHintEntity entity:
|
||||
@ -175,6 +186,7 @@ namespace Artemis.Core
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Save()
|
||||
@ -185,15 +197,4 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a new adapter hint is added to the adapter.
|
||||
/// </summary>
|
||||
public event EventHandler<LayerAdapterHintEventArgs>? AdapterHintAdded;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever an adapter hint is removed from the adapter.
|
||||
/// </summary>
|
||||
public event EventHandler<LayerAdapterHintEventArgs>? AdapterHintRemoved;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using Artemis.Core.LayerBrushes;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// A reference to a <see cref="LayerBrushDescriptor" />
|
||||
/// </summary>
|
||||
@ -34,4 +34,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public string? BrushType { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a property group on a layer
|
||||
/// <para>
|
||||
@ -22,4 +22,3 @@
|
||||
IsEnabled.SetCurrentValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
#pragma warning disable 8618
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the general properties of a layer
|
||||
/// </summary>
|
||||
@ -50,4 +50,3 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an attribute that marks a layer property to be ignored
|
||||
/// </summary>
|
||||
public class LayerPropertyIgnoreAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a description attribute used to decorate layer properties
|
||||
/// </summary>
|
||||
@ -52,4 +52,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public bool DisableKeyframes { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a description attribute used to decorate layer property groups
|
||||
/// </summary>
|
||||
public class PropertyGroupDescriptionAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The identifier of this property group used for storage, if not set one will be generated based on the group name in code
|
||||
/// The identifier of this property group used for storage, if not set one will be generated based on the group name in
|
||||
/// code
|
||||
/// </summary>
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
@ -22,4 +23,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a range between two single-precision floating point numbers
|
||||
/// </summary>
|
||||
@ -60,4 +60,3 @@ namespace Artemis.Core
|
||||
return _rand.Next((int) (Start * 100) + 1, (int) (End * 100)) / 100f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a property on a layer. Properties are saved in storage and can optionally be modified from the UI.
|
||||
/// <para>
|
||||
@ -150,4 +150,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeRemoved;
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a keyframe on a <see cref="ILayerProperty" /> containing a value and a timestamp
|
||||
/// </summary>
|
||||
@ -41,4 +41,3 @@ namespace Artemis.Core
|
||||
/// <returns>The resulting copy</returns>
|
||||
ILayerPropertyKeyframe CreateCopy();
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a range between two signed integers
|
||||
/// </summary>
|
||||
@ -60,4 +60,3 @@ namespace Artemis.Core
|
||||
return _rand.Next(Start + 1, End);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,8 @@ using System.Linq;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a property on a layer. Properties are saved in storage and can optionally be modified from the UI.
|
||||
/// <para>
|
||||
@ -69,6 +69,57 @@ namespace Artemis.Core
|
||||
Disposed?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="Updated" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnUpdated()
|
||||
{
|
||||
Updated?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="CurrentValueSet" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnCurrentValueSet()
|
||||
{
|
||||
CurrentValueSet?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
LayerPropertyGroup.OnLayerPropertyOnCurrentValueSet(new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="VisibilityChanged" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnVisibilityChanged()
|
||||
{
|
||||
VisibilityChanged?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyframesToggled" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnKeyframesToggled()
|
||||
{
|
||||
KeyframesToggled?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyframeAdded" /> event
|
||||
/// </summary>
|
||||
/// <param name="keyframe"></param>
|
||||
protected virtual void OnKeyframeAdded(ILayerPropertyKeyframe keyframe)
|
||||
{
|
||||
KeyframeAdded?.Invoke(this, new LayerPropertyKeyframeEventArgs(keyframe));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyframeRemoved" /> event
|
||||
/// </summary>
|
||||
/// <param name="keyframe"></param>
|
||||
protected virtual void OnKeyframeRemoved(ILayerPropertyKeyframe keyframe)
|
||||
{
|
||||
KeyframeRemoved?.Invoke(this, new LayerPropertyKeyframeEventArgs(keyframe));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public PropertyDescriptionAttribute PropertyDescription { get; internal set; }
|
||||
|
||||
@ -126,6 +177,27 @@ namespace Artemis.Core
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler? Disposed;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? Updated;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? CurrentValueSet;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? VisibilityChanged;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? KeyframesToggled;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeAdded;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeRemoved;
|
||||
|
||||
#region Hierarchy
|
||||
|
||||
private bool _isHidden;
|
||||
@ -208,7 +280,9 @@ namespace Artemis.Core
|
||||
|
||||
LayerPropertyKeyframe<T>? keyframe = null;
|
||||
if (time == null || !KeyframesEnabled || !KeyframesSupported)
|
||||
{
|
||||
BaseValue = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If on a keyframe, update the keyframe
|
||||
@ -220,8 +294,10 @@ namespace Artemis.Core
|
||||
AddKeyframe(keyframe);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyframe.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Force an update so that the base value is applied to the current value and
|
||||
// keyframes/data bindings are applied using the new base value
|
||||
@ -242,7 +318,9 @@ namespace Artemis.Core
|
||||
|
||||
// For value types there's no need to make a copy
|
||||
if (DefaultValue.GetType().IsValueType)
|
||||
{
|
||||
SetCurrentValue(DefaultValue);
|
||||
}
|
||||
// Reference types make a deep clone (ab)using JSON
|
||||
else
|
||||
{
|
||||
@ -603,81 +681,4 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler? Disposed;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? Updated;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? CurrentValueSet;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? VisibilityChanged;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyEventArgs>? KeyframesToggled;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeAdded;
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler<LayerPropertyKeyframeEventArgs>? KeyframeRemoved;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="Updated" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnUpdated()
|
||||
{
|
||||
Updated?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="CurrentValueSet" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnCurrentValueSet()
|
||||
{
|
||||
CurrentValueSet?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
LayerPropertyGroup.OnLayerPropertyOnCurrentValueSet(new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="VisibilityChanged" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnVisibilityChanged()
|
||||
{
|
||||
VisibilityChanged?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyframesToggled" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnKeyframesToggled()
|
||||
{
|
||||
KeyframesToggled?.Invoke(this, new LayerPropertyEventArgs(this));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyframeAdded" /> event
|
||||
/// </summary>
|
||||
/// <param name="keyframe"></param>
|
||||
protected virtual void OnKeyframeAdded(ILayerPropertyKeyframe keyframe)
|
||||
{
|
||||
KeyframeAdded?.Invoke(this, new LayerPropertyKeyframeEventArgs(keyframe));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyframeRemoved" /> event
|
||||
/// </summary>
|
||||
/// <param name="keyframe"></param>
|
||||
protected virtual void OnKeyframeRemoved(ILayerPropertyKeyframe keyframe)
|
||||
{
|
||||
KeyframeRemoved?.Invoke(this, new LayerPropertyKeyframeEventArgs(keyframe));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a keyframe on a <see cref="LayerProperty{T}" /> containing a value and a timestamp
|
||||
/// </summary>
|
||||
@ -87,4 +87,3 @@ namespace Artemis.Core
|
||||
return new LayerPropertyKeyframe<T>(Value, Position, EasingFunction, LayerProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,8 @@ public sealed class LayerPropertyPreview<T> : IDisposable
|
||||
}
|
||||
|
||||
Property.SetCurrentValue(OriginalValue, Time);
|
||||
return !Equals(OriginalValue, PreviewValue); ;
|
||||
return !Equals(OriginalValue, PreviewValue);
|
||||
;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -3,13 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Core.LayerEffects;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Humanizer;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a property group on a layer
|
||||
/// <para>
|
||||
@ -335,7 +333,7 @@ namespace Artemis.Core
|
||||
if (PropertyGroupEntity == null)
|
||||
throw new ArtemisCoreException($"Can't execute {nameof(GetPropertyGroupEntity)} without {nameof(PropertyGroupEntity)} being setup");
|
||||
|
||||
return PropertyGroupEntity.PropertyGroups.FirstOrDefault(g => g.Identifier == identifier) ?? new PropertyGroupEntity() {Identifier = identifier};
|
||||
return PropertyGroupEntity.PropertyGroups.FirstOrDefault(g => g.Identifier == identifier) ?? new PropertyGroupEntity {Identifier = identifier};
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -345,4 +343,3 @@ namespace Artemis.Core
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an ellipse layer shape
|
||||
/// </summary>
|
||||
@ -19,4 +19,3 @@ namespace Artemis.Core
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the shape of a layer
|
||||
/// </summary>
|
||||
@ -27,4 +27,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public abstract void CalculateRenderProperties();
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a rectangular layer shape
|
||||
/// </summary>
|
||||
@ -19,4 +19,3 @@ namespace Artemis.Core
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
#pragma warning disable 8618
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the transform properties of a layer
|
||||
/// </summary>
|
||||
@ -58,4 +58,3 @@ namespace Artemis.Core
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,18 +6,18 @@ using Artemis.Core.ScriptingProviders;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a profile containing folders and layers
|
||||
/// </summary>
|
||||
public sealed class Profile : ProfileElement
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
private readonly ObservableCollection<ScriptConfiguration> _scriptConfigurations;
|
||||
private readonly ObservableCollection<ProfileScript> _scripts;
|
||||
private bool _isFreshImport;
|
||||
private ProfileElement? _lastSelectedProfileElement;
|
||||
private readonly ObservableCollection<ProfileScript> _scripts;
|
||||
private readonly ObservableCollection<ScriptConfiguration> _scriptConfigurations;
|
||||
|
||||
internal Profile(ProfileConfiguration configuration, ProfileEntity profileEntity) : base(null!)
|
||||
{
|
||||
@ -165,6 +165,16 @@ namespace Artemis.Core
|
||||
layer.PopulateLeds(devices);
|
||||
}
|
||||
|
||||
#region Overrides of BreakableModel
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<IBreakableModel> GetBrokenHierarchy()
|
||||
{
|
||||
return GetAllRenderElements().SelectMany(folders => folders.GetBrokenHierarchy());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
@ -263,7 +273,6 @@ namespace Artemis.Core
|
||||
{
|
||||
_scripts.Remove(script);
|
||||
script.Dispose();
|
||||
|
||||
}
|
||||
|
||||
internal override void Save()
|
||||
@ -292,15 +301,4 @@ namespace Artemis.Core
|
||||
ProfileEntity.ScriptConfigurations.Add(scriptConfiguration.Entity);
|
||||
}
|
||||
}
|
||||
|
||||
#region Overrides of BreakableModel
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<IBreakableModel> GetBrokenHierarchy()
|
||||
{
|
||||
return GetAllRenderElements().SelectMany(folders => folders.GetBrokenHierarchy());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a category containing <see cref="ProfileConfigurations" />
|
||||
/// </summary>
|
||||
@ -103,7 +103,10 @@ namespace Artemis.Core
|
||||
_profileConfigurations.Insert(targetIndex.Value, configuration);
|
||||
}
|
||||
else
|
||||
{
|
||||
_profileConfigurations.Add(configuration);
|
||||
}
|
||||
|
||||
configuration.Category = this;
|
||||
|
||||
for (int index = 0; index < _profileConfigurations.Count; index++)
|
||||
@ -117,6 +120,32 @@ namespace Artemis.Core
|
||||
return $"[ProfileCategory] {Order} {nameof(Name)}: {Name}, {nameof(IsSuspended)}: {IsSuspended}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a profile configuration is added to this <see cref="ProfileCategory" />
|
||||
/// </summary>
|
||||
public event EventHandler<ProfileConfigurationEventArgs>? ProfileConfigurationAdded;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a profile configuration is removed from this <see cref="ProfileCategory" />
|
||||
/// </summary>
|
||||
public event EventHandler<ProfileConfigurationEventArgs>? ProfileConfigurationRemoved;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="ProfileConfigurationAdded" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnProfileConfigurationAdded(ProfileConfigurationEventArgs e)
|
||||
{
|
||||
ProfileConfigurationAdded?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="ProfileConfigurationRemoved" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnProfileConfigurationRemoved(ProfileConfigurationEventArgs e)
|
||||
{
|
||||
ProfileConfigurationRemoved?.Invoke(this, e);
|
||||
}
|
||||
|
||||
internal void RemoveProfileConfiguration(ProfileConfiguration configuration)
|
||||
{
|
||||
if (!_profileConfigurations.Remove(configuration))
|
||||
@ -159,36 +188,6 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a profile configuration is added to this <see cref="ProfileCategory" />
|
||||
/// </summary>
|
||||
public event EventHandler<ProfileConfigurationEventArgs>? ProfileConfigurationAdded;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a profile configuration is removed from this <see cref="ProfileCategory" />
|
||||
/// </summary>
|
||||
public event EventHandler<ProfileConfigurationEventArgs>? ProfileConfigurationRemoved;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="ProfileConfigurationAdded" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnProfileConfigurationAdded(ProfileConfigurationEventArgs e)
|
||||
{
|
||||
ProfileConfigurationAdded?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="ProfileConfigurationRemoved" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnProfileConfigurationRemoved(ProfileConfigurationEventArgs e)
|
||||
{
|
||||
ProfileConfigurationRemoved?.Invoke(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -211,4 +210,3 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
General
|
||||
}
|
||||
}
|
||||
@ -2,11 +2,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an element of a <see cref="Profile" />
|
||||
/// </summary>
|
||||
@ -379,4 +378,3 @@ namespace Artemis.Core
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
namespace Artemis.Core
|
||||
{
|
||||
namespace Artemis.Core;
|
||||
|
||||
/// <summary>
|
||||
/// An enum defining the right side type of a profile entity
|
||||
/// </summary>
|
||||
@ -15,4 +15,3 @@
|
||||
/// </summary>
|
||||
Dynamic
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user