mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge branch 'development' into feature/gh-actions
This commit is contained in:
commit
5f206436c3
@ -42,9 +42,9 @@
|
|||||||
<PackageReference Include="LiteDB" Version="5.0.12" />
|
<PackageReference Include="LiteDB" Version="5.0.12" />
|
||||||
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.4.0" />
|
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.12" />
|
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.17" />
|
||||||
<PackageReference Include="RGB.NET.Layout" Version="2.0.0-prerelease.12" />
|
<PackageReference Include="RGB.NET.Layout" Version="2.0.0-prerelease.17" />
|
||||||
<PackageReference Include="RGB.NET.Presets" Version="2.0.0-prerelease.12" />
|
<PackageReference Include="RGB.NET.Presets" Version="2.0.0-prerelease.17" />
|
||||||
<PackageReference Include="Serilog" Version="2.11.0" />
|
<PackageReference Include="Serilog" Version="2.11.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class ArtemisPluginLockException : Exception
|
|||||||
private static string CreateExceptionMessage(Exception? innerException)
|
private static string CreateExceptionMessage(Exception? innerException)
|
||||||
{
|
{
|
||||||
return innerException != null
|
return innerException != null
|
||||||
? "Found a lock file, skipping load, see inner exception for last known exception."
|
? "Found a lock file, skipping automatic load, see inner exception for last known exception. Please manually re-enable the plugin."
|
||||||
: "Found a lock file, skipping load.";
|
: "Found a lock file, skipping automatic load. Please manually re-enable the plugin.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Artemis.Core.Properties;
|
using Artemis.Core.Properties;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ public abstract class CorePropertyChanged : INotifyPropertyChanged
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
protected bool RequiresUpdate<T>(ref T storage, T value)
|
protected bool RequiresUpdate<T>(ref T storage, T value)
|
||||||
{
|
{
|
||||||
return !Equals(storage, value);
|
return !EqualityComparer<T>.Default.Equals(storage, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -28,6 +28,8 @@ public abstract class PerLedLayerBrush<T> : PropertiesLayerBrush<T> where T : La
|
|||||||
/// <returns>The color the LED will receive</returns>
|
/// <returns>The color the LED will receive</returns>
|
||||||
public abstract SKColor GetColor(ArtemisLed led, SKPoint renderPoint);
|
public abstract SKColor GetColor(ArtemisLed led, SKPoint renderPoint);
|
||||||
|
|
||||||
|
private readonly SKPoint[] _points = new SKPoint[2];
|
||||||
|
|
||||||
internal override void InternalRender(SKCanvas canvas, SKRect bounds, SKPaint paint)
|
internal override void InternalRender(SKCanvas canvas, SKRect bounds, SKPaint paint)
|
||||||
{
|
{
|
||||||
// We don't want rotation on this canvas because that'll displace the LEDs, translations are applied to the points of each LED instead
|
// We don't want rotation on this canvas because that'll displace the LEDs, translations are applied to the points of each LED instead
|
||||||
@ -37,25 +39,21 @@ public abstract class PerLedLayerBrush<T> : PropertiesLayerBrush<T> where T : La
|
|||||||
using SKPath pointsPath = new();
|
using SKPath pointsPath = new();
|
||||||
foreach (ArtemisLed artemisLed in Layer.Leds)
|
foreach (ArtemisLed artemisLed in Layer.Leds)
|
||||||
{
|
{
|
||||||
pointsPath.AddPoly(new[]
|
_points[0] = new SKPoint(0, 0);
|
||||||
{
|
_points[1] = new SKPoint(artemisLed.AbsoluteRectangle.Left - Layer.Bounds.Left, artemisLed.AbsoluteRectangle.Top - Layer.Bounds.Top);
|
||||||
new SKPoint(0, 0),
|
pointsPath.AddPoly(_points);
|
||||||
new SKPoint(artemisLed.AbsoluteRectangle.Left - Layer.Bounds.Left, artemisLed.AbsoluteRectangle.Top - Layer.Bounds.Top)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the translation to the points of each LED instead
|
// Apply the translation to the points of each LED instead
|
||||||
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
||||||
pointsPath.Transform(Layer.GetTransformMatrix(true, true, true, true).Invert());
|
pointsPath.Transform(Layer.GetTransformMatrix(true, true, true, true).Invert());
|
||||||
|
|
||||||
SKPoint[] points = pointsPath.Points;
|
|
||||||
|
|
||||||
TryOrBreak(() =>
|
TryOrBreak(() =>
|
||||||
{
|
{
|
||||||
for (int index = 0; index < Layer.Leds.Count; index++)
|
for (int index = 0; index < Layer.Leds.Count; index++)
|
||||||
{
|
{
|
||||||
ArtemisLed artemisLed = Layer.Leds[index];
|
ArtemisLed artemisLed = Layer.Leds[index];
|
||||||
SKPoint renderPoint = points[index * 2 + 1];
|
SKPoint renderPoint = pointsPath.GetPoint(index * 2 + 1);
|
||||||
if (!float.IsFinite(renderPoint.X) || !float.IsFinite(renderPoint.Y))
|
if (!float.IsFinite(renderPoint.X) || !float.IsFinite(renderPoint.Y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@ -10,12 +10,25 @@ namespace Artemis.Core;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class LogStore
|
public static class LogStore
|
||||||
{
|
{
|
||||||
|
private static readonly object _lock = new();
|
||||||
|
|
||||||
private static readonly LinkedList<LogEvent> LinkedList = new();
|
private static readonly LinkedList<LogEvent> LinkedList = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list containing the last 500 log events.
|
/// Gets a list containing the last 500 log events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<LogEvent> Events => LinkedList.ToList();
|
public static List<LogEvent> Events
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
List<LogEvent> events;
|
||||||
|
|
||||||
|
lock (_lock)
|
||||||
|
events = LinkedList.ToList();
|
||||||
|
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a new <see cref="LogEvent" /> was received.
|
/// Occurs when a new <see cref="LogEvent" /> was received.
|
||||||
@ -23,10 +36,14 @@ public static class LogStore
|
|||||||
public static event EventHandler<LogEventEventArgs>? EventAdded;
|
public static event EventHandler<LogEventEventArgs>? EventAdded;
|
||||||
|
|
||||||
internal static void Emit(LogEvent logEvent)
|
internal static void Emit(LogEvent logEvent)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
{
|
{
|
||||||
LinkedList.AddLast(logEvent);
|
LinkedList.AddLast(logEvent);
|
||||||
while (LinkedList.Count > 500)
|
while (LinkedList.Count > 500)
|
||||||
LinkedList.RemoveFirst();
|
LinkedList.RemoveFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
OnEventAdded(new LogEventEventArgs(logEvent));
|
OnEventAdded(new LogEventEventArgs(logEvent));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<PackageReference Include="Material.Icons.Avalonia" Version="1.1.10" />
|
<PackageReference Include="Material.Icons.Avalonia" Version="1.1.10" />
|
||||||
<PackageReference Include="ReactiveUI" Version="17.1.50" />
|
<PackageReference Include="ReactiveUI" Version="17.1.50" />
|
||||||
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
|
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
|
||||||
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.12" />
|
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.17" />
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
|
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -34,8 +34,8 @@
|
|||||||
<PackageReference Include="Octopus.Octodiff" Version="2.0.100" />
|
<PackageReference Include="Octopus.Octodiff" Version="2.0.100" />
|
||||||
<PackageReference Include="ReactiveUI" Version="17.1.50" />
|
<PackageReference Include="ReactiveUI" Version="17.1.50" />
|
||||||
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
|
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
|
||||||
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.12" />
|
<PackageReference Include="RGB.NET.Core" Version="2.0.0-prerelease.17" />
|
||||||
<PackageReference Include="RGB.NET.Layout" Version="2.0.0-prerelease.12" />
|
<PackageReference Include="RGB.NET.Layout" Version="2.0.0-prerelease.17" />
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
|
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
|
||||||
<PackageReference Include="Splat.DryIoc" Version="14.6.1" />
|
<PackageReference Include="Splat.DryIoc" Version="14.6.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@ -48,8 +48,11 @@ public class LogsDebugViewModel : ActivatableViewModelBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddLogEvent(LogEvent logEvent)
|
private void AddLogEvent(LogEvent? logEvent)
|
||||||
{
|
{
|
||||||
|
if (logEvent is null)
|
||||||
|
return;
|
||||||
|
|
||||||
using StringWriter writer = new();
|
using StringWriter writer = new();
|
||||||
_formatter.Format(logEvent, writer);
|
_formatter.Format(logEvent, writer);
|
||||||
string line = writer.ToString();
|
string line = writer.ToString();
|
||||||
@ -60,7 +63,7 @@ public class LogsDebugViewModel : ActivatableViewModelBase
|
|||||||
|
|
||||||
private void RemoveOldestLine()
|
private void RemoveOldestLine()
|
||||||
{
|
{
|
||||||
int firstNewLine = Document.Text.IndexOf('\n');
|
int firstNewLine = Document.IndexOf('\n', 0, Document.TextLength);
|
||||||
if (firstNewLine == -1)
|
if (firstNewLine == -1)
|
||||||
{
|
{
|
||||||
//this should never happen.
|
//this should never happen.
|
||||||
|
|||||||
@ -53,7 +53,7 @@ public class StartupWizardViewModel : DialogViewModelBase<bool>
|
|||||||
DeviceProviders = new ObservableCollection<PluginViewModel>(pluginManagementService.GetAllPlugins()
|
DeviceProviders = new ObservableCollection<PluginViewModel>(pluginManagementService.GetAllPlugins()
|
||||||
.Where(p => p.Info.IsCompatible && p.Features.Any(f => f.AlwaysEnabled && f.FeatureType.IsAssignableTo(typeof(DeviceProvider))))
|
.Where(p => p.Info.IsCompatible && p.Features.Any(f => f.AlwaysEnabled && f.FeatureType.IsAssignableTo(typeof(DeviceProvider))))
|
||||||
.OrderBy(p => p.Info.Name)
|
.OrderBy(p => p.Info.Name)
|
||||||
.Select(p => settingsVmFactory.PluginViewModel(p, null)));
|
.Select(p => settingsVmFactory.PluginViewModel(p, ReactiveCommand.Create(() => new Unit()))));
|
||||||
|
|
||||||
CurrentStep = 1;
|
CurrentStep = 1;
|
||||||
SetupButtons();
|
SetupButtons();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user