mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile adaption - Added support for device hint to 'all' devices
Layouts - Round LED sizes to integers Auto-update - Use modern Windows 10 toasts UI - On shutdown wait 6 seconds longer before force-shutdown UI - Use black icons in notifications on white Windows theme Message service - Added optional toast callbacks
This commit is contained in:
1 parent
5c337e9c5e
commit
96c55e5c03
26 files changed
+886
-674
No files matched your search
@@ -381,7 +381,8 @@ namespace Artemis.Core
|
||||
"set to true because the device provider does not support it");
|
||||
|
||||
if (layout.IsValid)
|
||||
layout.RgbLayout!.ApplyTo(RgbDevice, createMissingLeds, removeExcessiveLeds);
|
||||
layout.ApplyTo(RgbDevice, createMissingLeds, removeExcessiveLeds);
|
||||
|
||||
|
||||
UpdateLeds();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Layout;
|
||||
|
||||
namespace Artemis.Core
|
||||
@@ -107,6 +108,44 @@ namespace Artemis.Core
|
||||
else
|
||||
Image = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the layout to the provided device
|
||||
/// </summary>
|
||||
public void ApplyTo(IRGBDevice device, bool createMissingLeds = false, bool removeExcessiveLeds = false)
|
||||
{
|
||||
device.Size = new Size(MathF.Round(RgbLayout.Width), MathF.Round(RgbLayout.Height));
|
||||
device.DeviceInfo.LayoutMetadata = RgbLayout.CustomData;
|
||||
|
||||
HashSet<LedId> ledIds = new();
|
||||
foreach (ILedLayout layoutLed in RgbLayout.Leds)
|
||||
{
|
||||
if (Enum.TryParse(layoutLed.Id, true, out LedId ledId))
|
||||
{
|
||||
ledIds.Add(ledId);
|
||||
|
||||
Led? led = device[ledId];
|
||||
if ((led == null) && createMissingLeds)
|
||||
led = device.AddLed(ledId, new Point(), new Size());
|
||||
|
||||
if (led != null)
|
||||
{
|
||||
led.Location = new Point(MathF.Round(layoutLed.X), MathF.Round(layoutLed.Y));
|
||||
led.Size = new Size(MathF.Round(layoutLed.Width), MathF.Round(layoutLed.Height));
|
||||
led.Shape = layoutLed.Shape;
|
||||
led.ShapeData = layoutLed.ShapeData;
|
||||
led.LayoutMetadata = layoutLed.CustomData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (removeExcessiveLeds)
|
||||
{
|
||||
List<LedId> ledsToRemove = device.Select(led => led.Id).Where(id => !ledIds.Contains(id)).ToList();
|
||||
foreach (LedId led in ledsToRemove)
|
||||
device.RemoveLed(led);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user