mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-02-04 02:43:32 +00:00
Merge branch 'development'
This commit is contained in:
commit
fb100eb9ad
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<PreserveCompilationContext>false</PreserveCompilationContext>
|
<PreserveCompilationContext>false</PreserveCompilationContext>
|
||||||
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
|
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
|
||||||
<AssemblyTitle>Artemis.Core</AssemblyTitle>
|
<AssemblyTitle>Artemis.Core</AssemblyTitle>
|
||||||
@ -10,7 +10,6 @@
|
|||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageId>ArtemisRGB.Core</PackageId>
|
<PackageId>ArtemisRGB.Core</PackageId>
|
||||||
<PluginApiVersion>1</PluginApiVersion>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@ -151,19 +151,19 @@ public static class ColorQuantizer
|
|||||||
{
|
{
|
||||||
SKColor[] colors = QuantizeSplit(bitmap.Pixels, 8);
|
SKColor[] colors = QuantizeSplit(bitmap.Pixels, 8);
|
||||||
ColorSwatch swatch = FindAllColorVariations(colors);
|
ColorSwatch swatch = FindAllColorVariations(colors);
|
||||||
SKColor[] swatchArray = new SKColor[]
|
SKColor[] swatchArray =
|
||||||
{
|
[
|
||||||
swatch.Muted,
|
swatch.Muted,
|
||||||
swatch.Vibrant,
|
swatch.Vibrant,
|
||||||
swatch.DarkMuted,
|
swatch.DarkMuted,
|
||||||
swatch.DarkVibrant,
|
swatch.DarkVibrant,
|
||||||
swatch.LightMuted,
|
swatch.LightMuted,
|
||||||
swatch.LightVibrant
|
swatch.LightVibrant
|
||||||
};
|
];
|
||||||
|
|
||||||
ColorSorter.Sort(swatchArray, SKColors.Black);
|
ColorSorter.Sort(swatchArray, SKColors.Black);
|
||||||
|
|
||||||
ColorGradient gradient = new();
|
ColorGradient gradient = [];
|
||||||
|
|
||||||
for (int i = 0; i < swatchArray.Length; i++)
|
for (int i = 0; i < swatchArray.Length; i++)
|
||||||
gradient.Add(new ColorGradientStop(swatchArray[i], (float)i / (swatchArray.Length - 1)));
|
gradient.Add(new ColorGradientStop(swatchArray[i], (float)i / (swatchArray.Length - 1)));
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Text;
|
using SkiaSharp;
|
||||||
using SkiaSharp;
|
|
||||||
|
|
||||||
namespace Artemis.Core.ColorScience;
|
namespace Artemis.Core.ColorScience;
|
||||||
|
|
||||||
|
|||||||
@ -70,13 +70,7 @@ public static class Constants
|
|||||||
/// The full path to the Artemis user layouts folder
|
/// The full path to the Artemis user layouts folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string WorkshopFolder = Path.Combine(DataFolder, "workshop");
|
public static readonly string WorkshopFolder = Path.Combine(DataFolder, "workshop");
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The current API version for plugins
|
|
||||||
/// </summary>
|
|
||||||
public static readonly int PluginApiVersion = int.Parse(CoreAssembly.GetCustomAttributes<AssemblyMetadataAttribute>().FirstOrDefault(a => a.Key == "PluginApiVersion")?.Value ??
|
|
||||||
throw new InvalidOperationException("Cannot find PluginApiVersion metadata in assembly"));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the application
|
/// The current version of the application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ public class ColorGradientLayerProperty : LayerProperty<ColorGradient>
|
|||||||
internal ColorGradientLayerProperty()
|
internal ColorGradientLayerProperty()
|
||||||
{
|
{
|
||||||
KeyframesSupported = false;
|
KeyframesSupported = false;
|
||||||
DefaultValue = new ColorGradient();
|
DefaultValue = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public static class ContainerExtensions
|
|||||||
|
|
||||||
// Bind plugin service interfaces, DryIoc expects at least one match when calling RegisterMany so ensure there is something to register first
|
// Bind plugin service interfaces, DryIoc expects at least one match when calling RegisterMany so ensure there is something to register first
|
||||||
if (plugin.Assembly != null && plugin.Assembly.GetTypes().Any(t => t.IsAssignableTo<IPluginService>()))
|
if (plugin.Assembly != null && plugin.Assembly.GetTypes().Any(t => t.IsAssignableTo<IPluginService>()))
|
||||||
container.RegisterMany(new[] {plugin.Assembly}, type => type.IsAssignableTo<IPluginService>(), Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Keep);
|
container.RegisterMany([plugin.Assembly], type => type.IsAssignableTo<IPluginService>(), Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Keep);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool HasAccessToProtectedService(Request request)
|
private static bool HasAccessToProtectedService(Request request)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace Artemis.Core.DryIoc.Factories;
|
|||||||
|
|
||||||
internal class PluginSettingsFactory : IPluginSettingsFactory
|
internal class PluginSettingsFactory : IPluginSettingsFactory
|
||||||
{
|
{
|
||||||
private static readonly List<PluginSettings> PluginSettings = new();
|
private static readonly List<PluginSettings> PluginSettings = [];
|
||||||
private readonly IPluginManagementService _pluginManagementService;
|
private readonly IPluginManagementService _pluginManagementService;
|
||||||
private readonly IPluginRepository _pluginRepository;
|
private readonly IPluginRepository _pluginRepository;
|
||||||
|
|
||||||
|
|||||||
@ -14,15 +14,15 @@ public static class TypeExtensions
|
|||||||
{
|
{
|
||||||
private static readonly Dictionary<Type, List<Type>> PrimitiveTypeConversions = new()
|
private static readonly Dictionary<Type, List<Type>> PrimitiveTypeConversions = new()
|
||||||
{
|
{
|
||||||
{typeof(decimal), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)}},
|
{typeof(decimal), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)]},
|
||||||
{typeof(double), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
|
{typeof(double), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)]},
|
||||||
{typeof(float), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
|
{typeof(float), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)]},
|
||||||
{typeof(ulong), new List<Type> {typeof(byte), typeof(ushort), typeof(uint), typeof(char)}},
|
{typeof(ulong), [typeof(byte), typeof(ushort), typeof(uint), typeof(char)]},
|
||||||
{typeof(long), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(char)}},
|
{typeof(long), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(char)]},
|
||||||
{typeof(uint), new List<Type> {typeof(byte), typeof(ushort), typeof(char)}},
|
{typeof(uint), [typeof(byte), typeof(ushort), typeof(char)]},
|
||||||
{typeof(int), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(char)}},
|
{typeof(int), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(char)]},
|
||||||
{typeof(ushort), new List<Type> {typeof(byte), typeof(char)}},
|
{typeof(ushort), [typeof(byte), typeof(char)]},
|
||||||
{typeof(short), new List<Type> {typeof(byte)}}
|
{typeof(short), [typeof(byte)]}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<Type, string> TypeKeywords = new()
|
private static readonly Dictionary<Type, string> TypeKeywords = new()
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace Artemis.Core;
|
|||||||
public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionChanged
|
public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionChanged
|
||||||
{
|
{
|
||||||
private static readonly SKColor[] FAST_LED_RAINBOW =
|
private static readonly SKColor[] FAST_LED_RAINBOW =
|
||||||
{
|
[
|
||||||
new(0xFFFF0000), // Red
|
new(0xFFFF0000), // Red
|
||||||
new(0xFFFF9900), // Orange
|
new(0xFFFF9900), // Orange
|
||||||
new(0xFFFFFF00), // Yellow
|
new(0xFFFFFF00), // Yellow
|
||||||
@ -24,11 +24,11 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
new(0xFF9E22FF), // Purple
|
new(0xFF9E22FF), // Purple
|
||||||
new(0xFFFF34AE), // Pink
|
new(0xFFFF34AE), // Pink
|
||||||
new(0xFFFF0000) // and back to Red
|
new(0xFFFF0000) // and back to Red
|
||||||
};
|
];
|
||||||
|
|
||||||
private readonly List<ColorGradientStop> _stops;
|
private readonly List<ColorGradientStop> _stops;
|
||||||
private SKColor[] _colors = Array.Empty<SKColor>();
|
private SKColor[] _colors = [];
|
||||||
private float[] _positions = Array.Empty<float>();
|
private float[] _positions = [];
|
||||||
private bool _dirty = true;
|
private bool _dirty = true;
|
||||||
private bool _updating;
|
private bool _updating;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ColorGradient()
|
public ColorGradient()
|
||||||
{
|
{
|
||||||
_stops = new List<ColorGradientStop>();
|
_stops = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -60,7 +60,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
/// <param name="colorGradient">The color gradient to copy</param>
|
/// <param name="colorGradient">The color gradient to copy</param>
|
||||||
public ColorGradient(ColorGradient? colorGradient)
|
public ColorGradient(ColorGradient? colorGradient)
|
||||||
{
|
{
|
||||||
_stops = new List<ColorGradientStop>();
|
_stops = [];
|
||||||
if (colorGradient == null)
|
if (colorGradient == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
/// <param name="stops">The stops to copy</param>
|
/// <param name="stops">The stops to copy</param>
|
||||||
public ColorGradient(List<ColorGradientStop> stops)
|
public ColorGradient(List<ColorGradientStop> stops)
|
||||||
{
|
{
|
||||||
_stops = new List<ColorGradientStop>();
|
_stops = [];
|
||||||
foreach (ColorGradientStop colorGradientStop in stops)
|
foreach (ColorGradientStop colorGradientStop in stops)
|
||||||
{
|
{
|
||||||
ColorGradientStop stop = new(colorGradientStop.Color, colorGradientStop.Position);
|
ColorGradientStop stop = new(colorGradientStop.Color, colorGradientStop.Position);
|
||||||
@ -104,7 +104,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
if (timesToRepeat == 0 && !seamless)
|
if (timesToRepeat == 0 && !seamless)
|
||||||
return Colors;
|
return Colors;
|
||||||
|
|
||||||
List<SKColor> result = new();
|
List<SKColor> result = [];
|
||||||
if (timesToRepeat == 0)
|
if (timesToRepeat == 0)
|
||||||
result = this.Select(c => c.Color).ToList();
|
result = this.Select(c => c.Color).ToList();
|
||||||
else
|
else
|
||||||
@ -132,7 +132,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
if (timesToRepeat == 0 && seamless)
|
if (timesToRepeat == 0 && seamless)
|
||||||
return Positions;
|
return Positions;
|
||||||
|
|
||||||
List<float> result = new();
|
List<float> result = [];
|
||||||
if (timesToRepeat == 0)
|
if (timesToRepeat == 0)
|
||||||
{
|
{
|
||||||
result = this.Select(c => c.Position).ToList();
|
result = this.Select(c => c.Position).ToList();
|
||||||
@ -456,7 +456,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static ColorGradient GetUnicornBarf()
|
public static ColorGradient GetUnicornBarf()
|
||||||
{
|
{
|
||||||
ColorGradient gradient = new();
|
ColorGradient gradient = [];
|
||||||
for (int index = 0; index < FAST_LED_RAINBOW.Length; index++)
|
for (int index = 0; index < FAST_LED_RAINBOW.Length; index++)
|
||||||
{
|
{
|
||||||
SKColor skColor = FAST_LED_RAINBOW[index];
|
SKColor skColor = FAST_LED_RAINBOW[index];
|
||||||
@ -473,7 +473,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
|||||||
/// <param name="stops">The amount of stops to add</param>
|
/// <param name="stops">The amount of stops to add</param>
|
||||||
public static ColorGradient GetRandom(int stops)
|
public static ColorGradient GetRandom(int stops)
|
||||||
{
|
{
|
||||||
ColorGradient gradient = new();
|
ColorGradient gradient = [];
|
||||||
gradient.Randomize(stops);
|
gradient.Randomize(stops);
|
||||||
return gradient;
|
return gradient;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
|||||||
_entity = new EventConditionEntity();
|
_entity = new EventConditionEntity();
|
||||||
_displayName = profileElement.GetType().Name;
|
_displayName = profileElement.GetType().Name;
|
||||||
_startNode = new EventConditionEventStartNode {X = -300};
|
_startNode = new EventConditionEventStartNode {X = -300};
|
||||||
_script = new NodeScript<bool>($"Activate {_displayName}", $"Whether or not the event should activate the {_displayName}", ProfileElement.Profile, new List<DefaultNode> {_startNode});
|
_script = new NodeScript<bool>($"Activate {_displayName}", $"Whether or not the event should activate the {_displayName}", ProfileElement.Profile, [_startNode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal EventCondition(EventConditionEntity entity, RenderProfileElement profileElement)
|
internal EventCondition(EventConditionEntity entity, RenderProfileElement profileElement)
|
||||||
@ -288,8 +288,8 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
|
|||||||
string name = $"Activate {_displayName}";
|
string name = $"Activate {_displayName}";
|
||||||
string description = $"Whether or not the event should activate the {_displayName}";
|
string description = $"Whether or not the event should activate the {_displayName}";
|
||||||
Script = _entity.Script != null
|
Script = _entity.Script != null
|
||||||
? new NodeScript<bool>(name, description, _entity.Script, ProfileElement.Profile, new List<DefaultNode> {_startNode})
|
? new NodeScript<bool>(name, description, _entity.Script, ProfileElement.Profile, [_startNode])
|
||||||
: new NodeScript<bool>(name, description, ProfileElement.Profile, new List<DefaultNode> {_startNode});
|
: new NodeScript<bool>(name, description, ProfileElement.Profile, [_startNode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace Artemis.Core;
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class DataBinding<TLayerProperty> : IDataBinding
|
public class DataBinding<TLayerProperty> : IDataBinding
|
||||||
{
|
{
|
||||||
private readonly List<IDataBindingProperty> _properties = new();
|
private readonly List<IDataBindingProperty> _properties = [];
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
private bool _isEnabled;
|
private bool _isEnabled;
|
||||||
private DataBindingNodeScript<TLayerProperty> _script;
|
private DataBindingNodeScript<TLayerProperty> _script;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
|
|||||||
Path = "";
|
Path = "";
|
||||||
Entity = new DataModelPathEntity();
|
Entity = new DataModelPathEntity();
|
||||||
|
|
||||||
_segments = new LinkedList<DataModelPathSegment>();
|
_segments = [];
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
Initialize();
|
Initialize();
|
||||||
@ -45,7 +45,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
|
|||||||
Path = path ?? throw new ArgumentNullException(nameof(path));
|
Path = path ?? throw new ArgumentNullException(nameof(path));
|
||||||
Entity = new DataModelPathEntity();
|
Entity = new DataModelPathEntity();
|
||||||
|
|
||||||
_segments = new LinkedList<DataModelPathSegment>();
|
_segments = [];
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
Initialize();
|
Initialize();
|
||||||
@ -65,7 +65,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
|
|||||||
Path = dataModelPath.Path;
|
Path = dataModelPath.Path;
|
||||||
Entity = new DataModelPathEntity();
|
Entity = new DataModelPathEntity();
|
||||||
|
|
||||||
_segments = new LinkedList<DataModelPathSegment>();
|
_segments = [];
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
Initialize();
|
Initialize();
|
||||||
@ -81,7 +81,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
|
|||||||
Path = entity.Path;
|
Path = entity.Path;
|
||||||
Entity = entity;
|
Entity = entity;
|
||||||
|
|
||||||
_segments = new LinkedList<DataModelPathSegment>();
|
_segments = [];
|
||||||
|
|
||||||
Load();
|
Load();
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|||||||
@ -242,7 +242,7 @@ public class DataModelPathSegment : IDisposable
|
|||||||
accessorExpression = Expression.Call(
|
accessorExpression = Expression.Call(
|
||||||
expression,
|
expression,
|
||||||
nameof(DataModel.GetDynamicChildValue),
|
nameof(DataModel.GetDynamicChildValue),
|
||||||
_dynamicDataModelType != null ? new[] {_dynamicDataModelType} : null,
|
_dynamicDataModelType != null ? [_dynamicDataModelType] : null,
|
||||||
Expression.Constant(Identifier)
|
Expression.Constant(Identifier)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public sealed class Folder : RenderProfileElement
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override List<ILayerProperty> GetAllLayerProperties()
|
public override List<ILayerProperty> GetAllLayerProperties()
|
||||||
{
|
{
|
||||||
List<ILayerProperty> result = new();
|
List<ILayerProperty> result = [];
|
||||||
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
||||||
{
|
{
|
||||||
if (layerEffect.BaseProperties != null)
|
if (layerEffect.BaseProperties != null)
|
||||||
|
|||||||
@ -19,13 +19,13 @@ public sealed class Layer : RenderProfileElement
|
|||||||
private const string BROKEN_STATE_BRUSH_NOT_FOUND = "Failed to load layer brush, ensure the plugin is enabled";
|
private const string BROKEN_STATE_BRUSH_NOT_FOUND = "Failed to load layer brush, ensure the plugin is enabled";
|
||||||
private const string BROKEN_STATE_INIT_FAILED = "Failed to initialize layer brush";
|
private const string BROKEN_STATE_INIT_FAILED = "Failed to initialize layer brush";
|
||||||
|
|
||||||
private readonly List<Layer> _renderCopies = new();
|
private readonly List<Layer> _renderCopies = [];
|
||||||
private LayerGeneralProperties _general = new();
|
private LayerGeneralProperties _general = new();
|
||||||
private LayerTransformProperties _transform = new();
|
private LayerTransformProperties _transform = new();
|
||||||
private BaseLayerBrush? _layerBrush;
|
private BaseLayerBrush? _layerBrush;
|
||||||
private LayerShape? _layerShape;
|
private LayerShape? _layerShape;
|
||||||
private List<ArtemisLed> _leds = new();
|
private List<ArtemisLed> _leds = [];
|
||||||
private List<LedEntity> _missingLeds = new();
|
private List<LedEntity> _missingLeds = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the <see cref="Layer" /> class and adds itself to the child collection of the provided
|
/// Creates a new instance of the <see cref="Layer" /> class and adds itself to the child collection of the provided
|
||||||
@ -82,11 +82,11 @@ public sealed class Layer : RenderProfileElement
|
|||||||
Parent = source;
|
Parent = source;
|
||||||
|
|
||||||
// TODO: move to top
|
// TODO: move to top
|
||||||
_renderCopies = new List<Layer>();
|
_renderCopies = [];
|
||||||
_general = new LayerGeneralProperties();
|
_general = new LayerGeneralProperties();
|
||||||
_transform = new LayerTransformProperties();
|
_transform = new LayerTransformProperties();
|
||||||
|
|
||||||
_leds = new List<ArtemisLed>();
|
_leds = [];
|
||||||
Leds = new ReadOnlyCollection<ArtemisLed>(_leds);
|
Leds = new ReadOnlyCollection<ArtemisLed>(_leds);
|
||||||
|
|
||||||
Adapter = new LayerAdapter(this);
|
Adapter = new LayerAdapter(this);
|
||||||
@ -169,7 +169,7 @@ public sealed class Layer : RenderProfileElement
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override List<ILayerProperty> GetAllLayerProperties()
|
public override List<ILayerProperty> GetAllLayerProperties()
|
||||||
{
|
{
|
||||||
List<ILayerProperty> result = new();
|
List<ILayerProperty> result = [];
|
||||||
result.AddRange(General.GetAllLayerProperties());
|
result.AddRange(General.GetAllLayerProperties());
|
||||||
result.AddRange(Transform.GetAllLayerProperties());
|
result.AddRange(Transform.GetAllLayerProperties());
|
||||||
if (LayerBrush?.BaseProperties != null)
|
if (LayerBrush?.BaseProperties != null)
|
||||||
@ -801,7 +801,7 @@ public sealed class Layer : RenderProfileElement
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException("Layer");
|
throw new ObjectDisposedException("Layer");
|
||||||
|
|
||||||
List<ArtemisLed> leds = new();
|
List<ArtemisLed> leds = [];
|
||||||
|
|
||||||
// Get the surface LEDs for this layer
|
// Get the surface LEDs for this layer
|
||||||
List<ArtemisLed> availableLeds = devices.SelectMany(d => d.Leds).ToList();
|
List<ArtemisLed> availableLeds = devices.SelectMany(d => d.Leds).ToList();
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public class LayerAdapter : IStorageModel
|
|||||||
|
|
||||||
internal LayerAdapter(Layer layer)
|
internal LayerAdapter(Layer layer)
|
||||||
{
|
{
|
||||||
_adaptionHints = new List<IAdaptionHint>();
|
_adaptionHints = [];
|
||||||
Layer = layer;
|
Layer = layer;
|
||||||
AdaptionHints = new ReadOnlyCollection<IAdaptionHint>(_adaptionHints);
|
AdaptionHints = new ReadOnlyCollection<IAdaptionHint>(_adaptionHints);
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ public class LayerAdapter : IStorageModel
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ArtemisLed> availableLeds = devices.SelectMany(d => d.Leds).ToList();
|
List<ArtemisLed> availableLeds = devices.SelectMany(d => d.Leds).ToList();
|
||||||
List<ArtemisLed> usedLeds = new();
|
List<ArtemisLed> usedLeds = [];
|
||||||
|
|
||||||
foreach (LedEntity ledEntity in Layer.LayerEntity.Leds)
|
foreach (LedEntity ledEntity in Layer.LayerEntity.Leds)
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ public class LayerAdapter : IStorageModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<IAdaptionHint> DetermineHints(IEnumerable<ArtemisDevice> devices)
|
public List<IAdaptionHint> DetermineHints(IEnumerable<ArtemisDevice> devices)
|
||||||
{
|
{
|
||||||
List<IAdaptionHint> newHints = new();
|
List<IAdaptionHint> newHints = [];
|
||||||
if (devices.All(DoesLayerCoverDevice))
|
if (devices.All(DoesLayerCoverDevice))
|
||||||
{
|
{
|
||||||
DeviceAdaptionHint hint = new() {DeviceType = RGBDeviceType.All};
|
DeviceAdaptionHint hint = new() {DeviceType = RGBDeviceType.All};
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class LayerProperty<T> : CorePropertyChanged, ILayerProperty
|
|||||||
else
|
else
|
||||||
_baseValue = default!;
|
_baseValue = default!;
|
||||||
|
|
||||||
_keyframes = new List<LayerPropertyKeyframe<T>>();
|
_keyframes = [];
|
||||||
Keyframes = new ReadOnlyCollection<LayerPropertyKeyframe<T>>(_keyframes);
|
Keyframes = new ReadOnlyCollection<LayerPropertyKeyframe<T>>(_keyframes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,8 @@ public abstract class LayerPropertyGroup : IDisposable, IPluginFeatureDependent
|
|||||||
GroupDescription = null!;
|
GroupDescription = null!;
|
||||||
Path = "";
|
Path = "";
|
||||||
|
|
||||||
_layerProperties = new List<ILayerProperty>();
|
_layerProperties = [];
|
||||||
_layerPropertyGroups = new List<LayerPropertyGroup>();
|
_layerPropertyGroups = [];
|
||||||
|
|
||||||
LayerProperties = new ReadOnlyCollection<ILayerProperty>(_layerProperties);
|
LayerProperties = new ReadOnlyCollection<ILayerProperty>(_layerProperties);
|
||||||
LayerPropertyGroups = new ReadOnlyCollection<LayerPropertyGroup>(_layerPropertyGroups);
|
LayerPropertyGroups = new ReadOnlyCollection<LayerPropertyGroup>(_layerPropertyGroups);
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public sealed class Profile : ProfileElement
|
|||||||
ProfileEntity = profileEntity;
|
ProfileEntity = profileEntity;
|
||||||
EntityId = profileEntity.Id;
|
EntityId = profileEntity.Id;
|
||||||
|
|
||||||
Exceptions = new List<Exception>();
|
Exceptions = [];
|
||||||
|
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
|
|||||||
internal ProfileElement(Profile profile)
|
internal ProfileElement(Profile profile)
|
||||||
{
|
{
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
ChildrenList = new List<ProfileElement>();
|
ChildrenList = [];
|
||||||
Children = new ReadOnlyCollection<ProfileElement>(ChildrenList);
|
Children = new ReadOnlyCollection<ProfileElement>(ChildrenList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
|
|
||||||
List<RenderProfileElement> elements = new();
|
List<RenderProfileElement> elements = [];
|
||||||
foreach (RenderProfileElement childElement in Children.Where(c => c is RenderProfileElement).Cast<RenderProfileElement>())
|
foreach (RenderProfileElement childElement in Children.Where(c => c is RenderProfileElement).Cast<RenderProfileElement>())
|
||||||
{
|
{
|
||||||
// Add all folders in this element
|
// Add all folders in this element
|
||||||
@ -301,7 +301,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
|
|
||||||
List<Folder> folders = new();
|
List<Folder> folders = [];
|
||||||
foreach (Folder childFolder in Children.Where(c => c is Folder).Cast<Folder>())
|
foreach (Folder childFolder in Children.Where(c => c is Folder).Cast<Folder>())
|
||||||
{
|
{
|
||||||
// Add all folders in this element
|
// Add all folders in this element
|
||||||
@ -322,7 +322,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
|
|
||||||
List<Layer> layers = new();
|
List<Layer> layers = [];
|
||||||
|
|
||||||
// Add all layers in this element
|
// Add all layers in this element
|
||||||
layers.AddRange(Children.Where(c => c is Layer).Cast<Layer>());
|
layers.AddRange(Children.Where(c => c is Layer).Cast<Layer>());
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public abstract class RenderProfileElement : ProfileElement
|
|||||||
|
|
||||||
internal RenderProfileElement(ProfileElement parent, Profile profile) : base(profile)
|
internal RenderProfileElement(ProfileElement parent, Profile profile) : base(profile)
|
||||||
{
|
{
|
||||||
_layerEffects = new List<BaseLayerEffect>();
|
_layerEffects = [];
|
||||||
_displayCondition = new AlwaysOnCondition(this);
|
_displayCondition = new AlwaysOnCondition(this);
|
||||||
Timeline = new Timeline();
|
Timeline = new Timeline();
|
||||||
LayerEffects = new ReadOnlyCollection<BaseLayerEffect>(_layerEffects);
|
LayerEffects = new ReadOnlyCollection<BaseLayerEffect>(_layerEffects);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using Artemis.Core.Services;
|
||||||
using Artemis.Core.Services;
|
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
|
|
||||||
namespace Artemis.Core;
|
namespace Artemis.Core;
|
||||||
|
|||||||
@ -130,7 +130,7 @@ public class ProfileConfigurationIcon : CorePropertyChanged, IStorageModel
|
|||||||
_entity.ProfileConfiguration.IconType = (int) IconType;
|
_entity.ProfileConfiguration.IconType = (int) IconType;
|
||||||
_entity.ProfileConfiguration.MaterialIcon = IconType == ProfileConfigurationIconType.MaterialIcon ? IconName : null;
|
_entity.ProfileConfiguration.MaterialIcon = IconType == ProfileConfigurationIconType.MaterialIcon ? IconName : null;
|
||||||
_entity.ProfileConfiguration.IconFill = Fill;
|
_entity.ProfileConfiguration.IconFill = Fill;
|
||||||
_entity.Icon = IconBytes ?? Array.Empty<byte>();
|
_entity.Icon = IconBytes ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -43,9 +43,9 @@ public class ArtemisDevice : CorePropertyChanged
|
|||||||
|
|
||||||
LedIds = new ReadOnlyDictionary<LedId, ArtemisLed>(new Dictionary<LedId, ArtemisLed>());
|
LedIds = new ReadOnlyDictionary<LedId, ArtemisLed>(new Dictionary<LedId, ArtemisLed>());
|
||||||
Leds = new ReadOnlyCollection<ArtemisLed>(new List<ArtemisLed>());
|
Leds = new ReadOnlyCollection<ArtemisLed>(new List<ArtemisLed>());
|
||||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
InputIdentifiers = [];
|
||||||
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
||||||
Categories = new HashSet<DeviceCategory>();
|
Categories = [];
|
||||||
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
|
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
|
||||||
|
|
||||||
RgbDevice.ColorCorrections.Clear();
|
RgbDevice.ColorCorrections.Clear();
|
||||||
@ -72,9 +72,9 @@ public class ArtemisDevice : CorePropertyChanged
|
|||||||
|
|
||||||
LedIds = new ReadOnlyDictionary<LedId, ArtemisLed>(new Dictionary<LedId, ArtemisLed>());
|
LedIds = new ReadOnlyDictionary<LedId, ArtemisLed>(new Dictionary<LedId, ArtemisLed>());
|
||||||
Leds = new ReadOnlyCollection<ArtemisLed>(new List<ArtemisLed>());
|
Leds = new ReadOnlyCollection<ArtemisLed>(new List<ArtemisLed>());
|
||||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
InputIdentifiers = [];
|
||||||
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
InputMappings = new Dictionary<ArtemisLed, ArtemisLed>();
|
||||||
Categories = new HashSet<DeviceCategory>();
|
Categories = [];
|
||||||
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
|
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
|
||||||
|
|
||||||
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class ArtemisLayout
|
|||||||
public ArtemisLayout(string filePath)
|
public ArtemisLayout(string filePath)
|
||||||
{
|
{
|
||||||
FilePath = filePath;
|
FilePath = filePath;
|
||||||
Leds = new List<ArtemisLedLayout>();
|
Leds = [];
|
||||||
IsDefaultLayout = filePath.StartsWith(DefaultLayoutPath);
|
IsDefaultLayout = filePath.StartsWith(DefaultLayoutPath);
|
||||||
|
|
||||||
LoadLayout();
|
LoadLayout();
|
||||||
@ -70,7 +70,7 @@ public class ArtemisLayout
|
|||||||
device.Size = new Size(MathF.Round(RgbLayout.Width), MathF.Round(RgbLayout.Height));
|
device.Size = new Size(MathF.Round(RgbLayout.Width), MathF.Round(RgbLayout.Height));
|
||||||
device.DeviceInfo.LayoutMetadata = RgbLayout.CustomData;
|
device.DeviceInfo.LayoutMetadata = RgbLayout.CustomData;
|
||||||
|
|
||||||
HashSet<LedId> ledIds = new();
|
HashSet<LedId> ledIds = [];
|
||||||
foreach (ILedLayout layoutLed in RgbLayout.Leds)
|
foreach (ILedLayout layoutLed in RgbLayout.Leds)
|
||||||
{
|
{
|
||||||
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
|
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
namespace Artemis.Core.DeviceProviders;
|
namespace Artemis.Core.DeviceProviders;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public abstract class LayerBrushProvider : PluginFeature
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected LayerBrushProvider()
|
protected LayerBrushProvider()
|
||||||
{
|
{
|
||||||
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
_layerBrushDescriptors = [];
|
||||||
LayerBrushDescriptors = new ReadOnlyCollection<LayerBrushDescriptor>(_layerBrushDescriptors);
|
LayerBrushDescriptors = new ReadOnlyCollection<LayerBrushDescriptor>(_layerBrushDescriptors);
|
||||||
Disabled += OnDisabled;
|
Disabled += OnDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public abstract class LayerEffectProvider : PluginFeature
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected LayerEffectProvider()
|
protected LayerEffectProvider()
|
||||||
{
|
{
|
||||||
_layerEffectDescriptors = new List<LayerEffectDescriptor>();
|
_layerEffectDescriptors = [];
|
||||||
LayerEffectDescriptors = new ReadOnlyCollection<LayerEffectDescriptor>(_layerEffectDescriptors);
|
LayerEffectDescriptors = new ReadOnlyCollection<LayerEffectDescriptor>(_layerEffectDescriptors);
|
||||||
Disabled += OnDisabled;
|
Disabled += OnDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace Artemis.Core.Modules;
|
|||||||
public abstract class DataModel
|
public abstract class DataModel
|
||||||
{
|
{
|
||||||
private const StringComparison PathsStringComparison = StringComparison.OrdinalIgnoreCase;
|
private const StringComparison PathsStringComparison = StringComparison.OrdinalIgnoreCase;
|
||||||
private readonly List<DataModelPath> _activePaths = new();
|
private readonly List<DataModelPath> _activePaths = [];
|
||||||
private readonly HashSet<string> _activePathsHashSet = new(StringComparer.FromComparison(PathsStringComparison));
|
private readonly HashSet<string> _activePathsHashSet = new(StringComparer.FromComparison(PathsStringComparison));
|
||||||
private readonly Dictionary<string, DynamicChild> _dynamicChildren = new();
|
private readonly Dictionary<string, DynamicChild> _dynamicChildren = new();
|
||||||
|
|
||||||
|
|||||||
@ -111,13 +111,13 @@ public abstract class Module<T> : Module where T : DataModel, new()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class Module : PluginFeature
|
public abstract class Module : PluginFeature
|
||||||
{
|
{
|
||||||
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new();
|
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = [];
|
||||||
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
|
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new();
|
protected internal readonly List<PropertyInfo> HiddenPropertiesList = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base constructor of the <see cref="Module" /> class.
|
/// The base constructor of the <see cref="Module" /> class.
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public abstract class NodeProvider : PluginFeature
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public NodeProvider()
|
public NodeProvider()
|
||||||
{
|
{
|
||||||
_nodeDescriptors = new List<NodeData>();
|
_nodeDescriptors = [];
|
||||||
NodeDescriptors = new ReadOnlyCollection<NodeData>(_nodeDescriptors);
|
NodeDescriptors = new ReadOnlyCollection<NodeData>(_nodeDescriptors);
|
||||||
Disabled += OnDisabled;
|
Disabled += OnDisabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@ public class Plugin : CorePropertyChanged, IDisposable
|
|||||||
Info.Plugin = this;
|
Info.Plugin = this;
|
||||||
|
|
||||||
_loadedFromStorage = loadedFromStorage;
|
_loadedFromStorage = loadedFromStorage;
|
||||||
_features = new List<PluginFeatureInfo>();
|
_features = [];
|
||||||
_profilers = new List<Profiler>();
|
_profilers = [];
|
||||||
|
|
||||||
Features = new ReadOnlyCollection<PluginFeatureInfo>(_features);
|
Features = new ReadOnlyCollection<PluginFeatureInfo>(_features);
|
||||||
Profilers = new ReadOnlyCollection<Profiler>(_profilers);
|
Profilers = new ReadOnlyCollection<Profiler>(_profilers);
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public class PluginFeatureInfo : IPrerequisitesSubject
|
|||||||
public PluginFeature? Instance { get; internal set; }
|
public PluginFeature? Instance { get; internal set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public List<PluginPrerequisite> Prerequisites { get; } = new();
|
public List<PluginPrerequisite> Prerequisites { get; } = [];
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<PluginPrerequisite> PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
|
public IEnumerable<PluginPrerequisite> PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
|
||||||
|
|||||||
@ -109,43 +109,44 @@ public class PluginInfo : IPrerequisitesSubject
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
public PluginPlatform? Platforms { get; internal init; }
|
public PluginPlatform? Platforms { get; internal init; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the API version the plugin was built for
|
|
||||||
/// </summary>
|
|
||||||
[JsonInclude]
|
|
||||||
public Version? Api { get; internal init; } = new(1, 0, 0);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the minimum version of Artemis required by this plugin
|
/// Gets the minimum version of Artemis required by this plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Version? MinimumVersion { get; internal init; } = new(1, 0, 0);
|
[JsonInclude]
|
||||||
|
public Version? MinimumVersion { get; internal init; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin this info is associated with
|
/// Gets the plugin this info is associated with
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Plugin Plugin { get; internal set; } = null!;
|
public Plugin? Plugin { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a string representing either a full path pointing to an svg or the markdown icon
|
/// Gets a string representing either a full path pointing to an svg or the markdown icon
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string? ResolvedIcon => Icon == null ? null : Icon.Contains('.') ? Plugin.ResolveRelativePath(Icon) : Icon;
|
public string? ResolvedIcon => Icon == null ? null : Icon.Contains('.') ? Plugin?.ResolveRelativePath(Icon) : Icon;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version
|
/// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && Api != null && Api.Major >= Constants.PluginApiVersion && MatchesMinimumVersion();
|
public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && MatchesMinimumVersion();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public List<PluginPrerequisite> Prerequisites { get; } = new();
|
public List<PluginPrerequisite> Prerequisites { get; } = [];
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IEnumerable<PluginPrerequisite> PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
|
public IEnumerable<PluginPrerequisite> PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the exception thrown while loading
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public Exception? LoadException { get; internal set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";
|
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";
|
||||||
|
|||||||
@ -14,7 +14,7 @@ internal sealed class SurfaceManager : IDisposable
|
|||||||
{
|
{
|
||||||
private readonly IRenderer _renderer;
|
private readonly IRenderer _renderer;
|
||||||
private readonly TimerUpdateTrigger _updateTrigger;
|
private readonly TimerUpdateTrigger _updateTrigger;
|
||||||
private readonly List<ArtemisDevice> _devices = new();
|
private readonly List<ArtemisDevice> _devices = [];
|
||||||
private readonly SKTextureBrush _textureBrush = new(null) {CalculationMode = RenderMode.Absolute};
|
private readonly SKTextureBrush _textureBrush = new(null) {CalculationMode = RenderMode.Absolute};
|
||||||
|
|
||||||
private ListLedGroup? _surfaceLedGroup;
|
private ListLedGroup? _surfaceLedGroup;
|
||||||
@ -44,7 +44,7 @@ internal sealed class SurfaceManager : IDisposable
|
|||||||
|
|
||||||
public void AddDevices(IEnumerable<ArtemisDevice> devices)
|
public void AddDevices(IEnumerable<ArtemisDevice> devices)
|
||||||
{
|
{
|
||||||
List<IRGBDevice> newDevices = new();
|
List<IRGBDevice> newDevices = [];
|
||||||
lock (_devices)
|
lock (_devices)
|
||||||
{
|
{
|
||||||
foreach (ArtemisDevice artemisDevice in devices)
|
foreach (ArtemisDevice artemisDevice in devices)
|
||||||
@ -66,7 +66,7 @@ internal sealed class SurfaceManager : IDisposable
|
|||||||
|
|
||||||
public void RemoveDevices(IEnumerable<ArtemisDevice> devices)
|
public void RemoveDevices(IEnumerable<ArtemisDevice> devices)
|
||||||
{
|
{
|
||||||
List<IRGBDevice> removedDevices = new();
|
List<IRGBDevice> removedDevices = [];
|
||||||
lock (_devices)
|
lock (_devices)
|
||||||
{
|
{
|
||||||
foreach (ArtemisDevice artemisDevice in devices)
|
foreach (ArtemisDevice artemisDevice in devices)
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.DeviceProviders;
|
using Artemis.Core.DeviceProviders;
|
||||||
using Artemis.Core.Providers;
|
using Artemis.Core.Providers;
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
using System;
|
using RGB.NET.Core;
|
||||||
using System.Collections.Generic;
|
|
||||||
using RGB.NET.Core;
|
|
||||||
|
|
||||||
namespace Artemis.Core.Services;
|
namespace Artemis.Core.Services;
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ internal class InputService : IInputService
|
|||||||
|
|
||||||
#region Providers
|
#region Providers
|
||||||
|
|
||||||
private readonly List<InputProvider> _inputProviders = new();
|
private readonly List<InputProvider> _inputProviders = [];
|
||||||
|
|
||||||
public KeyboardToggleStatus KeyboardToggleStatus { get; private set; } = new(false, false, false);
|
public KeyboardToggleStatus KeyboardToggleStatus { get; private set; } = new(false, false, false);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ internal class InputService : IInputService
|
|||||||
#region Identification
|
#region Identification
|
||||||
|
|
||||||
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache = new();
|
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache = new();
|
||||||
private List<ArtemisDevice> _devices = new();
|
private List<ArtemisDevice> _devices = [];
|
||||||
private ArtemisDevice? _identifyingDevice;
|
private ArtemisDevice? _identifyingDevice;
|
||||||
|
|
||||||
public void IdentifyDevice(ArtemisDevice device)
|
public void IdentifyDevice(ArtemisDevice device)
|
||||||
@ -308,7 +308,7 @@ internal class InputService : IInputService
|
|||||||
if (device != null)
|
if (device != null)
|
||||||
{
|
{
|
||||||
// Ensure the device is in the dictionary
|
// Ensure the device is in the dictionary
|
||||||
_pressedKeys.TryAdd(device, new HashSet<KeyboardKey>());
|
_pressedKeys.TryAdd(device, []);
|
||||||
// Get the hash set of the device
|
// Get the hash set of the device
|
||||||
HashSet<KeyboardKey> pressedDeviceKeys = _pressedKeys[device];
|
HashSet<KeyboardKey> pressedDeviceKeys = _pressedKeys[device];
|
||||||
// See if the key is already pressed
|
// See if the key is already pressed
|
||||||
@ -389,7 +389,7 @@ internal class InputService : IInputService
|
|||||||
|
|
||||||
#region Mouse
|
#region Mouse
|
||||||
|
|
||||||
private readonly HashSet<MouseButton> _pressedButtons = new();
|
private readonly HashSet<MouseButton> _pressedButtons = [];
|
||||||
|
|
||||||
|
|
||||||
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
|
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.Core.DeviceProviders;
|
using Artemis.Core.DeviceProviders;
|
||||||
|
|
||||||
namespace Artemis.Core.Services;
|
namespace Artemis.Core.Services;
|
||||||
|
|||||||
@ -21,12 +21,12 @@ public interface IPluginManagementService : IArtemisService, IDisposable
|
|||||||
/// Indicates whether or not plugins are currently being loaded
|
/// Indicates whether or not plugins are currently being loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool LoadingPlugins { get; }
|
bool LoadingPlugins { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates whether or not plugins are currently loaded
|
/// Indicates whether or not plugins are currently loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool LoadedPlugins { get; }
|
bool LoadedPlugins { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads all installed plugins. If plugins already loaded this will reload them all
|
/// Loads all installed plugins. If plugins already loaded this will reload them all
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -108,7 +108,13 @@ public interface IPluginManagementService : IArtemisService, IDisposable
|
|||||||
void DisablePluginFeature(PluginFeature pluginFeature, bool saveState);
|
void DisablePluginFeature(PluginFeature pluginFeature, bool saveState);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin info of all loaded plugins
|
/// Gets the plugin info of all plugins, regardless of whether they are currently loaded
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A list containing all the plugin info</returns>
|
||||||
|
List<PluginInfo> GetAllPluginInfo();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of all loaded plugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A list containing all the plugin info</returns>
|
/// <returns>A list containing all the plugin info</returns>
|
||||||
List<Plugin> GetAllPlugins();
|
List<Plugin> GetAllPlugins();
|
||||||
@ -149,7 +155,7 @@ public interface IPluginManagementService : IArtemisService, IDisposable
|
|||||||
/// <param name="device"></param>
|
/// <param name="device"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
DeviceProvider GetDeviceProviderByDevice(IRGBDevice device);
|
DeviceProvider GetDeviceProviderByDevice(IRGBDevice device);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a plugin has started loading
|
/// Occurs when a plugin has started loading
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -183,7 +189,7 @@ public interface IPluginManagementService : IArtemisService, IDisposable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a plugin is removed
|
/// Occurs when a plugin is removed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler<PluginEventArgs> PluginRemoved;
|
event EventHandler<PluginEventArgs> PluginRemoved;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a plugin feature is being enabled
|
/// Occurs when a plugin feature is being enabled
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Artemis.Core.Services.Core;
|
|
||||||
using Artemis.Core.SkiaSharp;
|
using Artemis.Core.SkiaSharp;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.DeviceProviders;
|
using Artemis.Core.DeviceProviders;
|
||||||
using Artemis.Core.DryIoc;
|
using Artemis.Core.DryIoc;
|
||||||
using Artemis.Storage.Entities.General;
|
|
||||||
using Artemis.Storage.Entities.Plugins;
|
using Artemis.Storage.Entities.Plugins;
|
||||||
using Artemis.Storage.Entities.Surface;
|
using Artemis.Storage.Entities.Surface;
|
||||||
using Artemis.Storage.Repositories.Interfaces;
|
using Artemis.Storage.Repositories.Interfaces;
|
||||||
@ -29,6 +28,7 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
private readonly IContainer _container;
|
private readonly IContainer _container;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IPluginRepository _pluginRepository;
|
private readonly IPluginRepository _pluginRepository;
|
||||||
|
private readonly List<PluginInfo> _pluginInfos;
|
||||||
private readonly List<Plugin> _plugins;
|
private readonly List<Plugin> _plugins;
|
||||||
private FileSystemWatcher? _hotReloadWatcher;
|
private FileSystemWatcher? _hotReloadWatcher;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
@ -40,20 +40,29 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_pluginRepository = pluginRepository;
|
_pluginRepository = pluginRepository;
|
||||||
_deviceRepository = deviceRepository;
|
_deviceRepository = deviceRepository;
|
||||||
_plugins = new List<Plugin>();
|
_pluginInfos = [];
|
||||||
|
_plugins = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DirectoryInfo> AdditionalPluginDirectories { get; } = new();
|
public List<DirectoryInfo> AdditionalPluginDirectories { get; } = [];
|
||||||
|
|
||||||
public bool LoadingPlugins { get; private set; }
|
public bool LoadingPlugins { get; private set; }
|
||||||
|
|
||||||
public bool LoadedPlugins { get; private set; }
|
public bool LoadedPlugins { get; private set; }
|
||||||
|
|
||||||
|
public List<PluginInfo> GetAllPluginInfo()
|
||||||
|
{
|
||||||
|
lock (_pluginInfos)
|
||||||
|
{
|
||||||
|
return [.._pluginInfos];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Plugin> GetAllPlugins()
|
public List<Plugin> GetAllPlugins()
|
||||||
{
|
{
|
||||||
lock (_plugins)
|
lock (_plugins)
|
||||||
{
|
{
|
||||||
return new List<Plugin>(_plugins);
|
return [.._plugins];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +273,13 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
if (_plugins.Any(p => p.Guid == pluginInfo.Guid))
|
if (_plugins.Any(p => p.Guid == pluginInfo.Guid))
|
||||||
throw new ArtemisCoreException($"Cannot load plugin {pluginInfo} because it is using a GUID already used by another plugin");
|
throw new ArtemisCoreException($"Cannot load plugin {pluginInfo} because it is using a GUID already used by another plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There may be info on a plugin that previously failed to load, remove that
|
||||||
|
lock (_pluginInfos)
|
||||||
|
{
|
||||||
|
_pluginInfos.RemoveAll(i => i.Guid == pluginInfo.Guid);
|
||||||
|
_pluginInfos.Add(pluginInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// Load the entity and fall back on creating a new one
|
// Load the entity and fall back on creating a new one
|
||||||
PluginEntity? entity = _pluginRepository.GetPluginByPluginGuid(pluginInfo.Guid);
|
PluginEntity? entity = _pluginRepository.GetPluginByPluginGuid(pluginInfo.Guid);
|
||||||
@ -302,6 +318,7 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
pluginInfo.LoadException = e;
|
||||||
throw new ArtemisPluginException(plugin, "Failed to load the plugins assembly", e);
|
throw new ArtemisPluginException(plugin, "Failed to load the plugins assembly", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,6 +330,7 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
}
|
}
|
||||||
catch (ReflectionTypeLoadException e)
|
catch (ReflectionTypeLoadException e)
|
||||||
{
|
{
|
||||||
|
pluginInfo.LoadException = e;
|
||||||
throw new ArtemisPluginException(
|
throw new ArtemisPluginException(
|
||||||
plugin,
|
plugin,
|
||||||
"Failed to initialize the plugin assembly",
|
"Failed to initialize the plugin assembly",
|
||||||
@ -472,6 +490,10 @@ internal class PluginManagementService : IPluginManagementService
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.Dispose();
|
plugin.Dispose();
|
||||||
|
lock (_pluginInfos)
|
||||||
|
{
|
||||||
|
_pluginInfos.Remove(plugin.Info);
|
||||||
|
}
|
||||||
lock (_plugins)
|
lock (_plugins)
|
||||||
{
|
{
|
||||||
_plugins.Remove(plugin);
|
_plugins.Remove(plugin);
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public static partial class ProcessMonitor
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
lock (LOCK)
|
lock (LOCK)
|
||||||
return _processes.Values.ToImmutableArray();
|
return [.._processes.Values];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace Artemis.Core.Services;
|
|||||||
internal class RenderService : IRenderService, IRenderer, IDisposable
|
internal class RenderService : IRenderService, IRenderer, IDisposable
|
||||||
{
|
{
|
||||||
private readonly Stopwatch _frameStopWatch;
|
private readonly Stopwatch _frameStopWatch;
|
||||||
private readonly List<Exception> _updateExceptions = new();
|
private readonly List<Exception> _updateExceptions = [];
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IDeviceService _deviceService;
|
private readonly IDeviceService _deviceService;
|
||||||
|
|||||||
@ -8,8 +8,8 @@ internal class SurfaceArrangement
|
|||||||
{
|
{
|
||||||
public SurfaceArrangement()
|
public SurfaceArrangement()
|
||||||
{
|
{
|
||||||
Types = new List<SurfaceArrangementType>();
|
Types = [];
|
||||||
ArrangedDevices = new List<ArtemisDevice>();
|
ArrangedDevices = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SurfaceArrangementType> Types { get; }
|
public List<SurfaceArrangementType> Types { get; }
|
||||||
|
|||||||
@ -12,7 +12,7 @@ internal class SurfaceArrangementType
|
|||||||
SurfaceArrangement = surfaceArrangement;
|
SurfaceArrangement = surfaceArrangement;
|
||||||
DeviceType = deviceType;
|
DeviceType = deviceType;
|
||||||
ZIndex = zIndex;
|
ZIndex = zIndex;
|
||||||
Configurations = new List<SurfaceArrangementConfiguration>();
|
Configurations = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public SurfaceArrangement SurfaceArrangement { get; }
|
public SurfaceArrangement SurfaceArrangement { get; }
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -11,7 +10,6 @@ using System.Text.Json.Nodes;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.Modules;
|
using Artemis.Core.Modules;
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
using Artemis.Storage.Migrations;
|
|
||||||
using Artemis.Storage.Repositories.Interfaces;
|
using Artemis.Storage.Repositories.Interfaces;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
@ -25,9 +23,9 @@ internal class ProfileService : IProfileService
|
|||||||
private readonly IProfileRepository _profileRepository;
|
private readonly IProfileRepository _profileRepository;
|
||||||
private readonly IPluginManagementService _pluginManagementService;
|
private readonly IPluginManagementService _pluginManagementService;
|
||||||
private readonly IDeviceService _deviceService;
|
private readonly IDeviceService _deviceService;
|
||||||
private readonly List<ArtemisKeyboardKeyEventArgs> _pendingKeyboardEvents = new();
|
private readonly List<ArtemisKeyboardKeyEventArgs> _pendingKeyboardEvents = [];
|
||||||
private readonly List<Exception> _renderExceptions = new();
|
private readonly List<Exception> _renderExceptions = [];
|
||||||
private readonly List<Exception> _updateExceptions = new();
|
private readonly List<Exception> _updateExceptions = [];
|
||||||
|
|
||||||
private DateTime _lastRenderExceptionLog;
|
private DateTime _lastRenderExceptionLog;
|
||||||
private DateTime _lastUpdateExceptionLog;
|
private DateTime _lastUpdateExceptionLog;
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GenHTTP.Api.Protocol;
|
using GenHTTP.Api.Protocol;
|
||||||
using GenHTTP.Modules.Basics;
|
|
||||||
using GenHTTP.Modules.Conversion.Serializers.Json;
|
using GenHTTP.Modules.Conversion.Serializers.Json;
|
||||||
|
using GenHTTP.Modules.IO;
|
||||||
|
|
||||||
namespace Artemis.Core.Services;
|
namespace Artemis.Core.Services;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GenHTTP.Api.Protocol;
|
using GenHTTP.Api.Protocol;
|
||||||
using GenHTTP.Modules.Basics;
|
|
||||||
using GenHTTP.Modules.IO;
|
using GenHTTP.Modules.IO;
|
||||||
using StringContent = GenHTTP.Modules.IO.Strings.StringContent;
|
using StringContent = GenHTTP.Modules.IO.Strings.StringContent;
|
||||||
|
|
||||||
@ -57,7 +55,7 @@ public abstract class PluginEndPoint
|
|||||||
public FlexibleContentType Returns { get; protected set; }
|
public FlexibleContentType Returns { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs whenever a request threw an unhandled exception
|
/// Occurs whenever a request threw an Unhandled error
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<EndpointExceptionEventArgs>? RequestException;
|
public event EventHandler<EndpointExceptionEventArgs>? RequestException;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GenHTTP.Api.Protocol;
|
using GenHTTP.Api.Protocol;
|
||||||
using GenHTTP.Modules.Basics;
|
using GenHTTP.Modules.IO;
|
||||||
using GenHTTP.Modules.IO.Strings;
|
using GenHTTP.Modules.IO.Strings;
|
||||||
|
|
||||||
namespace Artemis.Core.Services;
|
namespace Artemis.Core.Services;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.Modules;
|
|
||||||
using GenHTTP.Api.Infrastructure;
|
using GenHTTP.Api.Infrastructure;
|
||||||
using GenHTTP.Api.Protocol;
|
using GenHTTP.Api.Protocol;
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GenHTTP.Api.Content;
|
using GenHTTP.Api.Content;
|
||||||
using GenHTTP.Api.Protocol;
|
using GenHTTP.Api.Protocol;
|
||||||
using GenHTTP.Modules.Basics;
|
using GenHTTP.Modules.IO;
|
||||||
using GenHTTP.Modules.Conversion.Serializers.Json;
|
|
||||||
using GenHTTP.Modules.IO.Strings;
|
using GenHTTP.Modules.IO.Strings;
|
||||||
|
|
||||||
namespace Artemis.Core.Services;
|
namespace Artemis.Core.Services;
|
||||||
|
|||||||
@ -12,7 +12,6 @@ using GenHTTP.Api.Protocol;
|
|||||||
using GenHTTP.Engine.Internal;
|
using GenHTTP.Engine.Internal;
|
||||||
using GenHTTP.Modules.Conversion;
|
using GenHTTP.Modules.Conversion;
|
||||||
using GenHTTP.Modules.Conversion.Serializers;
|
using GenHTTP.Modules.Conversion.Serializers;
|
||||||
using GenHTTP.Modules.ErrorHandling;
|
|
||||||
using GenHTTP.Modules.Layouting;
|
using GenHTTP.Modules.Layouting;
|
||||||
using GenHTTP.Modules.Layouting.Provider;
|
using GenHTTP.Modules.Layouting.Provider;
|
||||||
using GenHTTP.Modules.Practices;
|
using GenHTTP.Modules.Practices;
|
||||||
@ -43,7 +42,7 @@ internal class WebServerService : IWebServerService, IDisposable
|
|||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_coreService = coreService;
|
_coreService = coreService;
|
||||||
_controllers = new List<WebApiControllerRegistration>();
|
_controllers = [];
|
||||||
|
|
||||||
_webServerEnabledSetting = settingsService.GetSetting("WebServer.Enabled", true);
|
_webServerEnabledSetting = settingsService.GetSetting("WebServer.Enabled", true);
|
||||||
_webServerRemoteAccessSetting = settingsService.GetSetting("WebServer.RemoteAccess", false);
|
_webServerRemoteAccessSetting = settingsService.GetSetting("WebServer.RemoteAccess", false);
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.Core;
|
|||||||
|
|
||||||
internal class DataModelStore
|
internal class DataModelStore
|
||||||
{
|
{
|
||||||
private static readonly List<DataModelRegistration> Registrations = new();
|
private static readonly List<DataModelRegistration> Registrations = [];
|
||||||
|
|
||||||
public static DataModelRegistration Add(DataModel dataModel)
|
public static DataModelRegistration Add(DataModel dataModel)
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ internal class DataModelStore
|
|||||||
{
|
{
|
||||||
lock (Registrations)
|
lock (Registrations)
|
||||||
{
|
{
|
||||||
return new List<DataModelRegistration>(Registrations);
|
return [..Registrations];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.Core;
|
|||||||
|
|
||||||
internal class LayerBrushStore
|
internal class LayerBrushStore
|
||||||
{
|
{
|
||||||
private static readonly List<LayerBrushRegistration> Registrations = new();
|
private static readonly List<LayerBrushRegistration> Registrations = [];
|
||||||
|
|
||||||
public static LayerBrushRegistration Add(LayerBrushDescriptor descriptor)
|
public static LayerBrushRegistration Add(LayerBrushDescriptor descriptor)
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ internal class LayerBrushStore
|
|||||||
{
|
{
|
||||||
lock (Registrations)
|
lock (Registrations)
|
||||||
{
|
{
|
||||||
return new List<LayerBrushRegistration>(Registrations);
|
return [..Registrations];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.Core;
|
|||||||
|
|
||||||
internal class LayerEffectStore
|
internal class LayerEffectStore
|
||||||
{
|
{
|
||||||
private static readonly List<LayerEffectRegistration> Registrations = new();
|
private static readonly List<LayerEffectRegistration> Registrations = [];
|
||||||
|
|
||||||
public static LayerEffectRegistration Add(LayerEffectDescriptor descriptor)
|
public static LayerEffectRegistration Add(LayerEffectDescriptor descriptor)
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ internal class LayerEffectStore
|
|||||||
{
|
{
|
||||||
lock (Registrations)
|
lock (Registrations)
|
||||||
{
|
{
|
||||||
return new List<LayerEffectRegistration>(Registrations);
|
return [..Registrations];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ public static class LogStore
|
|||||||
{
|
{
|
||||||
private static readonly object _lock = new();
|
private static readonly object _lock = new();
|
||||||
|
|
||||||
private static readonly LinkedList<LogEvent> LinkedList = new();
|
private static readonly LinkedList<LogEvent> LinkedList = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list containing the last 500 log events.
|
/// Gets a list containing the last 500 log events.
|
||||||
|
|||||||
@ -8,8 +8,8 @@ namespace Artemis.Core;
|
|||||||
|
|
||||||
internal class NodeTypeStore
|
internal class NodeTypeStore
|
||||||
{
|
{
|
||||||
private static readonly List<NodeTypeRegistration> Registrations = new();
|
private static readonly List<NodeTypeRegistration> Registrations = [];
|
||||||
private static readonly List<TypeColorRegistration> ColorRegistrations = new();
|
private static readonly List<TypeColorRegistration> ColorRegistrations = [];
|
||||||
|
|
||||||
public static NodeTypeRegistration Add(NodeData nodeData)
|
public static NodeTypeRegistration Add(NodeData nodeData)
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ internal class NodeTypeStore
|
|||||||
{
|
{
|
||||||
lock (ColorRegistrations)
|
lock (ColorRegistrations)
|
||||||
{
|
{
|
||||||
return new List<TypeColorRegistration>(ColorRegistrations);
|
return [..ColorRegistrations];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public static class EnumUtilities
|
|||||||
if (!t.IsEnum)
|
if (!t.IsEnum)
|
||||||
throw new ArgumentException($"{t} must be an enum type");
|
throw new ArgumentException($"{t} must be an enum type");
|
||||||
|
|
||||||
return Enum.GetValues(t).Cast<Enum>().Select(e => (e, e.Humanize())).ToList();
|
return Enum.GetValues(t).Cast<Enum>().Select(e => (e, HumanizeValue(e))).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -40,6 +40,6 @@ public static class EnumUtilities
|
|||||||
/// <returns>A humanized string describing the given value</returns>
|
/// <returns>A humanized string describing the given value</returns>
|
||||||
public static string HumanizeValue(Enum value)
|
public static string HumanizeValue(Enum value)
|
||||||
{
|
{
|
||||||
return value.Humanize();
|
return value.ToString().Humanize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,7 +4,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.AccessControl;
|
using System.Security.AccessControl;
|
||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
using SkiaSharp;
|
|
||||||
|
|
||||||
namespace Artemis.Core;
|
namespace Artemis.Core;
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public static class NodeExtension
|
|||||||
/// <returns><see langword="true" /> if there would be a loop; otherwise <see langword="false" />.</returns>
|
/// <returns><see langword="true" /> if there would be a loop; otherwise <see langword="false" />.</returns>
|
||||||
public static bool IsInLoop(this INode node, INode pendingConnection)
|
public static bool IsInLoop(this INode node, INode pendingConnection)
|
||||||
{
|
{
|
||||||
HashSet<INode> checkedNodes = new();
|
HashSet<INode> checkedNodes = [];
|
||||||
|
|
||||||
bool CheckNode(INode checkNode, INode? pending)
|
bool CheckNode(INode checkNode, INode? pending)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public abstract class NodeScript : CorePropertyChanged, INodeScript
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Description { get; }
|
public string Description { get; }
|
||||||
|
|
||||||
private readonly List<INode> _nodes = new();
|
private readonly List<INode> _nodes = [];
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<INode> Nodes => new ReadOnlyCollection<INode>(_nodes);
|
public IEnumerable<INode> Nodes => new ReadOnlyCollection<INode>(_nodes);
|
||||||
|
|||||||
@ -28,8 +28,8 @@ public abstract class Node : BreakableModel, INode
|
|||||||
|
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
private readonly List<OutputPin> _outputPinBucket = new();
|
private readonly List<OutputPin> _outputPinBucket = [];
|
||||||
private readonly List<InputPin> _inputPinBucket = new();
|
private readonly List<InputPin> _inputPinBucket = [];
|
||||||
|
|
||||||
private Guid _id;
|
private Guid _id;
|
||||||
|
|
||||||
@ -95,12 +95,12 @@ public abstract class Node : BreakableModel, INode
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsLoading { get; set; }
|
public bool IsLoading { get; set; }
|
||||||
|
|
||||||
private readonly List<IPin> _pins = new();
|
private readonly List<IPin> _pins = [];
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IReadOnlyCollection<IPin> Pins => new ReadOnlyCollection<IPin>(_pins);
|
public IReadOnlyCollection<IPin> Pins => new ReadOnlyCollection<IPin>(_pins);
|
||||||
|
|
||||||
private readonly List<IPinCollection> _pinCollections = new();
|
private readonly List<IPinCollection> _pinCollections = [];
|
||||||
private string _helpUrl;
|
private string _helpUrl;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public abstract class Node<TStorage, TViewModel> : Node<TStorage>, ICustomViewMo
|
|||||||
{
|
{
|
||||||
if (NodeData == null)
|
if (NodeData == null)
|
||||||
throw new ArtemisCoreException("Nodes without node data (default nodes or exit nodes) cannot have custom view models");
|
throw new ArtemisCoreException("Nodes without node data (default nodes or exit nodes) cannot have custom view models");
|
||||||
return NodeData.Provider.Plugin.Container.Resolve<TViewModel>(args: new object[] {this, nodeScript});
|
return NodeData.Provider.Plugin.Container.Resolve<TViewModel>(args: [this, nodeScript]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public abstract class Pin : CorePropertyChanged, IPin
|
|||||||
protected set => SetAndNotify(ref _isNumeric, value);
|
protected set => SetAndNotify(ref _isNumeric, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly List<IPin> _connectedTo = new();
|
private readonly List<IPin> _connectedTo = [];
|
||||||
private string _name;
|
private string _name;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public abstract class PinCollection : CorePropertyChanged, IPinCollection
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public abstract Type Type { get; }
|
public abstract Type Type { get; }
|
||||||
|
|
||||||
private readonly List<IPin> _pins = new();
|
private readonly List<IPin> _pins = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a read only observable collection of the pins
|
/// Gets a read only observable collection of the pins
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ internal class PluginEntity
|
|||||||
{
|
{
|
||||||
public PluginEntity()
|
public PluginEntity()
|
||||||
{
|
{
|
||||||
Features = new List<PluginFeatureEntity>();
|
Features = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|||||||
@ -7,7 +7,7 @@ internal abstract class RenderElementEntity
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public Guid ParentId { get; set; }
|
public Guid ParentId { get; set; }
|
||||||
|
|
||||||
public List<LayerEffectEntity> LayerEffects { get; set; } = new();
|
public List<LayerEffectEntity> LayerEffects { get; set; } = [];
|
||||||
|
|
||||||
public IConditionEntity? DisplayCondition { get; set; }
|
public IConditionEntity? DisplayCondition { get; set; }
|
||||||
public TimelineEntity? Timeline { get; set; }
|
public TimelineEntity? Timeline { get; set; }
|
||||||
|
|||||||
@ -8,8 +8,8 @@ internal class LayerEntity : RenderElementEntity
|
|||||||
{
|
{
|
||||||
public LayerEntity()
|
public LayerEntity()
|
||||||
{
|
{
|
||||||
Leds = new List<LedEntity>();
|
Leds = [];
|
||||||
AdaptionHints = new List<IAdaptionHintEntity>();
|
AdaptionHints = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
|||||||
@ -4,7 +4,7 @@ internal class NodeEntity
|
|||||||
{
|
{
|
||||||
public NodeEntity()
|
public NodeEntity()
|
||||||
{
|
{
|
||||||
PinCollections = new List<NodePinCollectionEntity>();
|
PinCollections = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeEntity(NodeEntity nodeEntity)
|
public NodeEntity(NodeEntity nodeEntity)
|
||||||
|
|||||||
@ -4,8 +4,8 @@ internal class NodeScriptEntity
|
|||||||
{
|
{
|
||||||
public NodeScriptEntity()
|
public NodeScriptEntity()
|
||||||
{
|
{
|
||||||
Nodes = new List<NodeEntity>();
|
Nodes = [];
|
||||||
Connections = new List<NodeConnectionEntity>();
|
Connections = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ internal class ProfileCategoryEntity
|
|||||||
public bool IsSuspended { get; set; }
|
public bool IsSuspended { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
|
||||||
public List<ProfileConfigurationEntity> ProfileConfigurations { get; set; } = new();
|
public List<ProfileConfigurationEntity> ProfileConfigurations { get; set; } = [];
|
||||||
|
|
||||||
public Storage.Entities.Profile.ProfileCategoryEntity Migrate(ILogger logger, List<ProfileEntity> legacyProfiles, ILiteStorage<Guid> profileIcons)
|
public Storage.Entities.Profile.ProfileCategoryEntity Migrate(ILogger logger, List<ProfileEntity> legacyProfiles, ILiteStorage<Guid> profileIcons)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,9 +6,9 @@ internal class ProfileEntity
|
|||||||
{
|
{
|
||||||
public ProfileEntity()
|
public ProfileEntity()
|
||||||
{
|
{
|
||||||
Folders = new List<FolderEntity>();
|
Folders = [];
|
||||||
Layers = new List<LayerEntity>();
|
Layers = [];
|
||||||
ScriptConfigurations = new List<ScriptConfigurationEntity>();
|
ScriptConfigurations = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|||||||
@ -9,5 +9,5 @@ internal class PropertyEntity
|
|||||||
public bool KeyframesEnabled { get; set; }
|
public bool KeyframesEnabled { get; set; }
|
||||||
|
|
||||||
public DataBindingEntity? DataBinding { get; set; }
|
public DataBindingEntity? DataBinding { get; set; }
|
||||||
public List<KeyframeEntity> KeyframeEntities { get; set; } = new();
|
public List<KeyframeEntity> KeyframeEntities { get; set; } = [];
|
||||||
}
|
}
|
||||||
@ -3,6 +3,6 @@
|
|||||||
internal class PropertyGroupEntity
|
internal class PropertyGroupEntity
|
||||||
{
|
{
|
||||||
public string Identifier { get; set; } = string.Empty;
|
public string Identifier { get; set; } = string.Empty;
|
||||||
public List<PropertyEntity> Properties { get; set; } = new();
|
public List<PropertyEntity> Properties { get; set; } = [];
|
||||||
public List<PropertyGroupEntity> PropertyGroups { get; set; } = new();
|
public List<PropertyGroupEntity> PropertyGroups { get; set; } = [];
|
||||||
}
|
}
|
||||||
@ -4,9 +4,9 @@ internal class DeviceEntity
|
|||||||
{
|
{
|
||||||
public DeviceEntity()
|
public DeviceEntity()
|
||||||
{
|
{
|
||||||
InputIdentifiers = new List<DeviceInputIdentifierEntity>();
|
InputIdentifiers = [];
|
||||||
InputMappings = new List<InputMappingEntity>();
|
InputMappings = [];
|
||||||
Categories = new List<int>();
|
Categories = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Id { get; set; } = string.Empty;
|
public string Id { get; set; } = string.Empty;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ internal class M0023LayoutProviders : IStorageMigration
|
|||||||
public void Apply(LiteRepository repository)
|
public void Apply(LiteRepository repository)
|
||||||
{
|
{
|
||||||
ILiteCollection<BsonDocument> deviceEntities = repository.Database.GetCollection("DeviceEntity");
|
ILiteCollection<BsonDocument> deviceEntities = repository.Database.GetCollection("DeviceEntity");
|
||||||
List<BsonDocument> toUpdate = new();
|
List<BsonDocument> toUpdate = [];
|
||||||
|
|
||||||
foreach (BsonDocument bsonDocument in deviceEntities.FindAll())
|
foreach (BsonDocument bsonDocument in deviceEntities.FindAll())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ internal class M0024NodeProviders : IStorageMigration
|
|||||||
public void Apply(LiteRepository repository)
|
public void Apply(LiteRepository repository)
|
||||||
{
|
{
|
||||||
ILiteCollection<BsonDocument> categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
|
ILiteCollection<BsonDocument> categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
|
||||||
List<BsonDocument> categoriesToUpdate = new();
|
List<BsonDocument> categoriesToUpdate = [];
|
||||||
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
|
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
|
||||||
{
|
{
|
||||||
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
|
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
|
||||||
@ -24,7 +24,7 @@ internal class M0024NodeProviders : IStorageMigration
|
|||||||
categoryCollection.Update(categoriesToUpdate);
|
categoryCollection.Update(categoriesToUpdate);
|
||||||
|
|
||||||
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
||||||
List<BsonDocument> profilesToUpdate = new();
|
List<BsonDocument> profilesToUpdate = [];
|
||||||
foreach (BsonDocument profileBson in collection.FindAll())
|
foreach (BsonDocument profileBson in collection.FindAll())
|
||||||
{
|
{
|
||||||
BsonArray? folders = profileBson["Folders"]?.AsArray;
|
BsonArray? folders = profileBson["Folders"]?.AsArray;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ internal class M0025NodeProvidersProfileConfig : IStorageMigration
|
|||||||
public void Apply(LiteRepository repository)
|
public void Apply(LiteRepository repository)
|
||||||
{
|
{
|
||||||
ILiteCollection<BsonDocument> categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
|
ILiteCollection<BsonDocument> categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
|
||||||
List<BsonDocument> toUpdate = new();
|
List<BsonDocument> toUpdate = [];
|
||||||
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
|
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
|
||||||
{
|
{
|
||||||
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
|
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ internal class M0026NodeStorage : IStorageMigration
|
|||||||
public void Apply(LiteRepository repository)
|
public void Apply(LiteRepository repository)
|
||||||
{
|
{
|
||||||
ILiteCollection<BsonDocument> categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
|
ILiteCollection<BsonDocument> categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
|
||||||
List<BsonDocument> toUpdate = new();
|
List<BsonDocument> toUpdate = [];
|
||||||
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
|
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
|
||||||
{
|
{
|
||||||
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
|
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
|
||||||
@ -38,7 +38,7 @@ internal class M0026NodeStorage : IStorageMigration
|
|||||||
categoryCollection.Update(toUpdate);
|
categoryCollection.Update(toUpdate);
|
||||||
|
|
||||||
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
||||||
List<BsonDocument> profilesToUpdate = new();
|
List<BsonDocument> profilesToUpdate = [];
|
||||||
foreach (BsonDocument profileBson in collection.FindAll())
|
foreach (BsonDocument profileBson in collection.FindAll())
|
||||||
{
|
{
|
||||||
BsonArray? folders = profileBson["Folders"]?.AsArray;
|
BsonArray? folders = profileBson["Folders"]?.AsArray;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ internal class M0027Namespace : IStorageMigration
|
|||||||
public void Apply(LiteRepository repository)
|
public void Apply(LiteRepository repository)
|
||||||
{
|
{
|
||||||
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
ILiteCollection<BsonDocument> collection = repository.Database.GetCollection("ProfileEntity");
|
||||||
List<BsonDocument> profilesToUpdate = new();
|
List<BsonDocument> profilesToUpdate = [];
|
||||||
|
|
||||||
foreach (BsonDocument profileBson in collection.FindAll())
|
foreach (BsonDocument profileBson in collection.FindAll())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<PreserveCompilationContext>false</PreserveCompilationContext>
|
<PreserveCompilationContext>false</PreserveCompilationContext>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@ -8,7 +8,6 @@ using Artemis.Storage.Entities.Profile;
|
|||||||
using Artemis.Storage.Entities.Surface;
|
using Artemis.Storage.Entities.Surface;
|
||||||
using Artemis.Storage.Entities.Workshop;
|
using Artemis.Storage.Entities.Workshop;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
|
||||||
|
|
||||||
namespace Artemis.Storage;
|
namespace Artemis.Storage;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Artemis.Storage.Entities.Plugins;
|
namespace Artemis.Storage.Entities.Plugins;
|
||||||
@ -13,7 +12,7 @@ public class PluginEntity
|
|||||||
{
|
{
|
||||||
public PluginEntity()
|
public PluginEntity()
|
||||||
{
|
{
|
||||||
Features = new List<PluginFeatureEntity>();
|
Features = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public abstract class RenderElementEntity
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public Guid ParentId { get; set; }
|
public Guid ParentId { get; set; }
|
||||||
|
|
||||||
public List<LayerEffectEntity> LayerEffects { get; set; } = new();
|
public List<LayerEffectEntity> LayerEffects { get; set; } = [];
|
||||||
|
|
||||||
public IConditionEntity? DisplayCondition { get; set; }
|
public IConditionEntity? DisplayCondition { get; set; }
|
||||||
public TimelineEntity? Timeline { get; set; }
|
public TimelineEntity? Timeline { get; set; }
|
||||||
|
|||||||
@ -8,8 +8,8 @@ public class LayerEntity : RenderElementEntity
|
|||||||
{
|
{
|
||||||
public LayerEntity()
|
public LayerEntity()
|
||||||
{
|
{
|
||||||
Leds = new List<LedEntity>();
|
Leds = [];
|
||||||
AdaptionHints = new List<IAdaptionHintEntity>();
|
AdaptionHints = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
|||||||
@ -8,7 +8,7 @@ public class NodeEntity
|
|||||||
{
|
{
|
||||||
public NodeEntity()
|
public NodeEntity()
|
||||||
{
|
{
|
||||||
PinCollections = new List<NodePinCollectionEntity>();
|
PinCollections = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeEntity(NodeEntity nodeEntity)
|
public NodeEntity(NodeEntity nodeEntity)
|
||||||
|
|||||||
@ -6,8 +6,8 @@ public class NodeScriptEntity
|
|||||||
{
|
{
|
||||||
public NodeScriptEntity()
|
public NodeScriptEntity()
|
||||||
{
|
{
|
||||||
Nodes = new List<NodeEntity>();
|
Nodes = [];
|
||||||
Connections = new List<NodeConnectionEntity>();
|
Connections = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|||||||
@ -16,5 +16,5 @@ public class ProfileCategoryEntity
|
|||||||
public bool IsSuspended { get; set; }
|
public bool IsSuspended { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
|
||||||
public List<ProfileContainerEntity> ProfileConfigurations { get; set; } = new();
|
public List<ProfileContainerEntity> ProfileConfigurations { get; set; } = [];
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
public class ProfileContainerEntity
|
public class ProfileContainerEntity
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public byte[] Icon { get; set; } = Array.Empty<byte>();
|
public byte[] Icon { get; set; } = [];
|
||||||
|
|
||||||
public ProfileCategoryEntity ProfileCategory { get; set; } = null!;
|
public ProfileCategoryEntity ProfileCategory { get; set; } = null!;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Storage.Entities.General;
|
|
||||||
|
|
||||||
namespace Artemis.Storage.Entities.Profile;
|
namespace Artemis.Storage.Entities.Profile;
|
||||||
|
|
||||||
@ -9,8 +8,8 @@ public class ProfileEntity
|
|||||||
{
|
{
|
||||||
public ProfileEntity()
|
public ProfileEntity()
|
||||||
{
|
{
|
||||||
Folders = new List<FolderEntity>();
|
Folders = [];
|
||||||
Layers = new List<LayerEntity>();
|
Layers = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|||||||
@ -10,5 +10,5 @@ public class PropertyEntity
|
|||||||
public bool KeyframesEnabled { get; set; }
|
public bool KeyframesEnabled { get; set; }
|
||||||
|
|
||||||
public DataBindingEntity? DataBinding { get; set; }
|
public DataBindingEntity? DataBinding { get; set; }
|
||||||
public List<KeyframeEntity> KeyframeEntities { get; set; } = new();
|
public List<KeyframeEntity> KeyframeEntities { get; set; } = [];
|
||||||
}
|
}
|
||||||
@ -5,6 +5,6 @@ namespace Artemis.Storage.Entities.Profile;
|
|||||||
public class PropertyGroupEntity
|
public class PropertyGroupEntity
|
||||||
{
|
{
|
||||||
public string Identifier { get; set; } = string.Empty;
|
public string Identifier { get; set; } = string.Empty;
|
||||||
public List<PropertyEntity> Properties { get; set; } = new();
|
public List<PropertyEntity> Properties { get; set; } = [];
|
||||||
public List<PropertyGroupEntity> PropertyGroups { get; set; } = new();
|
public List<PropertyGroupEntity> PropertyGroups { get; set; } = [];
|
||||||
}
|
}
|
||||||
@ -7,9 +7,9 @@ public class DeviceEntity
|
|||||||
{
|
{
|
||||||
public DeviceEntity()
|
public DeviceEntity()
|
||||||
{
|
{
|
||||||
InputIdentifiers = new List<DeviceInputIdentifierEntity>();
|
InputIdentifiers = [];
|
||||||
InputMappings = new List<InputMappingEntity>();
|
InputMappings = [];
|
||||||
Categories = new List<int>();
|
Categories = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
[MaxLength(512)]
|
[MaxLength(512)]
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using System.Linq;
|
|||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Artemis.Storage.Entities;
|
using Artemis.Storage.Entities;
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
using Artemis.Storage.Exceptions;
|
|
||||||
using Artemis.Storage.Migrations;
|
using Artemis.Storage.Migrations;
|
||||||
using Artemis.Storage.Repositories.Interfaces;
|
using Artemis.Storage.Repositories.Interfaces;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.ReactiveUI;
|
using ReactiveUI.Avalonia;
|
||||||
using DryIoc;
|
using DryIoc;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class App : Application
|
|||||||
if (ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop || Design.IsDesignMode)
|
if (ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop || Design.IsDesignMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_applicationStateManager = new ApplicationStateManager(_container!, desktop.Args ?? Array.Empty<string>());
|
_applicationStateManager = new ApplicationStateManager(_container!, desktop.Args ?? []);
|
||||||
ArtemisBootstrapper.Initialize();
|
ArtemisBootstrapper.Initialize();
|
||||||
RegisterProviders();
|
RegisterProviders();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class ApplicationStateManager
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_windowService.ShowExceptionDialog("An unhandled exception occured", e);
|
_windowService.ShowExceptionDialog("An unhandled error occured", e);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ public class ApplicationStateManager
|
|||||||
|
|
||||||
private void UtilitiesOnRestartRequested(object? sender, RestartEventArgs e)
|
private void UtilitiesOnRestartRequested(object? sender, RestartEventArgs e)
|
||||||
{
|
{
|
||||||
List<string> argsList = new();
|
List<string> argsList = [];
|
||||||
argsList.AddRange(StartupArguments);
|
argsList.AddRange(StartupArguments);
|
||||||
if (e.ExtraArgs != null)
|
if (e.ExtraArgs != null)
|
||||||
argsList.AddRange(e.ExtraArgs.Except(argsList));
|
argsList.AddRange(e.ExtraArgs.Except(argsList));
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using System;
|
|||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.Storage;
|
using Artemis.Storage;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.ReactiveUI;
|
using ReactiveUI.Avalonia;
|
||||||
using DryIoc;
|
using DryIoc;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
|
|||||||
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