mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Core - Nullable refactoring
Core - Nullable refactoring Core - Nullable refactoring (finish)
This commit is contained in:
1 parent
b185b28645
commit
fb3466e102
61 files changed
+320
-272
No files matched your search
@@ -10,10 +10,20 @@ namespace Artemis.Core.LayerBrushes
|
||||
{
|
||||
private LayerBrushType _brushType;
|
||||
private ILayerBrushConfigurationDialog? _configurationDialog;
|
||||
private LayerBrushDescriptor? _descriptor;
|
||||
private LayerBrushDescriptor _descriptor;
|
||||
private Layer _layer;
|
||||
private bool _supportsTransformation = true;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="BaseLayerBrush" /> class
|
||||
/// </summary>
|
||||
protected BaseLayerBrush()
|
||||
{
|
||||
// Both are set right after construction to keep the constructor of inherited classes clean
|
||||
_layer = null!;
|
||||
_descriptor = null!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the layer this brush is applied to
|
||||
/// </summary>
|
||||
@@ -26,7 +36,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
/// <summary>
|
||||
/// Gets the descriptor of this brush
|
||||
/// </summary>
|
||||
public LayerBrushDescriptor? Descriptor
|
||||
public LayerBrushDescriptor Descriptor
|
||||
{
|
||||
get => _descriptor;
|
||||
internal set => SetAndNotify(ref _descriptor, value);
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
/// </summary>
|
||||
public abstract class PropertiesLayerBrush<T> : BaseLayerBrush where T : LayerPropertyGroup
|
||||
{
|
||||
private T _properties;
|
||||
private T _properties = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether all properties on this brush are initialized
|
||||
@@ -35,7 +35,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
internal void InitializeProperties()
|
||||
{
|
||||
Properties = Activator.CreateInstance<T>();
|
||||
Properties.GroupDescription ??= new PropertyGroupDescriptionAttribute {Name = Descriptor.DisplayName, Description = Descriptor.Description};
|
||||
Properties.GroupDescription = new PropertyGroupDescriptionAttribute {Name = Descriptor.DisplayName, Description = Descriptor.Description};
|
||||
Properties.LayerBrush = this;
|
||||
Properties.Initialize(Layer, "LayerBrush.", Descriptor.Provider);
|
||||
PropertiesInitialized = true;
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
/// </summary>
|
||||
internal void CreateInstance(Layer layer)
|
||||
{
|
||||
if (layer == null) throw new ArgumentNullException(nameof(layer));
|
||||
if (layer.LayerBrush != null)
|
||||
throw new ArtemisCoreException("Layer already has an instantiated layer brush");
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
/// </summary>
|
||||
protected RgbNetLayerBrush()
|
||||
{
|
||||
LedGroup = new ListLedGroup();
|
||||
BrushType = LayerBrushType.RgbNet;
|
||||
SupportsTransformation = false;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
// Not used in this effect type
|
||||
internal override void InternalRender(SKCanvas canvas, SKRect bounds, SKPaint paint)
|
||||
{
|
||||
throw new NotImplementedException("RGB.NET layer effectes do not implement InternalRender");
|
||||
throw new NotImplementedException("RGB.NET layer effects do not implement InternalRender");
|
||||
}
|
||||
|
||||
private void LayerOnRenderPropertiesUpdated(object? sender, EventArgs e)
|
||||
|
||||
Reference in new issue
Block a user