diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj
index 3ebf067a5..e61ffec1e 100644
--- a/src/Artemis.Core/Artemis.Core.csproj
+++ b/src/Artemis.Core/Artemis.Core.csproj
@@ -10,7 +10,6 @@
x64
true
ArtemisRGB.Core
- 1
enable
true
diff --git a/src/Artemis.Core/ColorScience/Quantization/ColorQuantizer.cs b/src/Artemis.Core/ColorScience/Quantization/ColorQuantizer.cs
index b2bf6f797..322ecdbea 100644
--- a/src/Artemis.Core/ColorScience/Quantization/ColorQuantizer.cs
+++ b/src/Artemis.Core/ColorScience/Quantization/ColorQuantizer.cs
@@ -151,19 +151,19 @@ public static class ColorQuantizer
{
SKColor[] colors = QuantizeSplit(bitmap.Pixels, 8);
ColorSwatch swatch = FindAllColorVariations(colors);
- SKColor[] swatchArray = new SKColor[]
- {
+ SKColor[] swatchArray =
+ [
swatch.Muted,
swatch.Vibrant,
swatch.DarkMuted,
swatch.DarkVibrant,
swatch.LightMuted,
swatch.LightVibrant
- };
+ ];
ColorSorter.Sort(swatchArray, SKColors.Black);
- ColorGradient gradient = new();
+ ColorGradient gradient = [];
for (int i = 0; i < swatchArray.Length; i++)
gradient.Add(new ColorGradientStop(swatchArray[i], (float)i / (swatchArray.Length - 1)));
diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs
index 5699dbac4..21e819b2d 100644
--- a/src/Artemis.Core/Constants.cs
+++ b/src/Artemis.Core/Constants.cs
@@ -70,13 +70,7 @@ public static class Constants
/// The full path to the Artemis user layouts folder
///
public static readonly string WorkshopFolder = Path.Combine(DataFolder, "workshop");
-
- ///
- /// The current API version for plugins
- ///
- public static readonly int PluginApiVersion = int.Parse(CoreAssembly.GetCustomAttributes().FirstOrDefault(a => a.Key == "PluginApiVersion")?.Value ??
- throw new InvalidOperationException("Cannot find PluginApiVersion metadata in assembly"));
-
+
///
/// The current version of the application
///
diff --git a/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs b/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs
index b108d81f1..7cd5476b7 100644
--- a/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs
+++ b/src/Artemis.Core/DefaultTypes/Properties/ColorGradientLayerProperty.cs
@@ -6,7 +6,7 @@ public class ColorGradientLayerProperty : LayerProperty
internal ColorGradientLayerProperty()
{
KeyframesSupported = false;
- DefaultValue = new ColorGradient();
+ DefaultValue = [];
}
///
diff --git a/src/Artemis.Core/DryIoc/ContainerExtensions.cs b/src/Artemis.Core/DryIoc/ContainerExtensions.cs
index eaa2282a8..46cf80a6a 100644
--- a/src/Artemis.Core/DryIoc/ContainerExtensions.cs
+++ b/src/Artemis.Core/DryIoc/ContainerExtensions.cs
@@ -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
if (plugin.Assembly != null && plugin.Assembly.GetTypes().Any(t => t.IsAssignableTo()))
- container.RegisterMany(new[] {plugin.Assembly}, type => type.IsAssignableTo(), Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Keep);
+ container.RegisterMany([plugin.Assembly], type => type.IsAssignableTo(), Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Keep);
}
private static bool HasAccessToProtectedService(Request request)
diff --git a/src/Artemis.Core/DryIoc/Factories/PluginSettingsFactory.cs b/src/Artemis.Core/DryIoc/Factories/PluginSettingsFactory.cs
index 7684b2b43..aa8d3564f 100644
--- a/src/Artemis.Core/DryIoc/Factories/PluginSettingsFactory.cs
+++ b/src/Artemis.Core/DryIoc/Factories/PluginSettingsFactory.cs
@@ -8,7 +8,7 @@ namespace Artemis.Core.DryIoc.Factories;
internal class PluginSettingsFactory : IPluginSettingsFactory
{
- private static readonly List PluginSettings = new();
+ private static readonly List PluginSettings = [];
private readonly IPluginManagementService _pluginManagementService;
private readonly IPluginRepository _pluginRepository;
diff --git a/src/Artemis.Core/Extensions/TypeExtensions.cs b/src/Artemis.Core/Extensions/TypeExtensions.cs
index 9e6ba83e3..2972c79ec 100644
--- a/src/Artemis.Core/Extensions/TypeExtensions.cs
+++ b/src/Artemis.Core/Extensions/TypeExtensions.cs
@@ -14,15 +14,15 @@ public static class TypeExtensions
{
private static readonly Dictionary> PrimitiveTypeConversions = new()
{
- {typeof(decimal), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)}},
- {typeof(double), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
- {typeof(float), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
- {typeof(ulong), new List {typeof(byte), typeof(ushort), typeof(uint), typeof(char)}},
- {typeof(long), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(char)}},
- {typeof(uint), new List {typeof(byte), typeof(ushort), typeof(char)}},
- {typeof(int), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(char)}},
- {typeof(ushort), new List {typeof(byte), typeof(char)}},
- {typeof(short), new List {typeof(byte)}}
+ {typeof(decimal), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)]},
+ {typeof(double), [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), [typeof(byte), typeof(ushort), typeof(uint), typeof(char)]},
+ {typeof(long), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(char)]},
+ {typeof(uint), [typeof(byte), typeof(ushort), typeof(char)]},
+ {typeof(int), [typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(char)]},
+ {typeof(ushort), [typeof(byte), typeof(char)]},
+ {typeof(short), [typeof(byte)]}
};
private static readonly Dictionary TypeKeywords = new()
diff --git a/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs b/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs
index a4ea63a11..d36a07a4c 100644
--- a/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs
+++ b/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs
@@ -14,7 +14,7 @@ namespace Artemis.Core;
public class ColorGradient : IList, IList, INotifyCollectionChanged
{
private static readonly SKColor[] FAST_LED_RAINBOW =
- {
+ [
new(0xFFFF0000), // Red
new(0xFFFF9900), // Orange
new(0xFFFFFF00), // Yellow
@@ -24,11 +24,11 @@ public class ColorGradient : IList, IList, INotifyCollectionC
new(0xFF9E22FF), // Purple
new(0xFFFF34AE), // Pink
new(0xFFFF0000) // and back to Red
- };
+ ];
private readonly List _stops;
- private SKColor[] _colors = Array.Empty();
- private float[] _positions = Array.Empty();
+ private SKColor[] _colors = [];
+ private float[] _positions = [];
private bool _dirty = true;
private bool _updating;
@@ -51,7 +51,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
///
public ColorGradient()
{
- _stops = new List();
+ _stops = [];
}
///
@@ -60,7 +60,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
/// The color gradient to copy
public ColorGradient(ColorGradient? colorGradient)
{
- _stops = new List();
+ _stops = [];
if (colorGradient == null)
return;
@@ -79,7 +79,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
/// The stops to copy
public ColorGradient(List stops)
{
- _stops = new List();
+ _stops = [];
foreach (ColorGradientStop colorGradientStop in stops)
{
ColorGradientStop stop = new(colorGradientStop.Color, colorGradientStop.Position);
@@ -104,7 +104,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
if (timesToRepeat == 0 && !seamless)
return Colors;
- List result = new();
+ List result = [];
if (timesToRepeat == 0)
result = this.Select(c => c.Color).ToList();
else
@@ -132,7 +132,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
if (timesToRepeat == 0 && seamless)
return Positions;
- List result = new();
+ List result = [];
if (timesToRepeat == 0)
{
result = this.Select(c => c.Position).ToList();
@@ -456,7 +456,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
///
public static ColorGradient GetUnicornBarf()
{
- ColorGradient gradient = new();
+ ColorGradient gradient = [];
for (int index = 0; index < FAST_LED_RAINBOW.Length; index++)
{
SKColor skColor = FAST_LED_RAINBOW[index];
@@ -473,7 +473,7 @@ public class ColorGradient : IList, IList, INotifyCollectionC
/// The amount of stops to add
public static ColorGradient GetRandom(int stops)
{
- ColorGradient gradient = new();
+ ColorGradient gradient = [];
gradient.Randomize(stops);
return gradient;
}
diff --git a/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs b/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs
index 826634d67..bbe50bdc1 100644
--- a/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs
+++ b/src/Artemis.Core/Models/Profile/Conditions/EventCondition.cs
@@ -34,7 +34,7 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
_entity = new EventConditionEntity();
_displayName = profileElement.GetType().Name;
_startNode = new EventConditionEventStartNode {X = -300};
- _script = new NodeScript($"Activate {_displayName}", $"Whether or not the event should activate the {_displayName}", ProfileElement.Profile, new List {_startNode});
+ _script = new NodeScript($"Activate {_displayName}", $"Whether or not the event should activate the {_displayName}", ProfileElement.Profile, [_startNode]);
}
internal EventCondition(EventConditionEntity entity, RenderProfileElement profileElement)
@@ -288,8 +288,8 @@ public class EventCondition : CorePropertyChanged, INodeScriptCondition
string name = $"Activate {_displayName}";
string description = $"Whether or not the event should activate the {_displayName}";
Script = _entity.Script != null
- ? new NodeScript(name, description, _entity.Script, ProfileElement.Profile, new List {_startNode})
- : new NodeScript(name, description, ProfileElement.Profile, new List {_startNode});
+ ? new NodeScript(name, description, _entity.Script, ProfileElement.Profile, [_startNode])
+ : new NodeScript(name, description, ProfileElement.Profile, [_startNode]);
}
///
diff --git a/src/Artemis.Core/Models/Profile/DataBindings/DataBinding.cs b/src/Artemis.Core/Models/Profile/DataBindings/DataBinding.cs
index 9bf8e94e6..1b1175a78 100644
--- a/src/Artemis.Core/Models/Profile/DataBindings/DataBinding.cs
+++ b/src/Artemis.Core/Models/Profile/DataBindings/DataBinding.cs
@@ -9,7 +9,7 @@ namespace Artemis.Core;
///
public class DataBinding : IDataBinding
{
- private readonly List _properties = new();
+ private readonly List _properties = [];
private bool _disposed;
private bool _isEnabled;
private DataBindingNodeScript _script;
diff --git a/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs b/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
index 8440e8016..62ebd93bb 100644
--- a/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
+++ b/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
@@ -27,7 +27,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
Path = "";
Entity = new DataModelPathEntity();
- _segments = new LinkedList();
+ _segments = [];
Save();
Initialize();
@@ -45,7 +45,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
Path = path ?? throw new ArgumentNullException(nameof(path));
Entity = new DataModelPathEntity();
- _segments = new LinkedList();
+ _segments = [];
Save();
Initialize();
@@ -65,7 +65,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
Path = dataModelPath.Path;
Entity = new DataModelPathEntity();
- _segments = new LinkedList();
+ _segments = [];
Save();
Initialize();
@@ -81,7 +81,7 @@ public class DataModelPath : IStorageModel, IDisposable, IPluginFeatureDependent
Path = entity.Path;
Entity = entity;
- _segments = new LinkedList();
+ _segments = [];
Load();
Initialize();
diff --git a/src/Artemis.Core/Models/Profile/DataModel/DataModelPathSegment.cs b/src/Artemis.Core/Models/Profile/DataModel/DataModelPathSegment.cs
index 464bbb58c..f1c71bd34 100644
--- a/src/Artemis.Core/Models/Profile/DataModel/DataModelPathSegment.cs
+++ b/src/Artemis.Core/Models/Profile/DataModel/DataModelPathSegment.cs
@@ -242,7 +242,7 @@ public class DataModelPathSegment : IDisposable
accessorExpression = Expression.Call(
expression,
nameof(DataModel.GetDynamicChildValue),
- _dynamicDataModelType != null ? new[] {_dynamicDataModelType} : null,
+ _dynamicDataModelType != null ? [_dynamicDataModelType] : null,
Expression.Constant(Identifier)
);
diff --git a/src/Artemis.Core/Models/Profile/Folder.cs b/src/Artemis.Core/Models/Profile/Folder.cs
index 99ea6f0e1..548931484 100644
--- a/src/Artemis.Core/Models/Profile/Folder.cs
+++ b/src/Artemis.Core/Models/Profile/Folder.cs
@@ -77,7 +77,7 @@ public sealed class Folder : RenderProfileElement
///
public override List GetAllLayerProperties()
{
- List result = new();
+ List result = [];
foreach (BaseLayerEffect layerEffect in LayerEffects)
{
if (layerEffect.BaseProperties != null)
diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs
index bed5609f5..88f605584 100644
--- a/src/Artemis.Core/Models/Profile/Layer.cs
+++ b/src/Artemis.Core/Models/Profile/Layer.cs
@@ -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_INIT_FAILED = "Failed to initialize layer brush";
- private readonly List _renderCopies = new();
+ private readonly List _renderCopies = [];
private LayerGeneralProperties _general = new();
private LayerTransformProperties _transform = new();
private BaseLayerBrush? _layerBrush;
private LayerShape? _layerShape;
- private List _leds = new();
- private List _missingLeds = new();
+ private List _leds = [];
+ private List _missingLeds = [];
///
/// Creates a new instance of the class and adds itself to the child collection of the provided
@@ -82,11 +82,11 @@ public sealed class Layer : RenderProfileElement
Parent = source;
// TODO: move to top
- _renderCopies = new List();
+ _renderCopies = [];
_general = new LayerGeneralProperties();
_transform = new LayerTransformProperties();
- _leds = new List();
+ _leds = [];
Leds = new ReadOnlyCollection(_leds);
Adapter = new LayerAdapter(this);
@@ -169,7 +169,7 @@ public sealed class Layer : RenderProfileElement
///
public override List GetAllLayerProperties()
{
- List result = new();
+ List result = [];
result.AddRange(General.GetAllLayerProperties());
result.AddRange(Transform.GetAllLayerProperties());
if (LayerBrush?.BaseProperties != null)
@@ -801,7 +801,7 @@ public sealed class Layer : RenderProfileElement
if (Disposed)
throw new ObjectDisposedException("Layer");
- List leds = new();
+ List leds = [];
// Get the surface LEDs for this layer
List availableLeds = devices.SelectMany(d => d.Leds).ToList();
diff --git a/src/Artemis.Core/Models/Profile/LayerAdapter.cs b/src/Artemis.Core/Models/Profile/LayerAdapter.cs
index 72b29719c..044291e13 100644
--- a/src/Artemis.Core/Models/Profile/LayerAdapter.cs
+++ b/src/Artemis.Core/Models/Profile/LayerAdapter.cs
@@ -17,7 +17,7 @@ public class LayerAdapter : IStorageModel
internal LayerAdapter(Layer layer)
{
- _adaptionHints = new List();
+ _adaptionHints = [];
Layer = layer;
AdaptionHints = new ReadOnlyCollection(_adaptionHints);
}
@@ -48,7 +48,7 @@ public class LayerAdapter : IStorageModel
else
{
List availableLeds = devices.SelectMany(d => d.Leds).ToList();
- List usedLeds = new();
+ List usedLeds = [];
foreach (LedEntity ledEntity in Layer.LayerEntity.Leds)
{
@@ -73,7 +73,7 @@ public class LayerAdapter : IStorageModel
///
public List DetermineHints(IEnumerable devices)
{
- List newHints = new();
+ List newHints = [];
if (devices.All(DoesLayerCoverDevice))
{
DeviceAdaptionHint hint = new() {DeviceType = RGBDeviceType.All};
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
index 85dcba517..bff1f32b6 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
@@ -44,7 +44,7 @@ public class LayerProperty : CorePropertyChanged, ILayerProperty
else
_baseValue = default!;
- _keyframes = new List>();
+ _keyframes = [];
Keyframes = new ReadOnlyCollection>(_keyframes);
}
diff --git a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
index 84de5c444..b8fc40c5c 100644
--- a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
+++ b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
@@ -32,8 +32,8 @@ public abstract class LayerPropertyGroup : IDisposable, IPluginFeatureDependent
GroupDescription = null!;
Path = "";
- _layerProperties = new List();
- _layerPropertyGroups = new List();
+ _layerProperties = [];
+ _layerPropertyGroups = [];
LayerProperties = new ReadOnlyCollection(_layerProperties);
LayerPropertyGroups = new ReadOnlyCollection(_layerPropertyGroups);
diff --git a/src/Artemis.Core/Models/Profile/Profile.cs b/src/Artemis.Core/Models/Profile/Profile.cs
index 187d9c423..c6db0e4f3 100644
--- a/src/Artemis.Core/Models/Profile/Profile.cs
+++ b/src/Artemis.Core/Models/Profile/Profile.cs
@@ -23,7 +23,7 @@ public sealed class Profile : ProfileElement
ProfileEntity = profileEntity;
EntityId = profileEntity.Id;
- Exceptions = new List();
+ Exceptions = [];
Load();
}
diff --git a/src/Artemis.Core/Models/Profile/ProfileElement.cs b/src/Artemis.Core/Models/Profile/ProfileElement.cs
index 921910db5..9e05db16f 100644
--- a/src/Artemis.Core/Models/Profile/ProfileElement.cs
+++ b/src/Artemis.Core/Models/Profile/ProfileElement.cs
@@ -22,7 +22,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
internal ProfileElement(Profile profile)
{
_profile = profile;
- ChildrenList = new List();
+ ChildrenList = [];
Children = new ReadOnlyCollection(ChildrenList);
}
@@ -280,7 +280,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
if (Disposed)
throw new ObjectDisposedException(GetType().Name);
- List elements = new();
+ List elements = [];
foreach (RenderProfileElement childElement in Children.Where(c => c is RenderProfileElement).Cast())
{
// Add all folders in this element
@@ -301,7 +301,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
if (Disposed)
throw new ObjectDisposedException(GetType().Name);
- List folders = new();
+ List folders = [];
foreach (Folder childFolder in Children.Where(c => c is Folder).Cast())
{
// Add all folders in this element
@@ -322,7 +322,7 @@ public abstract class ProfileElement : BreakableModel, IDisposable, IPluginFeatu
if (Disposed)
throw new ObjectDisposedException(GetType().Name);
- List layers = new();
+ List layers = [];
// Add all layers in this element
layers.AddRange(Children.Where(c => c is Layer).Cast());
diff --git a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
index 9a87edc67..5394a4c53 100644
--- a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
+++ b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
@@ -21,7 +21,7 @@ public abstract class RenderProfileElement : ProfileElement
internal RenderProfileElement(ProfileElement parent, Profile profile) : base(profile)
{
- _layerEffects = new List();
+ _layerEffects = [];
_displayCondition = new AlwaysOnCondition(this);
Timeline = new Timeline();
LayerEffects = new ReadOnlyCollection(_layerEffects);
diff --git a/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfigurationIcon.cs b/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfigurationIcon.cs
index c935836db..d1cff7a19 100644
--- a/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfigurationIcon.cs
+++ b/src/Artemis.Core/Models/ProfileConfiguration/ProfileConfigurationIcon.cs
@@ -130,7 +130,7 @@ public class ProfileConfigurationIcon : CorePropertyChanged, IStorageModel
_entity.ProfileConfiguration.IconType = (int) IconType;
_entity.ProfileConfiguration.MaterialIcon = IconType == ProfileConfigurationIconType.MaterialIcon ? IconName : null;
_entity.ProfileConfiguration.IconFill = Fill;
- _entity.Icon = IconBytes ?? Array.Empty();
+ _entity.Icon = IconBytes ?? [];
}
#endregion
diff --git a/src/Artemis.Core/Models/Surface/ArtemisDevice.cs b/src/Artemis.Core/Models/Surface/ArtemisDevice.cs
index 40482de47..3874d3469 100644
--- a/src/Artemis.Core/Models/Surface/ArtemisDevice.cs
+++ b/src/Artemis.Core/Models/Surface/ArtemisDevice.cs
@@ -43,9 +43,9 @@ public class ArtemisDevice : CorePropertyChanged
LedIds = new ReadOnlyDictionary(new Dictionary());
Leds = new ReadOnlyCollection(new List());
- InputIdentifiers = new List();
+ InputIdentifiers = [];
InputMappings = new Dictionary();
- Categories = new HashSet();
+ Categories = [];
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
RgbDevice.ColorCorrections.Clear();
@@ -72,9 +72,9 @@ public class ArtemisDevice : CorePropertyChanged
LedIds = new ReadOnlyDictionary(new Dictionary());
Leds = new ReadOnlyCollection(new List());
- InputIdentifiers = new List();
+ InputIdentifiers = [];
InputMappings = new Dictionary();
- Categories = new HashSet();
+ Categories = [];
LayoutSelection = new LayoutSelection {Type = DefaultLayoutProvider.LAYOUT_TYPE};
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
diff --git a/src/Artemis.Core/Models/Surface/Layout/ArtemisLayout.cs b/src/Artemis.Core/Models/Surface/Layout/ArtemisLayout.cs
index 44ddbf082..20309d906 100644
--- a/src/Artemis.Core/Models/Surface/Layout/ArtemisLayout.cs
+++ b/src/Artemis.Core/Models/Surface/Layout/ArtemisLayout.cs
@@ -21,7 +21,7 @@ public class ArtemisLayout
public ArtemisLayout(string filePath)
{
FilePath = filePath;
- Leds = new List();
+ Leds = [];
IsDefaultLayout = filePath.StartsWith(DefaultLayoutPath);
LoadLayout();
@@ -70,7 +70,7 @@ public class ArtemisLayout
device.Size = new Size(MathF.Round(RgbLayout.Width), MathF.Round(RgbLayout.Height));
device.DeviceInfo.LayoutMetadata = RgbLayout.CustomData;
- HashSet ledIds = new();
+ HashSet ledIds = [];
foreach (ILedLayout layoutLed in RgbLayout.Leds)
{
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
diff --git a/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs b/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs
index 5ef30246c..fce7eb3b2 100644
--- a/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs
+++ b/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs
@@ -16,7 +16,7 @@ public abstract class LayerBrushProvider : PluginFeature
///
protected LayerBrushProvider()
{
- _layerBrushDescriptors = new List();
+ _layerBrushDescriptors = [];
LayerBrushDescriptors = new ReadOnlyCollection(_layerBrushDescriptors);
Disabled += OnDisabled;
}
diff --git a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs
index 4c307acd3..95b2c055b 100644
--- a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs
+++ b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs
@@ -16,7 +16,7 @@ public abstract class LayerEffectProvider : PluginFeature
///
protected LayerEffectProvider()
{
- _layerEffectDescriptors = new List();
+ _layerEffectDescriptors = [];
LayerEffectDescriptors = new ReadOnlyCollection(_layerEffectDescriptors);
Disabled += OnDisabled;
}
diff --git a/src/Artemis.Core/Plugins/Modules/DataModel.cs b/src/Artemis.Core/Plugins/Modules/DataModel.cs
index 1bdf68094..2d82d8037 100644
--- a/src/Artemis.Core/Plugins/Modules/DataModel.cs
+++ b/src/Artemis.Core/Plugins/Modules/DataModel.cs
@@ -15,7 +15,7 @@ namespace Artemis.Core.Modules;
public abstract class DataModel
{
private const StringComparison PathsStringComparison = StringComparison.OrdinalIgnoreCase;
- private readonly List _activePaths = new();
+ private readonly List _activePaths = [];
private readonly HashSet _activePathsHashSet = new(StringComparer.FromComparison(PathsStringComparison));
private readonly Dictionary _dynamicChildren = new();
diff --git a/src/Artemis.Core/Plugins/Modules/Module.cs b/src/Artemis.Core/Plugins/Modules/Module.cs
index 94f73228b..4526090e0 100644
--- a/src/Artemis.Core/Plugins/Modules/Module.cs
+++ b/src/Artemis.Core/Plugins/Modules/Module.cs
@@ -111,13 +111,13 @@ public abstract class Module : Module where T : DataModel, new()
///
public abstract class Module : PluginFeature
{
- private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new();
- private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
+ private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = [];
+ private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = [];
///
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
///
- protected internal readonly List HiddenPropertiesList = new();
+ protected internal readonly List HiddenPropertiesList = [];
///
/// The base constructor of the class.
diff --git a/src/Artemis.Core/Plugins/Nodes/NodeProvider.cs b/src/Artemis.Core/Plugins/Nodes/NodeProvider.cs
index 24506297e..a60469a05 100644
--- a/src/Artemis.Core/Plugins/Nodes/NodeProvider.cs
+++ b/src/Artemis.Core/Plugins/Nodes/NodeProvider.cs
@@ -18,7 +18,7 @@ public abstract class NodeProvider : PluginFeature
///
public NodeProvider()
{
- _nodeDescriptors = new List();
+ _nodeDescriptors = [];
NodeDescriptors = new ReadOnlyCollection(_nodeDescriptors);
Disabled += OnDisabled;
}
diff --git a/src/Artemis.Core/Plugins/Plugin.cs b/src/Artemis.Core/Plugins/Plugin.cs
index 6f2d2b4d4..9b6e3a644 100644
--- a/src/Artemis.Core/Plugins/Plugin.cs
+++ b/src/Artemis.Core/Plugins/Plugin.cs
@@ -31,8 +31,8 @@ public class Plugin : CorePropertyChanged, IDisposable
Info.Plugin = this;
_loadedFromStorage = loadedFromStorage;
- _features = new List();
- _profilers = new List();
+ _features = [];
+ _profilers = [];
Features = new ReadOnlyCollection(_features);
Profilers = new ReadOnlyCollection(_profilers);
diff --git a/src/Artemis.Core/Plugins/PluginFeatureInfo.cs b/src/Artemis.Core/Plugins/PluginFeatureInfo.cs
index 77cfb84e7..56a836fda 100644
--- a/src/Artemis.Core/Plugins/PluginFeatureInfo.cs
+++ b/src/Artemis.Core/Plugins/PluginFeatureInfo.cs
@@ -78,7 +78,7 @@ public class PluginFeatureInfo : IPrerequisitesSubject
public PluginFeature? Instance { get; internal set; }
///
- public List Prerequisites { get; } = new();
+ public List Prerequisites { get; } = [];
///
public IEnumerable PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
diff --git a/src/Artemis.Core/Plugins/PluginInfo.cs b/src/Artemis.Core/Plugins/PluginInfo.cs
index 5f668f506..279ea6c43 100644
--- a/src/Artemis.Core/Plugins/PluginInfo.cs
+++ b/src/Artemis.Core/Plugins/PluginInfo.cs
@@ -109,13 +109,7 @@ public class PluginInfo : IPrerequisitesSubject
///
[JsonInclude]
public PluginPlatform? Platforms { get; internal init; }
-
- ///
- /// Gets the API version the plugin was built for
- ///
- [JsonInclude]
- public Version? Api { get; internal init; } = new(1, 0, 0);
-
+
///
/// Gets the minimum version of Artemis required by this plugin
///
@@ -125,27 +119,33 @@ public class PluginInfo : IPrerequisitesSubject
/// Gets the plugin this info is associated with
///
[JsonIgnore]
- public Plugin Plugin { get; internal set; } = null!;
+ public Plugin? Plugin { get; internal set; }
///
/// Gets a string representing either a full path pointing to an svg or the markdown icon
///
[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;
///
/// Gets a boolean indicating whether this plugin is compatible with the current operating system and API version
///
[JsonIgnore]
- public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && Api != null && Api.Major >= Constants.PluginApiVersion && MatchesMinimumVersion();
+ public bool IsCompatible => Platforms.MatchesCurrentOperatingSystem() && MatchesMinimumVersion();
///
[JsonIgnore]
- public List Prerequisites { get; } = new();
+ public List Prerequisites { get; } = [];
///
[JsonIgnore]
public IEnumerable PlatformPrerequisites => Prerequisites.Where(p => p.AppliesToPlatform());
+
+ ///
+ /// Gets the exception thrown while loading
+ ///
+ [JsonIgnore]
+ public Exception? LoadException { get; internal set; }
[JsonIgnore]
internal string PreferredPluginDirectory => $"{Main.Split(".dll")[0].Replace("/", "").Replace("\\", "")}-{Guid.ToString().Substring(0, 8)}";
diff --git a/src/Artemis.Core/Services/Core/SurfaceManager.cs b/src/Artemis.Core/Services/Core/SurfaceManager.cs
index 7fb7a044c..31c6b697d 100644
--- a/src/Artemis.Core/Services/Core/SurfaceManager.cs
+++ b/src/Artemis.Core/Services/Core/SurfaceManager.cs
@@ -14,7 +14,7 @@ internal sealed class SurfaceManager : IDisposable
{
private readonly IRenderer _renderer;
private readonly TimerUpdateTrigger _updateTrigger;
- private readonly List _devices = new();
+ private readonly List _devices = [];
private readonly SKTextureBrush _textureBrush = new(null) {CalculationMode = RenderMode.Absolute};
private ListLedGroup? _surfaceLedGroup;
@@ -44,7 +44,7 @@ internal sealed class SurfaceManager : IDisposable
public void AddDevices(IEnumerable devices)
{
- List newDevices = new();
+ List newDevices = [];
lock (_devices)
{
foreach (ArtemisDevice artemisDevice in devices)
@@ -66,7 +66,7 @@ internal sealed class SurfaceManager : IDisposable
public void RemoveDevices(IEnumerable devices)
{
- List removedDevices = new();
+ List removedDevices = [];
lock (_devices)
{
foreach (ArtemisDevice artemisDevice in devices)
diff --git a/src/Artemis.Core/Services/Input/InputService.cs b/src/Artemis.Core/Services/Input/InputService.cs
index 179c6641d..abf0487d9 100644
--- a/src/Artemis.Core/Services/Input/InputService.cs
+++ b/src/Artemis.Core/Services/Input/InputService.cs
@@ -100,7 +100,7 @@ internal class InputService : IInputService
#region Providers
- private readonly List _inputProviders = new();
+ private readonly List _inputProviders = [];
public KeyboardToggleStatus KeyboardToggleStatus { get; private set; } = new(false, false, false);
@@ -137,7 +137,7 @@ internal class InputService : IInputService
#region Identification
private readonly Dictionary, ArtemisDevice> _deviceCache = new();
- private List _devices = new();
+ private List _devices = [];
private ArtemisDevice? _identifyingDevice;
public void IdentifyDevice(ArtemisDevice device)
@@ -308,7 +308,7 @@ internal class InputService : IInputService
if (device != null)
{
// Ensure the device is in the dictionary
- _pressedKeys.TryAdd(device, new HashSet());
+ _pressedKeys.TryAdd(device, []);
// Get the hash set of the device
HashSet pressedDeviceKeys = _pressedKeys[device];
// See if the key is already pressed
@@ -389,7 +389,7 @@ internal class InputService : IInputService
#region Mouse
- private readonly HashSet _pressedButtons = new();
+ private readonly HashSet _pressedButtons = [];
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
diff --git a/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs b/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs
index b6017a5c6..c861d491f 100644
--- a/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs
+++ b/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs
@@ -21,12 +21,12 @@ public interface IPluginManagementService : IArtemisService, IDisposable
/// Indicates whether or not plugins are currently being loaded
///
bool LoadingPlugins { get; }
-
+
///
/// Indicates whether or not plugins are currently loaded
///
bool LoadedPlugins { get; }
-
+
///
/// Loads all installed plugins. If plugins already loaded this will reload them all
///
@@ -108,7 +108,13 @@ public interface IPluginManagementService : IArtemisService, IDisposable
void DisablePluginFeature(PluginFeature pluginFeature, bool saveState);
///
- /// Gets the plugin info of all loaded plugins
+ /// Gets the plugin info of all plugins, regardless of whether they are currently loaded
+ ///
+ /// A list containing all the plugin info
+ List GetAllPluginInfo();
+
+ ///
+ /// Returns a list of all loaded plugins
///
/// A list containing all the plugin info
List GetAllPlugins();
@@ -149,7 +155,7 @@ public interface IPluginManagementService : IArtemisService, IDisposable
///
///
DeviceProvider GetDeviceProviderByDevice(IRGBDevice device);
-
+
///
/// Occurs when a plugin has started loading
///
@@ -183,7 +189,7 @@ public interface IPluginManagementService : IArtemisService, IDisposable
///
/// Occurs when a plugin is removed
///
- event EventHandler PluginRemoved;
+ event EventHandler PluginRemoved;
///
/// Occurs when a plugin feature is being enabled
diff --git a/src/Artemis.Core/Services/PluginManagementService.cs b/src/Artemis.Core/Services/PluginManagementService.cs
index d0827b7cd..d1e2d7245 100644
--- a/src/Artemis.Core/Services/PluginManagementService.cs
+++ b/src/Artemis.Core/Services/PluginManagementService.cs
@@ -28,6 +28,7 @@ internal class PluginManagementService : IPluginManagementService
private readonly IContainer _container;
private readonly ILogger _logger;
private readonly IPluginRepository _pluginRepository;
+ private readonly List _pluginInfos;
private readonly List _plugins;
private FileSystemWatcher? _hotReloadWatcher;
private bool _disposed;
@@ -39,20 +40,29 @@ internal class PluginManagementService : IPluginManagementService
_logger = logger;
_pluginRepository = pluginRepository;
_deviceRepository = deviceRepository;
- _plugins = new List();
+ _pluginInfos = [];
+ _plugins = [];
}
- public List AdditionalPluginDirectories { get; } = new();
+ public List AdditionalPluginDirectories { get; } = [];
public bool LoadingPlugins { get; private set; }
public bool LoadedPlugins { get; private set; }
+ public List GetAllPluginInfo()
+ {
+ lock (_pluginInfos)
+ {
+ return [.._pluginInfos];
+ }
+ }
+
public List GetAllPlugins()
{
lock (_plugins)
{
- return new List(_plugins);
+ return [.._plugins];
}
}
@@ -263,6 +273,13 @@ internal class PluginManagementService : IPluginManagementService
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");
}
+
+ // 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
PluginEntity? entity = _pluginRepository.GetPluginByPluginGuid(pluginInfo.Guid);
@@ -301,6 +318,7 @@ internal class PluginManagementService : IPluginManagementService
}
catch (Exception e)
{
+ pluginInfo.LoadException = e;
throw new ArtemisPluginException(plugin, "Failed to load the plugins assembly", e);
}
@@ -312,6 +330,7 @@ internal class PluginManagementService : IPluginManagementService
}
catch (ReflectionTypeLoadException e)
{
+ pluginInfo.LoadException = e;
throw new ArtemisPluginException(
plugin,
"Failed to initialize the plugin assembly",
@@ -471,6 +490,10 @@ internal class PluginManagementService : IPluginManagementService
}
plugin.Dispose();
+ lock (_pluginInfos)
+ {
+ _pluginInfos.Remove(plugin.Info);
+ }
lock (_plugins)
{
_plugins.Remove(plugin);
diff --git a/src/Artemis.Core/Services/ProcessMonitoring/ProcessMonitor.cs b/src/Artemis.Core/Services/ProcessMonitoring/ProcessMonitor.cs
index aa0cf8d5b..69e0c38b3 100644
--- a/src/Artemis.Core/Services/ProcessMonitoring/ProcessMonitor.cs
+++ b/src/Artemis.Core/Services/ProcessMonitoring/ProcessMonitor.cs
@@ -28,7 +28,7 @@ public static partial class ProcessMonitor
get
{
lock (LOCK)
- return _processes.Values.ToImmutableArray();
+ return [.._processes.Values];
}
}
diff --git a/src/Artemis.Core/Services/RenderService.cs b/src/Artemis.Core/Services/RenderService.cs
index 25c6e6185..bf2138dcb 100644
--- a/src/Artemis.Core/Services/RenderService.cs
+++ b/src/Artemis.Core/Services/RenderService.cs
@@ -15,7 +15,7 @@ namespace Artemis.Core.Services;
internal class RenderService : IRenderService, IRenderer, IDisposable
{
private readonly Stopwatch _frameStopWatch;
- private readonly List _updateExceptions = new();
+ private readonly List _updateExceptions = [];
private readonly ILogger _logger;
private readonly IDeviceService _deviceService;
diff --git a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs
index 24cf3ba1d..1d29bc531 100644
--- a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs
+++ b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs
@@ -8,8 +8,8 @@ internal class SurfaceArrangement
{
public SurfaceArrangement()
{
- Types = new List();
- ArrangedDevices = new List();
+ Types = [];
+ ArrangedDevices = [];
}
public List Types { get; }
diff --git a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs
index d855b720b..b2a3e24d8 100644
--- a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs
+++ b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs
@@ -12,7 +12,7 @@ internal class SurfaceArrangementType
SurfaceArrangement = surfaceArrangement;
DeviceType = deviceType;
ZIndex = zIndex;
- Configurations = new List();
+ Configurations = [];
}
public SurfaceArrangement SurfaceArrangement { get; }
diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs
index 2c87b52ff..a712c4ae7 100644
--- a/src/Artemis.Core/Services/Storage/ProfileService.cs
+++ b/src/Artemis.Core/Services/Storage/ProfileService.cs
@@ -23,9 +23,9 @@ internal class ProfileService : IProfileService
private readonly IProfileRepository _profileRepository;
private readonly IPluginManagementService _pluginManagementService;
private readonly IDeviceService _deviceService;
- private readonly List _pendingKeyboardEvents = new();
- private readonly List _renderExceptions = new();
- private readonly List _updateExceptions = new();
+ private readonly List _pendingKeyboardEvents = [];
+ private readonly List _renderExceptions = [];
+ private readonly List _updateExceptions = [];
private DateTime _lastRenderExceptionLog;
private DateTime _lastUpdateExceptionLog;
diff --git a/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs b/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs
index 9da53c1c8..62914222b 100644
--- a/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs
+++ b/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs
@@ -55,7 +55,7 @@ public abstract class PluginEndPoint
public FlexibleContentType Returns { get; protected set; }
///
- /// Occurs whenever a request threw an unhandled exception
+ /// Occurs whenever a request threw an Unhandled error
///
public event EventHandler? RequestException;
diff --git a/src/Artemis.Core/Services/WebServer/WebServerService.cs b/src/Artemis.Core/Services/WebServer/WebServerService.cs
index 24f851e83..c57d0bb52 100644
--- a/src/Artemis.Core/Services/WebServer/WebServerService.cs
+++ b/src/Artemis.Core/Services/WebServer/WebServerService.cs
@@ -42,7 +42,7 @@ internal class WebServerService : IWebServerService, IDisposable
{
_logger = logger;
_coreService = coreService;
- _controllers = new List();
+ _controllers = [];
_webServerEnabledSetting = settingsService.GetSetting("WebServer.Enabled", true);
_webServerRemoteAccessSetting = settingsService.GetSetting("WebServer.RemoteAccess", false);
diff --git a/src/Artemis.Core/Stores/DataModelStore.cs b/src/Artemis.Core/Stores/DataModelStore.cs
index 9bce76bd3..13a5b6260 100644
--- a/src/Artemis.Core/Stores/DataModelStore.cs
+++ b/src/Artemis.Core/Stores/DataModelStore.cs
@@ -7,7 +7,7 @@ namespace Artemis.Core;
internal class DataModelStore
{
- private static readonly List Registrations = new();
+ private static readonly List Registrations = [];
public static DataModelRegistration Add(DataModel dataModel)
{
@@ -43,7 +43,7 @@ internal class DataModelStore
{
lock (Registrations)
{
- return new List(Registrations);
+ return [..Registrations];
}
}
diff --git a/src/Artemis.Core/Stores/LayerBrushStore.cs b/src/Artemis.Core/Stores/LayerBrushStore.cs
index 0828c2b9a..20a26ffe0 100644
--- a/src/Artemis.Core/Stores/LayerBrushStore.cs
+++ b/src/Artemis.Core/Stores/LayerBrushStore.cs
@@ -7,7 +7,7 @@ namespace Artemis.Core;
internal class LayerBrushStore
{
- private static readonly List Registrations = new();
+ private static readonly List Registrations = [];
public static LayerBrushRegistration Add(LayerBrushDescriptor descriptor)
{
@@ -43,7 +43,7 @@ internal class LayerBrushStore
{
lock (Registrations)
{
- return new List(Registrations);
+ return [..Registrations];
}
}
diff --git a/src/Artemis.Core/Stores/LayerEffectStore.cs b/src/Artemis.Core/Stores/LayerEffectStore.cs
index 5656ec894..cd170e105 100644
--- a/src/Artemis.Core/Stores/LayerEffectStore.cs
+++ b/src/Artemis.Core/Stores/LayerEffectStore.cs
@@ -7,7 +7,7 @@ namespace Artemis.Core;
internal class LayerEffectStore
{
- private static readonly List Registrations = new();
+ private static readonly List Registrations = [];
public static LayerEffectRegistration Add(LayerEffectDescriptor descriptor)
{
@@ -43,7 +43,7 @@ internal class LayerEffectStore
{
lock (Registrations)
{
- return new List(Registrations);
+ return [..Registrations];
}
}
diff --git a/src/Artemis.Core/Stores/LogStore.cs b/src/Artemis.Core/Stores/LogStore.cs
index a4a3e66ed..f2ac53628 100644
--- a/src/Artemis.Core/Stores/LogStore.cs
+++ b/src/Artemis.Core/Stores/LogStore.cs
@@ -12,7 +12,7 @@ public static class LogStore
{
private static readonly object _lock = new();
- private static readonly LinkedList LinkedList = new();
+ private static readonly LinkedList LinkedList = [];
///
/// Gets a list containing the last 500 log events.
diff --git a/src/Artemis.Core/Stores/NodeTypeStore.cs b/src/Artemis.Core/Stores/NodeTypeStore.cs
index 05c31519b..6f5a071a2 100644
--- a/src/Artemis.Core/Stores/NodeTypeStore.cs
+++ b/src/Artemis.Core/Stores/NodeTypeStore.cs
@@ -8,8 +8,8 @@ namespace Artemis.Core;
internal class NodeTypeStore
{
- private static readonly List Registrations = new();
- private static readonly List ColorRegistrations = new();
+ private static readonly List Registrations = [];
+ private static readonly List ColorRegistrations = [];
public static NodeTypeRegistration Add(NodeData nodeData)
{
@@ -85,7 +85,7 @@ internal class NodeTypeStore
{
lock (ColorRegistrations)
{
- return new List(ColorRegistrations);
+ return [..ColorRegistrations];
}
}
diff --git a/src/Artemis.Core/VisualScripting/Extensions/NodeExtension.cs b/src/Artemis.Core/VisualScripting/Extensions/NodeExtension.cs
index 8d6d8424d..9e074497a 100644
--- a/src/Artemis.Core/VisualScripting/Extensions/NodeExtension.cs
+++ b/src/Artemis.Core/VisualScripting/Extensions/NodeExtension.cs
@@ -48,7 +48,7 @@ public static class NodeExtension
/// if there would be a loop; otherwise .
public static bool IsInLoop(this INode node, INode pendingConnection)
{
- HashSet checkedNodes = new();
+ HashSet checkedNodes = [];
bool CheckNode(INode checkNode, INode? pending)
{
diff --git a/src/Artemis.Core/VisualScripting/NodeScript.cs b/src/Artemis.Core/VisualScripting/NodeScript.cs
index edf08cdb0..7864300d0 100644
--- a/src/Artemis.Core/VisualScripting/NodeScript.cs
+++ b/src/Artemis.Core/VisualScripting/NodeScript.cs
@@ -46,7 +46,7 @@ public abstract class NodeScript : CorePropertyChanged, INodeScript
///
public string Description { get; }
- private readonly List _nodes = new();
+ private readonly List _nodes = [];
///
public IEnumerable Nodes => new ReadOnlyCollection(_nodes);
diff --git a/src/Artemis.Core/VisualScripting/Nodes/Node.cs b/src/Artemis.Core/VisualScripting/Nodes/Node.cs
index 97254c03d..90ca8da13 100644
--- a/src/Artemis.Core/VisualScripting/Nodes/Node.cs
+++ b/src/Artemis.Core/VisualScripting/Nodes/Node.cs
@@ -28,8 +28,8 @@ public abstract class Node : BreakableModel, INode
#region Properties & Fields
- private readonly List _outputPinBucket = new();
- private readonly List _inputPinBucket = new();
+ private readonly List _outputPinBucket = [];
+ private readonly List _inputPinBucket = [];
private Guid _id;
@@ -95,12 +95,12 @@ public abstract class Node : BreakableModel, INode
///
public bool IsLoading { get; set; }
- private readonly List _pins = new();
+ private readonly List _pins = [];
///
public IReadOnlyCollection Pins => new ReadOnlyCollection(_pins);
- private readonly List _pinCollections = new();
+ private readonly List _pinCollections = [];
private string _helpUrl;
///
diff --git a/src/Artemis.Core/VisualScripting/Nodes/NodeTStorageTViewModel.cs b/src/Artemis.Core/VisualScripting/Nodes/NodeTStorageTViewModel.cs
index 79e858644..5f8eedaee 100644
--- a/src/Artemis.Core/VisualScripting/Nodes/NodeTStorageTViewModel.cs
+++ b/src/Artemis.Core/VisualScripting/Nodes/NodeTStorageTViewModel.cs
@@ -27,7 +27,7 @@ public abstract class Node : Node, ICustomViewMo
{
if (NodeData == null)
throw new ArtemisCoreException("Nodes without node data (default nodes or exit nodes) cannot have custom view models");
- return NodeData.Provider.Plugin.Container.Resolve(args: new object[] {this, nodeScript});
+ return NodeData.Provider.Plugin.Container.Resolve(args: [this, nodeScript]);
}
///
diff --git a/src/Artemis.Core/VisualScripting/Pins/Pin.cs b/src/Artemis.Core/VisualScripting/Pins/Pin.cs
index 742e0e4b7..f82799e2c 100644
--- a/src/Artemis.Core/VisualScripting/Pins/Pin.cs
+++ b/src/Artemis.Core/VisualScripting/Pins/Pin.cs
@@ -60,7 +60,7 @@ public abstract class Pin : CorePropertyChanged, IPin
protected set => SetAndNotify(ref _isNumeric, value);
}
- private readonly List _connectedTo = new();
+ private readonly List _connectedTo = [];
private string _name;
///
diff --git a/src/Artemis.Core/VisualScripting/Pins/PinCollection.cs b/src/Artemis.Core/VisualScripting/Pins/PinCollection.cs
index d2ea74a69..801270b90 100644
--- a/src/Artemis.Core/VisualScripting/Pins/PinCollection.cs
+++ b/src/Artemis.Core/VisualScripting/Pins/PinCollection.cs
@@ -45,7 +45,7 @@ public abstract class PinCollection : CorePropertyChanged, IPinCollection
///
public abstract Type Type { get; }
- private readonly List _pins = new();
+ private readonly List _pins = [];
///
/// Gets a read only observable collection of the pins
diff --git a/src/Artemis.Storage.Legacy/Entities/Plugins/PluginEntity.cs b/src/Artemis.Storage.Legacy/Entities/Plugins/PluginEntity.cs
index 47e2ba74b..3e25cc64e 100644
--- a/src/Artemis.Storage.Legacy/Entities/Plugins/PluginEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Plugins/PluginEntity.cs
@@ -7,7 +7,7 @@ internal class PluginEntity
{
public PluginEntity()
{
- Features = new List();
+ Features = [];
}
public Guid Id { get; set; }
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/Abstract/RenderElementEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/Abstract/RenderElementEntity.cs
index 56b4e97fd..028cac090 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/Abstract/RenderElementEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/Abstract/RenderElementEntity.cs
@@ -7,7 +7,7 @@ internal abstract class RenderElementEntity
public Guid Id { get; set; }
public Guid ParentId { get; set; }
- public List LayerEffects { get; set; } = new();
+ public List LayerEffects { get; set; } = [];
public IConditionEntity? DisplayCondition { get; set; }
public TimelineEntity? Timeline { get; set; }
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/LayerEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/LayerEntity.cs
index d00a62c20..d4ddf7696 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/LayerEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/LayerEntity.cs
@@ -8,8 +8,8 @@ internal class LayerEntity : RenderElementEntity
{
public LayerEntity()
{
- Leds = new List();
- AdaptionHints = new List();
+ Leds = [];
+ AdaptionHints = [];
}
public int Order { get; set; }
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeEntity.cs
index 314964430..1aa4e2ef7 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeEntity.cs
@@ -4,7 +4,7 @@ internal class NodeEntity
{
public NodeEntity()
{
- PinCollections = new List();
+ PinCollections = [];
}
public NodeEntity(NodeEntity nodeEntity)
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeScriptEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeScriptEntity.cs
index 8da434571..1b2ce986a 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeScriptEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/Nodes/NodeScriptEntity.cs
@@ -4,8 +4,8 @@ internal class NodeScriptEntity
{
public NodeScriptEntity()
{
- Nodes = new List();
- Connections = new List();
+ Nodes = [];
+ Connections = [];
}
public string Name { get; set; } = string.Empty;
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/ProfileCategoryEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/ProfileCategoryEntity.cs
index c5b61012b..6a24d666e 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/ProfileCategoryEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/ProfileCategoryEntity.cs
@@ -14,7 +14,7 @@ internal class ProfileCategoryEntity
public bool IsSuspended { get; set; }
public int Order { get; set; }
- public List ProfileConfigurations { get; set; } = new();
+ public List ProfileConfigurations { get; set; } = [];
public Storage.Entities.Profile.ProfileCategoryEntity Migrate(ILogger logger, List legacyProfiles, ILiteStorage profileIcons)
{
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/ProfileEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/ProfileEntity.cs
index dbbbfee9d..bd7b3d46a 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/ProfileEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/ProfileEntity.cs
@@ -6,9 +6,9 @@ internal class ProfileEntity
{
public ProfileEntity()
{
- Folders = new List();
- Layers = new List();
- ScriptConfigurations = new List();
+ Folders = [];
+ Layers = [];
+ ScriptConfigurations = [];
}
public Guid Id { get; set; }
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/PropertyEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/PropertyEntity.cs
index 44a4406ab..c9f9c42cf 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/PropertyEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/PropertyEntity.cs
@@ -9,5 +9,5 @@ internal class PropertyEntity
public bool KeyframesEnabled { get; set; }
public DataBindingEntity? DataBinding { get; set; }
- public List KeyframeEntities { get; set; } = new();
+ public List KeyframeEntities { get; set; } = [];
}
\ No newline at end of file
diff --git a/src/Artemis.Storage.Legacy/Entities/Profile/PropertyGroupEntity.cs b/src/Artemis.Storage.Legacy/Entities/Profile/PropertyGroupEntity.cs
index 2c7f316bb..e32e895d4 100644
--- a/src/Artemis.Storage.Legacy/Entities/Profile/PropertyGroupEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Profile/PropertyGroupEntity.cs
@@ -3,6 +3,6 @@
internal class PropertyGroupEntity
{
public string Identifier { get; set; } = string.Empty;
- public List Properties { get; set; } = new();
- public List PropertyGroups { get; set; } = new();
+ public List Properties { get; set; } = [];
+ public List PropertyGroups { get; set; } = [];
}
\ No newline at end of file
diff --git a/src/Artemis.Storage.Legacy/Entities/Surface/DeviceEntity.cs b/src/Artemis.Storage.Legacy/Entities/Surface/DeviceEntity.cs
index fc3988dba..43b9f85f6 100644
--- a/src/Artemis.Storage.Legacy/Entities/Surface/DeviceEntity.cs
+++ b/src/Artemis.Storage.Legacy/Entities/Surface/DeviceEntity.cs
@@ -4,9 +4,9 @@ internal class DeviceEntity
{
public DeviceEntity()
{
- InputIdentifiers = new List();
- InputMappings = new List();
- Categories = new List();
+ InputIdentifiers = [];
+ InputMappings = [];
+ Categories = [];
}
public string Id { get; set; } = string.Empty;
diff --git a/src/Artemis.Storage.Legacy/Migrations/Storage/M0023LayoutProviders.cs b/src/Artemis.Storage.Legacy/Migrations/Storage/M0023LayoutProviders.cs
index 1a8d7500b..4668200d7 100644
--- a/src/Artemis.Storage.Legacy/Migrations/Storage/M0023LayoutProviders.cs
+++ b/src/Artemis.Storage.Legacy/Migrations/Storage/M0023LayoutProviders.cs
@@ -9,7 +9,7 @@ internal class M0023LayoutProviders : IStorageMigration
public void Apply(LiteRepository repository)
{
ILiteCollection deviceEntities = repository.Database.GetCollection("DeviceEntity");
- List toUpdate = new();
+ List toUpdate = [];
foreach (BsonDocument bsonDocument in deviceEntities.FindAll())
{
diff --git a/src/Artemis.Storage.Legacy/Migrations/Storage/M0024NodeProviders.cs b/src/Artemis.Storage.Legacy/Migrations/Storage/M0024NodeProviders.cs
index 4617ae6d1..4eadb4fa9 100644
--- a/src/Artemis.Storage.Legacy/Migrations/Storage/M0024NodeProviders.cs
+++ b/src/Artemis.Storage.Legacy/Migrations/Storage/M0024NodeProviders.cs
@@ -9,7 +9,7 @@ internal class M0024NodeProviders : IStorageMigration
public void Apply(LiteRepository repository)
{
ILiteCollection categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
- List categoriesToUpdate = new();
+ List categoriesToUpdate = [];
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
{
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
@@ -24,7 +24,7 @@ internal class M0024NodeProviders : IStorageMigration
categoryCollection.Update(categoriesToUpdate);
ILiteCollection collection = repository.Database.GetCollection("ProfileEntity");
- List profilesToUpdate = new();
+ List profilesToUpdate = [];
foreach (BsonDocument profileBson in collection.FindAll())
{
BsonArray? folders = profileBson["Folders"]?.AsArray;
diff --git a/src/Artemis.Storage.Legacy/Migrations/Storage/M0025NodeProvidersProfileConfig.cs b/src/Artemis.Storage.Legacy/Migrations/Storage/M0025NodeProvidersProfileConfig.cs
index bff6ff6ff..a166aaa65 100644
--- a/src/Artemis.Storage.Legacy/Migrations/Storage/M0025NodeProvidersProfileConfig.cs
+++ b/src/Artemis.Storage.Legacy/Migrations/Storage/M0025NodeProvidersProfileConfig.cs
@@ -9,7 +9,7 @@ internal class M0025NodeProvidersProfileConfig : IStorageMigration
public void Apply(LiteRepository repository)
{
ILiteCollection categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
- List toUpdate = new();
+ List toUpdate = [];
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
{
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
diff --git a/src/Artemis.Storage.Legacy/Migrations/Storage/M0026NodeStorage.cs b/src/Artemis.Storage.Legacy/Migrations/Storage/M0026NodeStorage.cs
index cbea0db8d..875a29c0b 100644
--- a/src/Artemis.Storage.Legacy/Migrations/Storage/M0026NodeStorage.cs
+++ b/src/Artemis.Storage.Legacy/Migrations/Storage/M0026NodeStorage.cs
@@ -19,7 +19,7 @@ internal class M0026NodeStorage : IStorageMigration
public void Apply(LiteRepository repository)
{
ILiteCollection categoryCollection = repository.Database.GetCollection("ProfileCategoryEntity");
- List toUpdate = new();
+ List toUpdate = [];
foreach (BsonDocument profileCategoryBson in categoryCollection.FindAll())
{
BsonArray? profiles = profileCategoryBson["ProfileConfigurations"]?.AsArray;
@@ -38,7 +38,7 @@ internal class M0026NodeStorage : IStorageMigration
categoryCollection.Update(toUpdate);
ILiteCollection collection = repository.Database.GetCollection("ProfileEntity");
- List profilesToUpdate = new();
+ List profilesToUpdate = [];
foreach (BsonDocument profileBson in collection.FindAll())
{
BsonArray? folders = profileBson["Folders"]?.AsArray;
diff --git a/src/Artemis.Storage.Legacy/Migrations/Storage/M0027Namespace.cs b/src/Artemis.Storage.Legacy/Migrations/Storage/M0027Namespace.cs
index b0bee99a1..6aa1cb161 100644
--- a/src/Artemis.Storage.Legacy/Migrations/Storage/M0027Namespace.cs
+++ b/src/Artemis.Storage.Legacy/Migrations/Storage/M0027Namespace.cs
@@ -9,7 +9,7 @@ internal class M0027Namespace : IStorageMigration
public void Apply(LiteRepository repository)
{
ILiteCollection collection = repository.Database.GetCollection("ProfileEntity");
- List profilesToUpdate = new();
+ List profilesToUpdate = [];
foreach (BsonDocument profileBson in collection.FindAll())
{
diff --git a/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs b/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs
index fe9dbe442..bc44e9107 100644
--- a/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs
+++ b/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs
@@ -12,7 +12,7 @@ public class PluginEntity
{
public PluginEntity()
{
- Features = new List();
+ Features = [];
}
public Guid Id { get; set; }
diff --git a/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs b/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs
index f31ca23ef..f07e81504 100644
--- a/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/Abstract/RenderElementEntity.cs
@@ -8,7 +8,7 @@ public abstract class RenderElementEntity
public Guid Id { get; set; }
public Guid ParentId { get; set; }
- public List LayerEffects { get; set; } = new();
+ public List LayerEffects { get; set; } = [];
public IConditionEntity? DisplayCondition { get; set; }
public TimelineEntity? Timeline { get; set; }
diff --git a/src/Artemis.Storage/Entities/Profile/LayerEntity.cs b/src/Artemis.Storage/Entities/Profile/LayerEntity.cs
index bc47ca40d..2ed48f175 100644
--- a/src/Artemis.Storage/Entities/Profile/LayerEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/LayerEntity.cs
@@ -8,8 +8,8 @@ public class LayerEntity : RenderElementEntity
{
public LayerEntity()
{
- Leds = new List();
- AdaptionHints = new List();
+ Leds = [];
+ AdaptionHints = [];
}
public int Order { get; set; }
diff --git a/src/Artemis.Storage/Entities/Profile/Nodes/NodeEntity.cs b/src/Artemis.Storage/Entities/Profile/Nodes/NodeEntity.cs
index cec7d2601..dc2ac64ff 100644
--- a/src/Artemis.Storage/Entities/Profile/Nodes/NodeEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/Nodes/NodeEntity.cs
@@ -8,7 +8,7 @@ public class NodeEntity
{
public NodeEntity()
{
- PinCollections = new List();
+ PinCollections = [];
}
public NodeEntity(NodeEntity nodeEntity)
diff --git a/src/Artemis.Storage/Entities/Profile/Nodes/NodeScriptEntity.cs b/src/Artemis.Storage/Entities/Profile/Nodes/NodeScriptEntity.cs
index ac53e8494..83478efb3 100644
--- a/src/Artemis.Storage/Entities/Profile/Nodes/NodeScriptEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/Nodes/NodeScriptEntity.cs
@@ -6,8 +6,8 @@ public class NodeScriptEntity
{
public NodeScriptEntity()
{
- Nodes = new List();
- Connections = new List();
+ Nodes = [];
+ Connections = [];
}
public string Name { get; set; } = string.Empty;
diff --git a/src/Artemis.Storage/Entities/Profile/ProfileCategoryEntity.cs b/src/Artemis.Storage/Entities/Profile/ProfileCategoryEntity.cs
index b7a3c15f4..553c265f0 100644
--- a/src/Artemis.Storage/Entities/Profile/ProfileCategoryEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/ProfileCategoryEntity.cs
@@ -16,5 +16,5 @@ public class ProfileCategoryEntity
public bool IsSuspended { get; set; }
public int Order { get; set; }
- public List ProfileConfigurations { get; set; } = new();
+ public List ProfileConfigurations { get; set; } = [];
}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/ProfileContainerEntity.cs b/src/Artemis.Storage/Entities/Profile/ProfileContainerEntity.cs
index b6360ab76..b0b064712 100644
--- a/src/Artemis.Storage/Entities/Profile/ProfileContainerEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/ProfileContainerEntity.cs
@@ -5,7 +5,7 @@ namespace Artemis.Storage.Entities.Profile;
public class ProfileContainerEntity
{
public Guid Id { get; set; }
- public byte[] Icon { get; set; } = Array.Empty();
+ public byte[] Icon { get; set; } = [];
public ProfileCategoryEntity ProfileCategory { get; set; } = null!;
diff --git a/src/Artemis.Storage/Entities/Profile/ProfileEntity.cs b/src/Artemis.Storage/Entities/Profile/ProfileEntity.cs
index 459bbdf06..d775fd967 100644
--- a/src/Artemis.Storage/Entities/Profile/ProfileEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/ProfileEntity.cs
@@ -8,8 +8,8 @@ public class ProfileEntity
{
public ProfileEntity()
{
- Folders = new List();
- Layers = new List();
+ Folders = [];
+ Layers = [];
}
public Guid Id { get; set; }
diff --git a/src/Artemis.Storage/Entities/Profile/PropertyEntity.cs b/src/Artemis.Storage/Entities/Profile/PropertyEntity.cs
index 3b4f8e833..56c006eeb 100644
--- a/src/Artemis.Storage/Entities/Profile/PropertyEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/PropertyEntity.cs
@@ -10,5 +10,5 @@ public class PropertyEntity
public bool KeyframesEnabled { get; set; }
public DataBindingEntity? DataBinding { get; set; }
- public List KeyframeEntities { get; set; } = new();
+ public List KeyframeEntities { get; set; } = [];
}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Profile/PropertyGroupEntity.cs b/src/Artemis.Storage/Entities/Profile/PropertyGroupEntity.cs
index e01047ee3..afeb67512 100644
--- a/src/Artemis.Storage/Entities/Profile/PropertyGroupEntity.cs
+++ b/src/Artemis.Storage/Entities/Profile/PropertyGroupEntity.cs
@@ -5,6 +5,6 @@ namespace Artemis.Storage.Entities.Profile;
public class PropertyGroupEntity
{
public string Identifier { get; set; } = string.Empty;
- public List Properties { get; set; } = new();
- public List PropertyGroups { get; set; } = new();
+ public List Properties { get; set; } = [];
+ public List PropertyGroups { get; set; } = [];
}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/Surface/DeviceEntity.cs b/src/Artemis.Storage/Entities/Surface/DeviceEntity.cs
index 6500b9b1d..6292e3abe 100644
--- a/src/Artemis.Storage/Entities/Surface/DeviceEntity.cs
+++ b/src/Artemis.Storage/Entities/Surface/DeviceEntity.cs
@@ -7,9 +7,9 @@ public class DeviceEntity
{
public DeviceEntity()
{
- InputIdentifiers = new List();
- InputMappings = new List();
- Categories = new List();
+ InputIdentifiers = [];
+ InputMappings = [];
+ Categories = [];
}
[MaxLength(512)]
diff --git a/src/Artemis.UI.Linux/App.axaml.cs b/src/Artemis.UI.Linux/App.axaml.cs
index ef163019f..5d9fdf95a 100644
--- a/src/Artemis.UI.Linux/App.axaml.cs
+++ b/src/Artemis.UI.Linux/App.axaml.cs
@@ -34,7 +34,7 @@ public class App : Application
if (ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop || Design.IsDesignMode)
return;
- _applicationStateManager = new ApplicationStateManager(_container!, desktop.Args ?? Array.Empty());
+ _applicationStateManager = new ApplicationStateManager(_container!, desktop.Args ?? []);
ArtemisBootstrapper.Initialize();
RegisterProviders();
}
diff --git a/src/Artemis.UI.Linux/ApplicationStateManager.cs b/src/Artemis.UI.Linux/ApplicationStateManager.cs
index 4d3b1e2cd..7bae51aaf 100644
--- a/src/Artemis.UI.Linux/ApplicationStateManager.cs
+++ b/src/Artemis.UI.Linux/ApplicationStateManager.cs
@@ -57,7 +57,7 @@ public class ApplicationStateManager
{
try
{
- _windowService.ShowExceptionDialog("An unhandled exception occured", e);
+ _windowService.ShowExceptionDialog("An unhandled error occured", e);
}
catch
{
@@ -112,7 +112,7 @@ public class ApplicationStateManager
private void UtilitiesOnRestartRequested(object? sender, RestartEventArgs e)
{
- List argsList = new();
+ List argsList = [];
argsList.AddRange(StartupArguments);
if (e.ExtraArgs != null)
argsList.AddRange(e.ExtraArgs.Except(argsList));
diff --git a/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs b/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs
index 48af97dbf..e4d7ec2a6 100644
--- a/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs
+++ b/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs
@@ -17,7 +17,7 @@ public class LinuxInputProvider : InputProvider
{
_logger = logger;
_inputService = inputService;
- _readers = new List();
+ _readers = [];
foreach (LinuxInputDevice deviceDefinition in LinuxInputDeviceFinder.Find())
{
diff --git a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs
index 21f9514e6..9b555541b 100644
--- a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs
+++ b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs
@@ -47,7 +47,7 @@ public class DataModelPicker : TemplatedControl
/// A list of extra modules to show data models of.
///
public static readonly StyledProperty?> ModulesProperty =
- AvaloniaProperty.Register?>(nameof(Modules), new ObservableCollection());
+ AvaloniaProperty.Register?>(nameof(Modules), []);
///
/// The data model view model to show, if not provided one will be retrieved by the control.
@@ -59,7 +59,7 @@ public class DataModelPicker : TemplatedControl
/// A list of types to filter the selectable paths on.
///
public static readonly StyledProperty?> FilterTypesProperty =
- AvaloniaProperty.Register?>(nameof(FilterTypes), new ObservableCollection());
+ AvaloniaProperty.Register?>(nameof(FilterTypes), []);
///
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
@@ -222,7 +222,7 @@ public class DataModelPicker : TemplatedControl
if (DataModelUIService == null)
return;
- ChangeDataModel(DataModelUIService.GetPluginDataModelVisualization(Modules?.ToList() ?? new List(), true));
+ ChangeDataModel(DataModelUIService.GetPluginDataModelVisualization(Modules?.ToList() ?? [], true));
}
private void ChangeDataModel(DataModelPropertiesViewModel? dataModel)
diff --git a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs
index 742e64458..a54e13f28 100644
--- a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs
+++ b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs
@@ -65,13 +65,13 @@ public class DataModelPickerButton : TemplatedControl
/// A list of extra modules to show data models of.
///
public static readonly StyledProperty?> ModulesProperty =
- AvaloniaProperty.Register?>(nameof(Modules), new ObservableCollection());
+ AvaloniaProperty.Register?>(nameof(Modules), []);
///
/// A list of types to filter the selectable paths on.
///
public static readonly StyledProperty?> FilterTypesProperty =
- AvaloniaProperty.Register?>(nameof(FilterTypes), new ObservableCollection());
+ AvaloniaProperty.Register?>(nameof(FilterTypes), []);
///
/// Gets or sets a boolean indicating whether the picker is in event picker mode.
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
index 9eae5804d..60397e274 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
@@ -34,13 +34,13 @@ public class DeviceVisualizer : Control
private RenderTargetBitmap? _deviceImage;
private ArtemisDevice? _oldDevice;
private bool _loading;
- private Color[] _previousState = Array.Empty();
+ private Color[] _previousState = [];
///
public DeviceVisualizer()
{
_renderService = UI.Locator.Resolve();
- _deviceVisualizerLeds = new List();
+ _deviceVisualizerLeds = [];
PointerReleased += OnPointerReleased;
PropertyChanged += OnPropertyChanged;
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
index 0001c17f8..39be848ae 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
@@ -105,11 +105,11 @@ internal class DeviceVisualizerLed
Geometry geometry = Geometry.Parse(Led.RgbLed.ShapeData);
geometry.Transform = new TransformGroup
{
- Children = new Transforms
- {
+ Children =
+ [
new ScaleTransform(width, height),
new TranslateTransform(Led.RgbLed.Location.X + deflateAmount / 2, Led.RgbLed.Location.Y + deflateAmount / 2)
- }
+ ]
};
DisplayGeometry = geometry;
}
diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs
index b5e538b62..bd8f529e3 100644
--- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs
+++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs
@@ -19,7 +19,7 @@ public partial class EnumComboBox : UserControl
///
public static readonly StyledProperty