mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
RGB.NET - Updated for latest development branch
This commit is contained in:
1 parent
81b8f5bf48
commit
606c1b80f2
13 files changed
+77
-29
No files matched your search
@@ -8,6 +8,13 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
internal class DeviceService : IDeviceService
|
||||
{
|
||||
private readonly IRgbService _rgbService;
|
||||
|
||||
public DeviceService(IRgbService rgbService)
|
||||
{
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
public void IdentifyDevice(ArtemisDevice device)
|
||||
{
|
||||
BlinkDevice(device, 0);
|
||||
@@ -16,9 +23,9 @@ namespace Artemis.Core.Services
|
||||
private void BlinkDevice(ArtemisDevice device, int blinkCount)
|
||||
{
|
||||
// Create a LED group way at the top
|
||||
ListLedGroup ledGroup = new(device.Leds.Select(l => l.RgbLed))
|
||||
ListLedGroup ledGroup = new(_rgbService.Surface, device.Leds.Select(l => l.RgbLed))
|
||||
{
|
||||
Brush = new SolidColorBrush(new Color(255, 255, 255)),
|
||||
Brush = new SolidColorBrush(new Color(255, 255, 255)),
|
||||
ZIndex = 999
|
||||
};
|
||||
|
||||
@@ -26,7 +33,7 @@ namespace Artemis.Core.Services
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(200);
|
||||
ledGroup.Detach();
|
||||
ledGroup.Detach(_rgbService.Surface);
|
||||
|
||||
if (blinkCount < 5)
|
||||
{
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisPluginException(plugin, "Failed to instantiate feature", e);
|
||||
_logger.Warning(new ArtemisPluginException(plugin, "Failed to instantiate feature", e), "Failed to instantiate feature", plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Groups;
|
||||
using RGB.NET.Layout;
|
||||
using Serilog;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
@@ -26,7 +27,7 @@ namespace Artemis.Core.Services
|
||||
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25);
|
||||
_sampleSizeSetting = settingsService.GetSetting("Core.SampleSize", 1);
|
||||
|
||||
Surface = RGBSurface.Instance;
|
||||
Surface = new RGBSurface();
|
||||
|
||||
// Let's throw these for now
|
||||
Surface.Exception += SurfaceOnException;
|
||||
@@ -50,7 +51,11 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
Surface.LoadDevices(deviceProvider, RGBDeviceType.All, false, true);
|
||||
// Device provider may have been attached before..?
|
||||
Surface.Detach(deviceProvider.Devices);
|
||||
|
||||
deviceProvider.Initialize(RGBDeviceType.All, true);
|
||||
Surface.Attach(deviceProvider.Devices);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -117,19 +122,19 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
// Apply the application wide brush and decorator
|
||||
BitmapBrush = new BitmapBrush(new Scale(_renderScaleSetting.Value), _sampleSizeSetting);
|
||||
_surfaceLedGroup = new ListLedGroup(artemisSurface.LedMap.Select(l => l.Key)) {Brush = BitmapBrush};
|
||||
_surfaceLedGroup = new ListLedGroup(Surface, artemisSurface.LedMap.Select(l => l.Key)) {Brush = BitmapBrush};
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_surfaceLedGroup)
|
||||
{
|
||||
// Clean up the old background
|
||||
_surfaceLedGroup.Detach();
|
||||
_surfaceLedGroup.Detach(Surface);
|
||||
|
||||
// Apply the application wide brush and decorator
|
||||
BitmapBrush.Scale = new Scale(_renderScaleSetting.Value);
|
||||
BitmapBrush.Surface = artemisSurface;
|
||||
_surfaceLedGroup = new ListLedGroup(artemisSurface.LedMap.Select(l => l.Key)) {Brush = BitmapBrush};
|
||||
_surfaceLedGroup = new ListLedGroup(Surface, artemisSurface.LedMap.Select(l => l.Key)) {Brush = BitmapBrush};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Gets the full URL of the end point
|
||||
/// </summary>
|
||||
public string Url => $"{_pluginsModule.ServerUrl.TrimEnd('/')}{_pluginsModule.BaseRoute}{PluginFeature.Plugin.Guid}/{Name}";
|
||||
public string Url => $"{_pluginsModule.ServerUrl?.TrimEnd('/')}{_pluginsModule.BaseRoute}{PluginFeature.Plugin.Guid}/{Name}";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin the end point is associated with
|
||||
@@ -45,12 +45,12 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Gets the mime type of the input this end point accepts
|
||||
/// </summary>
|
||||
public string Accepts { get; protected set; }
|
||||
public string? Accepts { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mime type of the output this end point returns
|
||||
/// </summary>
|
||||
public string Returns { get; protected set; }
|
||||
public string? Returns { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Called whenever the end point has to process a request
|
||||
|
||||
Reference in new issue
Block a user