diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index ffea2cad6..e61ffec1e 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 false false Artemis.Core @@ -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/ColorScience/Quantization/ColorSwatch.cs b/src/Artemis.Core/ColorScience/Quantization/ColorSwatch.cs index 602f3d480..0adb2cbe6 100644 --- a/src/Artemis.Core/ColorScience/Quantization/ColorSwatch.cs +++ b/src/Artemis.Core/ColorScience/Quantization/ColorSwatch.cs @@ -1,5 +1,4 @@ -using System.Text; -using SkiaSharp; +using SkiaSharp; namespace Artemis.Core.ColorScience; 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/Hotkey.cs b/src/Artemis.Core/Models/ProfileConfiguration/Hotkey.cs index b7dc91525..cd3fbd754 100644 --- a/src/Artemis.Core/Models/ProfileConfiguration/Hotkey.cs +++ b/src/Artemis.Core/Models/ProfileConfiguration/Hotkey.cs @@ -1,5 +1,4 @@ -using System; -using Artemis.Core.Services; +using Artemis.Core.Services; using Artemis.Storage.Entities.Profile; namespace Artemis.Core; 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/DeviceProviders/DeviceProvider.cs b/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs index 263748f0d..755cc48ee 100644 --- a/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs +++ b/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Linq; -using System.Threading.Tasks; using RGB.NET.Core; namespace Artemis.Core.DeviceProviders; 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..1d70aa0b8 100644 --- a/src/Artemis.Core/Plugins/PluginInfo.cs +++ b/src/Artemis.Core/Plugins/PluginInfo.cs @@ -109,43 +109,44 @@ 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 /// - public Version? MinimumVersion { get; internal init; } = new(1, 0, 0); + [JsonInclude] + public Version? MinimumVersion { get; internal init; } /// /// 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/DeviceService.cs b/src/Artemis.Core/Services/DeviceService.cs index aaa27c59b..33b9792db 100644 --- a/src/Artemis.Core/Services/DeviceService.cs +++ b/src/Artemis.Core/Services/DeviceService.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Threading; using System.Threading.Tasks; using Artemis.Core.DeviceProviders; using Artemis.Core.Providers; diff --git a/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs b/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs index 45608664e..257ecf4d0 100644 --- a/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs +++ b/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using RGB.NET.Core; +using RGB.NET.Core; namespace Artemis.Core.Services; 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/IDeviceService.cs b/src/Artemis.Core/Services/Interfaces/IDeviceService.cs index eb611d613..0187425c6 100644 --- a/src/Artemis.Core/Services/Interfaces/IDeviceService.cs +++ b/src/Artemis.Core/Services/Interfaces/IDeviceService.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Artemis.Core.DeviceProviders; namespace Artemis.Core.Services; 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/Interfaces/IRenderService.cs b/src/Artemis.Core/Services/Interfaces/IRenderService.cs index e33d4fea0..1845bdce6 100644 --- a/src/Artemis.Core/Services/Interfaces/IRenderService.cs +++ b/src/Artemis.Core/Services/Interfaces/IRenderService.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using Artemis.Core.Services.Core; using Artemis.Core.SkiaSharp; using RGB.NET.Core; diff --git a/src/Artemis.Core/Services/PluginManagementService.cs b/src/Artemis.Core/Services/PluginManagementService.cs index f65a9d858..d1e2d7245 100644 --- a/src/Artemis.Core/Services/PluginManagementService.cs +++ b/src/Artemis.Core/Services/PluginManagementService.cs @@ -9,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using Artemis.Core.DeviceProviders; using Artemis.Core.DryIoc; -using Artemis.Storage.Entities.General; using Artemis.Storage.Entities.Plugins; using Artemis.Storage.Entities.Surface; using Artemis.Storage.Repositories.Interfaces; @@ -29,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; @@ -40,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]; } } @@ -264,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); @@ -302,6 +318,7 @@ internal class PluginManagementService : IPluginManagementService } catch (Exception e) { + pluginInfo.LoadException = e; throw new ArtemisPluginException(plugin, "Failed to load the plugins assembly", e); } @@ -313,6 +330,7 @@ internal class PluginManagementService : IPluginManagementService } catch (ReflectionTypeLoadException e) { + pluginInfo.LoadException = e; throw new ArtemisPluginException( plugin, "Failed to initialize the plugin assembly", @@ -472,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 981f247a5..a712c4ae7 100644 --- a/src/Artemis.Core/Services/Storage/ProfileService.cs +++ b/src/Artemis.Core/Services/Storage/ProfileService.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; @@ -11,7 +10,6 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using Artemis.Core.Modules; using Artemis.Storage.Entities.Profile; -using Artemis.Storage.Migrations; using Artemis.Storage.Repositories.Interfaces; using Serilog; using SkiaSharp; @@ -25,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/JsonPluginEndPoint.cs b/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs index eee990829..b3313ea97 100644 --- a/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs +++ b/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs @@ -2,8 +2,8 @@ using System.Text.Json; using System.Threading.Tasks; using GenHTTP.Api.Protocol; -using GenHTTP.Modules.Basics; using GenHTTP.Modules.Conversion.Serializers.Json; +using GenHTTP.Modules.IO; namespace Artemis.Core.Services; diff --git a/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs b/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs index f621ade10..62914222b 100644 --- a/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs +++ b/src/Artemis.Core/Services/WebServer/EndPoints/PluginEndPoint.cs @@ -1,9 +1,7 @@ using System; -using System.Net.Http; using System.Text.Json.Serialization; using System.Threading.Tasks; using GenHTTP.Api.Protocol; -using GenHTTP.Modules.Basics; using GenHTTP.Modules.IO; using StringContent = GenHTTP.Modules.IO.Strings.StringContent; @@ -57,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/EndPoints/StringPluginEndPoint.cs b/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs index 83230e8c1..34410dffc 100644 --- a/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs +++ b/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs @@ -2,7 +2,7 @@ using System.IO; using System.Threading.Tasks; using GenHTTP.Api.Protocol; -using GenHTTP.Modules.Basics; +using GenHTTP.Modules.IO; using GenHTTP.Modules.IO.Strings; namespace Artemis.Core.Services; diff --git a/src/Artemis.Core/Services/WebServer/Interfaces/IWebServerService.cs b/src/Artemis.Core/Services/WebServer/Interfaces/IWebServerService.cs index 01a41d1dd..d6170e75f 100644 --- a/src/Artemis.Core/Services/WebServer/Interfaces/IWebServerService.cs +++ b/src/Artemis.Core/Services/WebServer/Interfaces/IWebServerService.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using Artemis.Core.Modules; using GenHTTP.Api.Infrastructure; using GenHTTP.Api.Protocol; diff --git a/src/Artemis.Core/Services/WebServer/PluginsHandler.cs b/src/Artemis.Core/Services/WebServer/PluginsHandler.cs index f7db246b5..410b85972 100644 --- a/src/Artemis.Core/Services/WebServer/PluginsHandler.cs +++ b/src/Artemis.Core/Services/WebServer/PluginsHandler.cs @@ -1,12 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.Json; using System.Threading.Tasks; using GenHTTP.Api.Content; using GenHTTP.Api.Protocol; -using GenHTTP.Modules.Basics; -using GenHTTP.Modules.Conversion.Serializers.Json; +using GenHTTP.Modules.IO; using GenHTTP.Modules.IO.Strings; namespace Artemis.Core.Services; diff --git a/src/Artemis.Core/Services/WebServer/WebServerService.cs b/src/Artemis.Core/Services/WebServer/WebServerService.cs index 8a132c8e6..c57d0bb52 100644 --- a/src/Artemis.Core/Services/WebServer/WebServerService.cs +++ b/src/Artemis.Core/Services/WebServer/WebServerService.cs @@ -12,7 +12,6 @@ using GenHTTP.Api.Protocol; using GenHTTP.Engine.Internal; using GenHTTP.Modules.Conversion; using GenHTTP.Modules.Conversion.Serializers; -using GenHTTP.Modules.ErrorHandling; using GenHTTP.Modules.Layouting; using GenHTTP.Modules.Layouting.Provider; using GenHTTP.Modules.Practices; @@ -43,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/Utilities/EnumUtilities.cs b/src/Artemis.Core/Utilities/EnumUtilities.cs index 0abf74e92..6291d0867 100644 --- a/src/Artemis.Core/Utilities/EnumUtilities.cs +++ b/src/Artemis.Core/Utilities/EnumUtilities.cs @@ -30,7 +30,7 @@ public static class EnumUtilities if (!t.IsEnum) throw new ArgumentException($"{t} must be an enum type"); - return Enum.GetValues(t).Cast().Select(e => (e, e.Humanize())).ToList(); + return Enum.GetValues(t).Cast().Select(e => (e, HumanizeValue(e))).ToList(); } /// @@ -40,6 +40,6 @@ public static class EnumUtilities /// A humanized string describing the given value public static string HumanizeValue(Enum value) { - return value.Humanize(); + return value.ToString().Humanize(); } } \ No newline at end of file diff --git a/src/Artemis.Core/Utilities/Utilities.cs b/src/Artemis.Core/Utilities/Utilities.cs index 8c9422400..625af0630 100644 --- a/src/Artemis.Core/Utilities/Utilities.cs +++ b/src/Artemis.Core/Utilities/Utilities.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Security.AccessControl; using System.Security.Principal; -using SkiaSharp; namespace Artemis.Core; 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/Artemis.Storage.Legacy.csproj b/src/Artemis.Storage.Legacy/Artemis.Storage.Legacy.csproj index ede098742..159352cb7 100644 --- a/src/Artemis.Storage.Legacy/Artemis.Storage.Legacy.csproj +++ b/src/Artemis.Storage.Legacy/Artemis.Storage.Legacy.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable 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/Artemis.Storage.csproj b/src/Artemis.Storage/Artemis.Storage.csproj index 62503b361..c37f5b716 100644 --- a/src/Artemis.Storage/Artemis.Storage.csproj +++ b/src/Artemis.Storage/Artemis.Storage.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 false x64 enable diff --git a/src/Artemis.Storage/ArtemisDbContext.cs b/src/Artemis.Storage/ArtemisDbContext.cs index 0893def84..5f719521c 100644 --- a/src/Artemis.Storage/ArtemisDbContext.cs +++ b/src/Artemis.Storage/ArtemisDbContext.cs @@ -8,7 +8,6 @@ using Artemis.Storage.Entities.Profile; using Artemis.Storage.Entities.Surface; using Artemis.Storage.Entities.Workshop; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Diagnostics; namespace Artemis.Storage; diff --git a/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs b/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs index faf43f951..bc44e9107 100644 --- a/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs +++ b/src/Artemis.Storage/Entities/Plugins/PluginEntity.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Runtime.InteropServices; using Microsoft.EntityFrameworkCore; namespace Artemis.Storage.Entities.Plugins; @@ -13,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 c27fdb5ed..d775fd967 100644 --- a/src/Artemis.Storage/Entities/Profile/ProfileEntity.cs +++ b/src/Artemis.Storage/Entities/Profile/ProfileEntity.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Artemis.Storage.Entities.General; namespace Artemis.Storage.Entities.Profile; @@ -9,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.Storage/Repositories/ProfileRepository.cs b/src/Artemis.Storage/Repositories/ProfileRepository.cs index dd129e23e..28d273aca 100644 --- a/src/Artemis.Storage/Repositories/ProfileRepository.cs +++ b/src/Artemis.Storage/Repositories/ProfileRepository.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Text.Json.Nodes; using Artemis.Storage.Entities; using Artemis.Storage.Entities.Profile; -using Artemis.Storage.Exceptions; using Artemis.Storage.Migrations; using Artemis.Storage.Repositories.Interfaces; using Microsoft.EntityFrameworkCore; diff --git a/src/Artemis.UI.Linux/App.axaml.cs b/src/Artemis.UI.Linux/App.axaml.cs index dbba1fb2f..5d9fdf95a 100644 --- a/src/Artemis.UI.Linux/App.axaml.cs +++ b/src/Artemis.UI.Linux/App.axaml.cs @@ -7,7 +7,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -using Avalonia.ReactiveUI; +using ReactiveUI.Avalonia; using DryIoc; using ReactiveUI; @@ -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/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj index 64844bc6c..3c98265c9 100644 --- a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj +++ b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj @@ -1,7 +1,7 @@ WinExe - net9.0 + net10.0 enable x64 x64 diff --git a/src/Artemis.UI.Linux/Program.cs b/src/Artemis.UI.Linux/Program.cs index e39ba8973..8a9a92109 100644 --- a/src/Artemis.UI.Linux/Program.cs +++ b/src/Artemis.UI.Linux/Program.cs @@ -2,7 +2,7 @@ using System; using Artemis.Core; using Artemis.Storage; using Avalonia; -using Avalonia.ReactiveUI; +using ReactiveUI.Avalonia; using DryIoc; using Serilog; diff --git a/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceReader.cs b/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceReader.cs index 9f78fd227..d1abe1807 100644 --- a/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceReader.cs +++ b/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceReader.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Threading; 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.MacOS/App.axaml.cs b/src/Artemis.UI.MacOS/App.axaml.cs index 800bb523f..95863dbae 100644 --- a/src/Artemis.UI.MacOS/App.axaml.cs +++ b/src/Artemis.UI.MacOS/App.axaml.cs @@ -2,7 +2,7 @@ using Artemis.Storage.Legacy; using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; -using Avalonia.ReactiveUI; +using ReactiveUI.Avalonia; using DryIoc; using ReactiveUI; diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj index 816f3cd77..75ec28c90 100644 --- a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj +++ b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj @@ -1,7 +1,7 @@  WinExe - net9.0 + net10.0 enable x64 x64 diff --git a/src/Artemis.UI.MacOS/Program.cs b/src/Artemis.UI.MacOS/Program.cs index 3343ecafb..aecf565f5 100644 --- a/src/Artemis.UI.MacOS/Program.cs +++ b/src/Artemis.UI.MacOS/Program.cs @@ -2,7 +2,7 @@ using System; using Artemis.Core; using Artemis.Storage; using Avalonia; -using Avalonia.ReactiveUI; +using ReactiveUI.Avalonia; using DryIoc; using Serilog; diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index ef6ed4e95..e56e208fa 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -1,7 +1,7 @@ Library - net9.0 + net10.0 enable bin\ x64 @@ -14,12 +14,12 @@ - + diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index 7aadc91bf..c56a747a3 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -2,10 +2,8 @@ using System; using System.Text.RegularExpressions; using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Documents; using Avalonia.Layout; using Avalonia.LogicalTree; -using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.Media.Imaging; using Material.Icons; diff --git a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs index 996dc842c..9b555541b 100644 --- a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs +++ b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; @@ -48,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. @@ -60,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. @@ -223,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/DraggableNumberBox.axaml.cs b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs index cb85a0bc6..44cd60381 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using Avalonia; using Avalonia.Controls; using Avalonia.Data; diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index 8fcd1eba4..bd8f529e3 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -6,7 +6,6 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Data; using Avalonia.LogicalTree; -using Avalonia.Markup.Xaml; namespace Artemis.UI.Shared; @@ -20,7 +19,7 @@ public partial class EnumComboBox : UserControl /// public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register(nameof(Value), defaultBindingMode: BindingMode.TwoWay); - private readonly ObservableCollection _currentValues = new(); + private readonly ObservableCollection _currentValues = []; private Type? _currentType; /// diff --git a/src/Artemis.UI.Shared/Controls/Flyouts/MaterialIconPickerFlyout.cs b/src/Artemis.UI.Shared/Controls/Flyouts/MaterialIconPickerFlyout.cs index 99321b5e0..4597081db 100644 --- a/src/Artemis.UI.Shared/Controls/Flyouts/MaterialIconPickerFlyout.cs +++ b/src/Artemis.UI.Shared/Controls/Flyouts/MaterialIconPickerFlyout.cs @@ -1,5 +1,4 @@ using Avalonia.Controls; -using FluentAvalonia.UI.Controls; namespace Artemis.UI.Shared.Flyouts; diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs index 11215c7f0..a8286a68e 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs +++ b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs @@ -269,7 +269,7 @@ public class GradientPicker : TemplatedControl private void UpdateGradient() { // Update the display gradient - GradientStops collection = new(); + GradientStops collection = []; foreach (ColorGradientStop c in EditingColorGradient.OrderBy(s => s.Position)) collection.Add(new GradientStop(Color.FromArgb(c.Color.Alpha, c.Color.Red, c.Color.Green, c.Color.Blue), c.Position)); diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs index 407f7ed11..e2a6ed065 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs +++ b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs @@ -169,7 +169,7 @@ public class GradientPickerButton : TemplatedControl private void UpdateGradient() { // Update the display gradient - GradientStops collection = new(); + GradientStops collection = []; if (ColorGradient != null) foreach (ColorGradientStop c in ColorGradient.OrderBy(s => s.Position)) collection.Add(new GradientStop(Color.FromArgb(c.Color.Alpha, c.Color.Red, c.Color.Green, c.Color.Blue), c.Position)); diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index 1697977a8..3c0bfd8d2 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -7,7 +7,6 @@ using Avalonia.Controls; using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; -using Avalonia.Markup.Xaml; using Avalonia.Threading; using Avalonia.VisualTree; using DryIoc; diff --git a/src/Artemis.UI.Shared/Controls/NoInputTextBox.cs b/src/Artemis.UI.Shared/Controls/NoInputTextBox.cs index 67ed37900..8361d3abe 100644 --- a/src/Artemis.UI.Shared/Controls/NoInputTextBox.cs +++ b/src/Artemis.UI.Shared/Controls/NoInputTextBox.cs @@ -1,8 +1,6 @@ using System; -using Avalonia; using Avalonia.Controls; using Avalonia.Input; -using Avalonia.Styling; namespace Artemis.UI.Shared; diff --git a/src/Artemis.UI.Shared/Controls/TagsInput/TagsInput.properties.cs b/src/Artemis.UI.Shared/Controls/TagsInput/TagsInput.properties.cs index 2660e7bb8..11a10dbb9 100644 --- a/src/Artemis.UI.Shared/Controls/TagsInput/TagsInput.properties.cs +++ b/src/Artemis.UI.Shared/Controls/TagsInput/TagsInput.properties.cs @@ -1,7 +1,6 @@ using System.Collections.ObjectModel; using Avalonia; using Avalonia.Controls.Primitives; -using Avalonia.Data; namespace Artemis.UI.Shared.TagsInput; @@ -11,7 +10,7 @@ public partial class TagsInput : TemplatedControl /// Defines the property /// public static readonly StyledProperty> TagsProperty = - AvaloniaProperty.Register>(nameof(Tags), new ObservableCollection()); + AvaloniaProperty.Register>(nameof(Tags), []); /// /// Gets or sets the selected tags. diff --git a/src/Artemis.UI.Shared/Converters/BytesToStringConverter.cs b/src/Artemis.UI.Shared/Converters/BytesToStringConverter.cs index f6f7da7e6..82946c897 100644 --- a/src/Artemis.UI.Shared/Converters/BytesToStringConverter.cs +++ b/src/Artemis.UI.Shared/Converters/BytesToStringConverter.cs @@ -2,7 +2,6 @@ using System; using System.Globalization; using Avalonia.Data.Converters; using Humanizer; -using Humanizer.Bytes; namespace Artemis.UI.Shared.Converters; diff --git a/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs b/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs index 29f562d47..d34498c4f 100644 --- a/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs +++ b/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs @@ -17,7 +17,7 @@ public class ColorGradientToGradientStopsConverter : IValueConverter public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { ColorGradient? colorGradient = value as ColorGradient; - GradientStops collection = new(); + GradientStops collection = []; if (colorGradient == null) return collection; @@ -30,7 +30,7 @@ public class ColorGradientToGradientStopsConverter : IValueConverter public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { GradientStops? collection = value as GradientStops; - ColorGradient colorGradients = new(); + ColorGradient colorGradients = []; if (collection == null) return colorGradients; diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs index b04d61d2b..5eb02d346 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelListViewModel.cs @@ -24,7 +24,7 @@ public class DataModelListViewModel : DataModelVisualizationViewModel : base(dataModel, parent, dataModelPath) { _countDisplay = "0 items"; - _listChildren = new ObservableCollection(); + _listChildren = []; } /// diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs index 95d07a35b..0896619c6 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs @@ -29,7 +29,7 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa internal DataModelVisualizationViewModel(DataModel? dataModel, DataModelVisualizationViewModel? parent, DataModelPath? dataModelPath) { _dataModel = dataModel; - _children = new ObservableCollection(); + _children = []; _parent = parent; DataModelPath = dataModelPath; IsMatchingFilteredTypes = true; diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs index 2980cf877..663fb2f7e 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs @@ -1,5 +1,4 @@ using Avalonia.Controls; -using Avalonia.Markup.Xaml; namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display; diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs index 57a8c867a..933bb4b90 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs @@ -1,5 +1,4 @@ using Avalonia.Controls; -using Avalonia.Markup.Xaml; using SkiaSharp; namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display; diff --git a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs index 94190e2d4..97a461344 100644 --- a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs @@ -18,7 +18,7 @@ public static class ContainerExtensions { container.Register(Reuse.Singleton); Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly(); - container.RegisterMany(new[] {artemisShared}, type => type.IsAssignableTo(), Reuse.Singleton); + container.RegisterMany([artemisShared], type => type.IsAssignableTo(), Reuse.Singleton); UI.Locator = container; } diff --git a/src/Artemis.UI.Shared/Extensions/ArtemisLayoutExtensions.cs b/src/Artemis.UI.Shared/Extensions/ArtemisLayoutExtensions.cs index b356e8c24..38047c541 100644 --- a/src/Artemis.UI.Shared/Extensions/ArtemisLayoutExtensions.cs +++ b/src/Artemis.UI.Shared/Extensions/ArtemisLayoutExtensions.cs @@ -125,11 +125,11 @@ public static class ArtemisLayoutExtensions Geometry geometry = Geometry.Parse(led.RgbLayout.ShapeData); geometry.Transform = new TransformGroup { - Children = new Transforms - { + Children = + [ new ScaleTransform(width, height), new TranslateTransform(led.RgbLayout.X + deflateAmount / 2, led.RgbLayout.Y + deflateAmount / 2) - } + ] }; return geometry; } diff --git a/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs b/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs index 45e97e130..560323921 100644 --- a/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs +++ b/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs @@ -18,7 +18,7 @@ public static class VisualExtensions /// A recursive list of all visual children of type . public static List GetVisualChildrenOfType(this Visual root) { - List result = new(); + List result = []; List? visualChildren = root.GetVisualChildren()?.ToList(); if (visualChildren == null || !visualChildren.Any()) @@ -43,7 +43,7 @@ public static class VisualExtensions /// A recursive list of all visual children with a data context of type . public static List GetVisualChildrenOfDataContextType(this Visual root) { - List result = new(); + List result = []; List? visualChildren = root.GetVisualChildren()?.ToList(); if (visualChildren == null || !visualChildren.Any()) diff --git a/src/Artemis.UI.Shared/ReactiveAppWindow.cs b/src/Artemis.UI.Shared/ReactiveAppWindow.cs index c943cbbfe..95e8a9e33 100644 --- a/src/Artemis.UI.Shared/ReactiveAppWindow.cs +++ b/src/Artemis.UI.Shared/ReactiveAppWindow.cs @@ -1,12 +1,9 @@ using System; -using System.Reactive.Disposables; +using System.Reactive.Disposables.Fluent; using System.Runtime.InteropServices; using Avalonia; using Avalonia.Controls; using Avalonia.Media; -using Avalonia.Media.Immutable; -using Avalonia.Styling; -using FluentAvalonia.UI.Media; using FluentAvalonia.UI.Windowing; using ReactiveUI; @@ -52,7 +49,7 @@ public class ReactiveAppWindow : AppWindow, IViewFor whe return; // TransparencyBackgroundFallback = Brushes.Transparent; - TransparencyLevelHint = new[] {WindowTransparencyLevel.Mica}; + TransparencyLevelHint = [WindowTransparencyLevel.Mica]; Background = new SolidColorBrush(new Color(80, 0,0,0)); } diff --git a/src/Artemis.UI.Shared/Routing/Routable/RoutableScreenOfTParam.cs b/src/Artemis.UI.Shared/Routing/Routable/RoutableScreenOfTParam.cs index 52e8a5e48..db6e361f3 100644 --- a/src/Artemis.UI.Shared/Routing/Routable/RoutableScreenOfTParam.cs +++ b/src/Artemis.UI.Shared/Routing/Routable/RoutableScreenOfTParam.cs @@ -88,7 +88,7 @@ public abstract class RoutableScreen : RoutableScreen, IRoutableScreen w Expression> lambda = Expression.Lambda>( Expression.Block( - new[] {parameterExpression}, + [parameterExpression], Expression.Assign(parameterExpression, Expression.New(parameterType)), Expression.Block(propertyAssignments), parameterExpression diff --git a/src/Artemis.UI.Shared/Routing/Route/RouteRegistration.cs b/src/Artemis.UI.Shared/Routing/Route/RouteRegistration.cs index 22246b3f0..62f3a54d8 100644 --- a/src/Artemis.UI.Shared/Routing/Route/RouteRegistration.cs +++ b/src/Artemis.UI.Shared/Routing/Route/RouteRegistration.cs @@ -44,5 +44,5 @@ public class RouteRegistration : IRouterRegistration where TViewMode public Type ViewModel => typeof(TViewModel); /// - public List Children { get; set; } = new(); + public List Children { get; set; } = []; } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Routing/Route/RouteResolution.cs b/src/Artemis.UI.Shared/Routing/Route/RouteResolution.cs index b80bad548..f7634837b 100644 --- a/src/Artemis.UI.Shared/Routing/Route/RouteResolution.cs +++ b/src/Artemis.UI.Shared/Routing/Route/RouteResolution.cs @@ -25,7 +25,7 @@ internal class RouteResolution return AsFailure(path); // Ensure self is a match - List parameters = new(); + List parameters = []; int currentSegment = 0; foreach (RouteSegment routeSegment in registration.Route.Segments) { @@ -95,7 +95,7 @@ internal class RouteResolution public object[] GetAllParameters() { - List result = new(); + List result = []; if (Parameters != null) result.AddRange(Parameters); object[]? childParameters = Child?.GetAllParameters(); diff --git a/src/Artemis.UI.Shared/Routing/Router/Navigation.cs b/src/Artemis.UI.Shared/Routing/Router/Navigation.cs index 1df871d34..f30d2dac6 100644 --- a/src/Artemis.UI.Shared/Routing/Router/Navigation.cs +++ b/src/Artemis.UI.Shared/Routing/Router/Navigation.cs @@ -1,10 +1,7 @@ using System; -using System.Reactive.Threading.Tasks; using System.Threading; using System.Threading.Tasks; -using Avalonia.Threading; using DryIoc; -using ReactiveUI; using Serilog; namespace Artemis.UI.Shared.Routing; @@ -89,7 +86,7 @@ internal class Navigation return; // Navigate on the screen - args.SegmentParameters = resolution.Parameters ?? Array.Empty(); + args.SegmentParameters = resolution.Parameters ?? []; try { await screen.InternalOnNavigating(args, _cts.Token); diff --git a/src/Artemis.UI.Shared/Routing/Router/NavigationArguments.cs b/src/Artemis.UI.Shared/Routing/Router/NavigationArguments.cs index 3b732d987..a064e3f69 100644 --- a/src/Artemis.UI.Shared/Routing/Router/NavigationArguments.cs +++ b/src/Artemis.UI.Shared/Routing/Router/NavigationArguments.cs @@ -1,5 +1,4 @@ using System; -using System.Threading.Tasks; namespace Artemis.UI.Shared.Routing; @@ -14,7 +13,7 @@ public class NavigationArguments Options = options; Path = path; RouteParameters = routeParameters; - SegmentParameters = Array.Empty(); + SegmentParameters = []; } /// diff --git a/src/Artemis.UI.Shared/Routing/Router/Router.cs b/src/Artemis.UI.Shared/Routing/Router/Router.cs index d10cd2ede..8358c6fcc 100644 --- a/src/Artemis.UI.Shared/Routing/Router/Router.cs +++ b/src/Artemis.UI.Shared/Routing/Router/Router.cs @@ -68,7 +68,7 @@ internal class Router : CorePropertyChanged, IRouter, IDisposable public IObservable CurrentPath => _currentRouteSubject; /// - public List Routes { get; } = new(); + public List Routes { get; } = []; /// public async Task Navigate(string path, RouterNavigationOptions? options = null) diff --git a/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs index e0b6532fc..6e8a1cce3 100644 --- a/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs @@ -2,7 +2,6 @@ using System.Linq; using Avalonia.Controls; using Avalonia.Platform.Storage; -using SkiaSharp; namespace Artemis.UI.Shared.Services.Builders; @@ -12,7 +11,7 @@ namespace Artemis.UI.Shared.Services.Builders; public class FileDialogFilterBuilder { private string _name; - private readonly List _extensions = new(); + private readonly List _extensions = []; internal FileDialogFilterBuilder() { diff --git a/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs index c9ef09d65..e0a76533a 100644 --- a/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs @@ -61,7 +61,7 @@ public class OpenFileDialogBuilder FileDialogFilterBuilder builder = new(); configure(builder); - _fileTypeFilters ??= new List(); + _fileTypeFilters ??= []; _fileTypeFilters.Add(builder.Build()); _options.FileTypeFilter = _fileTypeFilters; diff --git a/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs index c246e052f..707c2e2ed 100644 --- a/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs @@ -60,7 +60,7 @@ public class SaveFileDialogBuilder FileDialogFilterBuilder builder = new(); configure(builder); - _fileTypeFilters ??= new List(); + _fileTypeFilters ??= []; _fileTypeFilters.Add(builder.Build()); _options.FileTypeChoices = _fileTypeFilters; diff --git a/src/Artemis.UI.Shared/Services/DataModelUIService.cs b/src/Artemis.UI.Shared/Services/DataModelUIService.cs index fc8569711..07a096d84 100644 --- a/src/Artemis.UI.Shared/Services/DataModelUIService.cs +++ b/src/Artemis.UI.Shared/Services/DataModelUIService.cs @@ -25,8 +25,8 @@ internal class DataModelUIService : IDataModelUIService { _dataModelService = dataModelService; _container = container; - _registeredDataModelEditors = new List(); - _registeredDataModelDisplays = new List(); + _registeredDataModelEditors = []; + _registeredDataModelDisplays = []; RegisteredDataModelEditors = new ReadOnlyCollection(_registeredDataModelEditors); RegisteredDataModelDisplays = new ReadOnlyCollection(_registeredDataModelDisplays); diff --git a/src/Artemis.UI.Shared/Services/Interfaces/IWindowService.cs b/src/Artemis.UI.Shared/Services/Interfaces/IWindowService.cs index 15756d2a0..f68bba209 100644 --- a/src/Artemis.UI.Shared/Services/Interfaces/IWindowService.cs +++ b/src/Artemis.UI.Shared/Services/Interfaces/IWindowService.cs @@ -29,7 +29,8 @@ public interface IWindowService : IArtemisSharedUIService /// /// The title of the dialog /// The exception to display - void ShowExceptionDialog(string title, Exception exception); + /// + void ShowExceptionDialog(string title, Exception exception, string? customMessage = null); /// /// Creates a view model instance of type and shows its corresponding View as a diff --git a/src/Artemis.UI.Shared/Services/MainWindow/MainWindowService.cs b/src/Artemis.UI.Shared/Services/MainWindow/MainWindowService.cs index 0a95a0087..a72cbd167 100644 --- a/src/Artemis.UI.Shared/Services/MainWindow/MainWindowService.cs +++ b/src/Artemis.UI.Shared/Services/MainWindow/MainWindowService.cs @@ -1,5 +1,4 @@ using System; -using ReactiveUI; namespace Artemis.UI.Shared.Services.MainWindow; diff --git a/src/Artemis.UI.Shared/Services/NodeEditor/NodeConnectionStore.cs b/src/Artemis.UI.Shared/Services/NodeEditor/NodeConnectionStore.cs index 8182aec2b..9f29455d6 100644 --- a/src/Artemis.UI.Shared/Services/NodeEditor/NodeConnectionStore.cs +++ b/src/Artemis.UI.Shared/Services/NodeEditor/NodeConnectionStore.cs @@ -34,9 +34,9 @@ public class NodeConnectionStore // Iterate to save foreach (IPin nodePin in Node.Pins.ToList()) - _pinConnections.Add(nodePin, new List(nodePin.ConnectedTo)); + _pinConnections.Add(nodePin, [..nodePin.ConnectedTo]); foreach (IPin nodePin in Node.PinCollections.ToList().SelectMany(nodePinCollection => nodePinCollection)) - _pinConnections.Add(nodePin, new List(nodePin.ConnectedTo)); + _pinConnections.Add(nodePin, [..nodePin.ConnectedTo]); // Iterate to disconnect foreach (IPin nodePin in Node.Pins.ToList()) diff --git a/src/Artemis.UI.Shared/Services/NodeEditor/NodeEditorCommandScope.cs b/src/Artemis.UI.Shared/Services/NodeEditor/NodeEditorCommandScope.cs index fbd40520c..b2f181794 100644 --- a/src/Artemis.UI.Shared/Services/NodeEditor/NodeEditorCommandScope.cs +++ b/src/Artemis.UI.Shared/Services/NodeEditor/NodeEditorCommandScope.cs @@ -20,7 +20,7 @@ public class NodeEditorCommandScope : IDisposable Name = name; _nodeEditorService = nodeEditorService; _nodeScript = nodeScript; - _commands = new List(); + _commands = []; } /// diff --git a/src/Artemis.UI.Shared/Services/ProfileEditor/IToolViewModel.cs b/src/Artemis.UI.Shared/Services/ProfileEditor/IToolViewModel.cs index 7b1bf30d8..b6f910846 100644 --- a/src/Artemis.UI.Shared/Services/ProfileEditor/IToolViewModel.cs +++ b/src/Artemis.UI.Shared/Services/ProfileEditor/IToolViewModel.cs @@ -1,6 +1,5 @@ using System; using Artemis.Core; -using Avalonia.Input; using Material.Icons; namespace Artemis.UI.Shared.Services.ProfileEditor; diff --git a/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorCommandScope.cs b/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorCommandScope.cs index aa760b121..72a639d31 100644 --- a/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorCommandScope.cs +++ b/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorCommandScope.cs @@ -17,7 +17,7 @@ public class ProfileEditorCommandScope : IDisposable { Name = name; _profileEditorService = profileEditorService; - _commands = new List(); + _commands = []; } /// diff --git a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs index 9ed8048c1..b1d419e61 100644 --- a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs +++ b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs @@ -15,7 +15,7 @@ internal class PropertyInputService : IPropertyInputService public PropertyInputService(IContainer container) { _container = container; - _registeredPropertyEditors = new List(); + _registeredPropertyEditors = []; RegisteredPropertyEditors = new ReadOnlyCollection(_registeredPropertyEditors); } @@ -113,6 +113,6 @@ internal class PropertyInputService : IPropertyInputService // ReSharper disable once InconsistentlySynchronizedField // When you've just spent the last 2 hours trying to figure out a deadlock and reach this line, I'm so, so sorry. I thought this would be fine. IContainer container = registration?.Plugin.Container ?? _container; - return (PropertyInputViewModel) container.Resolve(viewModelType, args: new object[] { layerProperty }); + return (PropertyInputViewModel) container.Resolve(viewModelType, args: [layerProperty]); } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs index ede68d21f..70a22613b 100644 --- a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs +++ b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Reactive.Disposables; +using System.Reactive.Disposables.Fluent; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Controls; diff --git a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml index b228ebe2f..98c4fbe9e 100644 --- a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml +++ b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml @@ -22,9 +22,7 @@ Awww :( - - It looks like Artemis ran into an unhandled exception. If this keeps happening feel free to hit us up on Discord. - + @@ -42,7 +40,7 @@