mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Workshop - Implemented workshop installation, layout selection and removal
This commit is contained in:
1 parent
dad6a56238
commit
28edabae89
23 files changed
+226
-168
No files matched your search
@@ -1,17 +1,8 @@
|
||||
using Artemis.Core.Services;
|
||||
using RGB.NET.Layout;
|
||||
|
||||
namespace Artemis.Core.Providers;
|
||||
namespace Artemis.Core.Providers;
|
||||
|
||||
public class CustomPathLayoutProvider : ILayoutProvider
|
||||
{
|
||||
public static string LayoutType = "CustomPath";
|
||||
private readonly IDeviceService _deviceService;
|
||||
|
||||
public CustomPathLayoutProvider(IDeviceService deviceService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
||||
@@ -34,7 +25,7 @@ public class CustomPathLayoutProvider : ILayoutProvider
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the provided device to use this layout provider.
|
||||
/// Configures the provided device to use this layout provider.
|
||||
/// </summary>
|
||||
/// <param name="device">The device to apply the provider to.</param>
|
||||
/// <param name="path">The path to the custom layout.</param>
|
||||
@@ -42,7 +33,5 @@ public class CustomPathLayoutProvider : ILayoutProvider
|
||||
{
|
||||
device.LayoutSelection.Type = LayoutType;
|
||||
device.LayoutSelection.Parameter = path;
|
||||
_deviceService.SaveDevice(device);
|
||||
_deviceService.LoadDeviceLayout(device);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,9 @@
|
||||
using Artemis.Core.Services;
|
||||
|
||||
namespace Artemis.Core.Providers;
|
||||
namespace Artemis.Core.Providers;
|
||||
|
||||
public class DefaultLayoutProvider : ILayoutProvider
|
||||
{
|
||||
public static string LayoutType = "Default";
|
||||
private readonly IDeviceService _deviceService;
|
||||
|
||||
public DefaultLayoutProvider(IDeviceService deviceService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
||||
{
|
||||
@@ -30,22 +22,20 @@ public class DefaultLayoutProvider : ILayoutProvider
|
||||
else
|
||||
device.ApplyLayout(layout, device.DeviceProvider.CreateMissingLedsSupported, device.DeviceProvider.RemoveExcessiveLedsSupported);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMatch(ArtemisDevice device)
|
||||
{
|
||||
return device.LayoutSelection.Type == LayoutType;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Configures the provided device to use this layout provider.
|
||||
/// Configures the provided device to use this layout provider.
|
||||
/// </summary>
|
||||
/// <param name="device">The device to apply the provider to.</param>
|
||||
public void ConfigureDevice(ArtemisDevice device)
|
||||
{
|
||||
device.LayoutSelection.Type = LayoutType;
|
||||
device.LayoutSelection.Parameter = null;
|
||||
_deviceService.SaveDevice(device);
|
||||
_deviceService.LoadDeviceLayout(device);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
namespace Artemis.Core.Providers;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a class that can provide Artemis layouts for devices.
|
||||
/// Represents a class that can provide Artemis layouts for devices.
|
||||
/// </summary>
|
||||
public interface ILayoutProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// If available, loads an Artemis layout for the provided device.
|
||||
/// If available, loads an Artemis layout for the provided device.
|
||||
/// </summary>
|
||||
/// <param name="device">The device to load the layout for.</param>
|
||||
/// <returns>The resulting layout if one was available; otherwise <see langword="null"/>.</returns>
|
||||
/// <returns>The resulting layout if one was available; otherwise <see langword="null" />.</returns>
|
||||
ArtemisLayout? GetDeviceLayout(ArtemisDevice device);
|
||||
|
||||
void ApplyLayout(ArtemisDevice device, ArtemisLayout layout);
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
using Artemis.Core.Services;
|
||||
|
||||
namespace Artemis.Core.Providers;
|
||||
namespace Artemis.Core.Providers;
|
||||
|
||||
public class NoneLayoutProvider : ILayoutProvider
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
public static string LayoutType = "None";
|
||||
|
||||
public NoneLayoutProvider(IDeviceService deviceService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ArtemisLayout? GetDeviceLayout(ArtemisDevice device)
|
||||
{
|
||||
@@ -23,22 +15,20 @@ public class NoneLayoutProvider : ILayoutProvider
|
||||
{
|
||||
device.ApplyLayout(null, false, false);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMatch(ArtemisDevice device)
|
||||
{
|
||||
return device.LayoutSelection.Type == LayoutType;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Configures the provided device to use this layout provider.
|
||||
/// Configures the provided device to use this layout provider.
|
||||
/// </summary>
|
||||
/// <param name="device">The device to apply the provider to.</param>
|
||||
public void ConfigureDevice(ArtemisDevice device)
|
||||
{
|
||||
device.LayoutSelection.Type = LayoutType;
|
||||
device.LayoutSelection.Parameter = null;
|
||||
_deviceService.SaveDevice(device);
|
||||
_deviceService.LoadDeviceLayout(device);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user