Storage - Use nullable reference types

Core - Fix build warnings
This commit is contained in:
Robert committed 2024-02-23 17:35:06 +01:00
1 parent f0e9581fe1
commit 248d4c8e18
65 files changed
+318 -159

No files matched your search

@@ -1,8 +1,14 @@
namespace Artemis.Core.Providers;
/// <summary>
/// Represents a layout provider that loads a layout from a custom path.
/// </summary>
public class CustomPathLayoutProvider : ILayoutProvider
{
public static string LayoutType = "CustomPath";
/// <summary>
/// The layout type of this layout provider.
/// </summary>
public const string LAYOUT_TYPE = "CustomPath";
/// <inheritdoc />
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
@@ -21,7 +27,7 @@ public class CustomPathLayoutProvider : ILayoutProvider
/// <inheritdoc />
public bool IsMatch(ArtemisDevice device)
{
return device.LayoutSelection.Type == LayoutType;
return device.LayoutSelection.Type == LAYOUT_TYPE;
}
/// <summary>
@@ -31,7 +37,7 @@ public class CustomPathLayoutProvider : ILayoutProvider
/// <param name="path">The path to the custom layout.</param>
public void ConfigureDevice(ArtemisDevice device, string? path)
{
device.LayoutSelection.Type = LayoutType;
device.LayoutSelection.Type = LAYOUT_TYPE;
device.LayoutSelection.Parameter = path;
}
}
@@ -1,8 +1,14 @@
namespace Artemis.Core.Providers;
/// <summary>
/// Represents a layout provider that loads a layout from the plugin and falls back to a default layout.
/// </summary>
public class DefaultLayoutProvider : ILayoutProvider
{
public static string LayoutType = "Default";
/// <summary>
/// The layout type of this layout provider.
/// </summary>
public const string LAYOUT_TYPE = "Default";
/// <inheritdoc />
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
@@ -26,7 +32,7 @@ public class DefaultLayoutProvider : ILayoutProvider
/// <inheritdoc />
public bool IsMatch(ArtemisDevice device)
{
return device.LayoutSelection.Type == LayoutType;
return device.LayoutSelection.Type == LAYOUT_TYPE;
}
/// <summary>
@@ -35,7 +41,7 @@ public class DefaultLayoutProvider : ILayoutProvider
/// <param name="device">The device to apply the provider to.</param>
public void ConfigureDevice(ArtemisDevice device)
{
device.LayoutSelection.Type = LayoutType;
device.LayoutSelection.Type = LAYOUT_TYPE;
device.LayoutSelection.Parameter = null;
}
}
@@ -12,6 +12,17 @@ public interface ILayoutProvider
/// <returns>The resulting layout if one was available; otherwise <see langword="null" />.</returns>
ArtemisLayout? GetDeviceLayout(ArtemisDevice device);
/// <summary>
/// Applies the layout to the provided device.
/// </summary>
/// <param name="device">The device to apply to.</param>
/// <param name="layout">The layout to apply.</param>
void ApplyLayout(ArtemisDevice device, ArtemisLayout layout);
/// <summary>
/// Determines whether the provided device is configured to use this layout provider.
/// </summary>
/// <param name="device">The device to check.</param>
/// <returns>A value indicating whether the provided device is configured to use this layout provider.</returns>
bool IsMatch(ArtemisDevice device);
}
@@ -1,8 +1,14 @@
namespace Artemis.Core.Providers;
/// <summary>
/// Represents a layout provider that does not load a layout.
/// </summary>
public class NoneLayoutProvider : ILayoutProvider
{
public static string LayoutType = "None";
/// <summary>
/// The layout type of this layout provider.
/// </summary>
public const string LAYOUT_TYPE = "None";
/// <inheritdoc />
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
@@ -19,7 +25,7 @@ public class NoneLayoutProvider : ILayoutProvider
/// <inheritdoc />
public bool IsMatch(ArtemisDevice device)
{
return device.LayoutSelection.Type == LayoutType;
return device.LayoutSelection.Type == LAYOUT_TYPE;
}
/// <summary>
@@ -28,7 +34,7 @@ public class NoneLayoutProvider : ILayoutProvider
/// <param name="device">The device to apply the provider to.</param>
public void ConfigureDevice(ArtemisDevice device)
{
device.LayoutSelection.Type = LayoutType;
device.LayoutSelection.Type = LAYOUT_TYPE;
device.LayoutSelection.Parameter = null;
}
}