mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Core port - Targeting .NET Core 3.1!
Core port - Updated projects to new project layout Core port - Changed the way devices are identified to be consistent across different frameworks Core port - Updated plugin system to no longer use AppDomain but AssemblyLoadContext (through McMaster.NETCore.Plugins) Core port - Renamed a few events to keep Fody from getting confused
This commit is contained in:
1 parent
29a75b7ad8
commit
a79c56eaa1
61 files changed
+537
-2031
No files matched your search
@@ -47,7 +47,7 @@ namespace Artemis.Core.Services.Storage.Interfaces
|
||||
/// <summary>
|
||||
/// Occurs when the active device entity has been changed
|
||||
/// </summary>
|
||||
event EventHandler<SurfaceConfigurationEventArgs> ActiveSurfaceConfigurationChanged;
|
||||
event EventHandler<SurfaceConfigurationEventArgs> ActiveSurfaceConfigurationSelected;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a surface configuration has been updated
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Artemis.Core.Services.Storage
|
||||
_layerService = layerService;
|
||||
_profileRepository = profileRepository;
|
||||
|
||||
_surfaceService.ActiveSurfaceConfigurationChanged += OnActiveSurfaceConfigurationChanged;
|
||||
_surfaceService.ActiveSurfaceConfigurationSelected += OnActiveSurfaceConfigurationSelected;
|
||||
_surfaceService.SurfaceConfigurationUpdated += OnSurfaceConfigurationUpdated;
|
||||
_pluginService.PluginLoaded += OnPluginLoaded;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace Artemis.Core.Services.Storage
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void OnActiveSurfaceConfigurationChanged(object sender, SurfaceConfigurationEventArgs e)
|
||||
private void OnActiveSurfaceConfigurationSelected(object sender, SurfaceConfigurationEventArgs e)
|
||||
{
|
||||
ActiveProfilesPopulateLeds(e.Surface);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Artemis.Core.Services.Storage
|
||||
var surfaceConfiguration = new ArtemisSurface(_rgbService.Surface, surfaceEntity, _renderScaleSetting.Value);
|
||||
foreach (var position in surfaceEntity.DeviceEntities)
|
||||
{
|
||||
var device = _rgbService.Surface.Devices.FirstOrDefault(d => d.GetDeviceHashCode() == position.DeviceHashCode);
|
||||
var device = _rgbService.Surface.Devices.FirstOrDefault(d => d.GetDeviceIdentifier() == position.DeviceIdentifier);
|
||||
if (device != null)
|
||||
{
|
||||
var plugin = _pluginService.GetDevicePlugin(device);
|
||||
@@ -174,14 +174,14 @@ namespace Artemis.Core.Services.Storage
|
||||
|
||||
private void AddDeviceIfMissing(IRGBDevice rgbDevice, ArtemisSurface surface)
|
||||
{
|
||||
var deviceHashCode = rgbDevice.GetDeviceHashCode();
|
||||
var device = surface.Devices.FirstOrDefault(d => d.DeviceEntity.DeviceHashCode == deviceHashCode);
|
||||
var deviceIdentifier = rgbDevice.GetDeviceIdentifier();
|
||||
var device = surface.Devices.FirstOrDefault(d => d.DeviceEntity.DeviceIdentifier == deviceIdentifier);
|
||||
|
||||
if (device != null)
|
||||
return;
|
||||
|
||||
// Find an existing device config and use that
|
||||
var existingDeviceConfig = surface.SurfaceEntity.DeviceEntities.FirstOrDefault(d => d.DeviceHashCode == deviceHashCode);
|
||||
var existingDeviceConfig = surface.SurfaceEntity.DeviceEntities.FirstOrDefault(d => d.DeviceIdentifier == deviceIdentifier);
|
||||
if (existingDeviceConfig != null)
|
||||
{
|
||||
var plugin = _pluginService.GetDevicePlugin(rgbDevice);
|
||||
@@ -193,7 +193,7 @@ namespace Artemis.Core.Services.Storage
|
||||
_logger.Information(
|
||||
"No device config found for {deviceInfo}, device hash: {deviceHashCode}. Adding a new entry.",
|
||||
rgbDevice.DeviceInfo,
|
||||
deviceHashCode
|
||||
deviceIdentifier
|
||||
);
|
||||
var plugin = _pluginService.GetDevicePlugin(rgbDevice);
|
||||
device = new ArtemisDevice(rgbDevice, plugin, surface);
|
||||
@@ -230,12 +230,12 @@ namespace Artemis.Core.Services.Storage
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<SurfaceConfigurationEventArgs> ActiveSurfaceConfigurationChanged;
|
||||
public event EventHandler<SurfaceConfigurationEventArgs> ActiveSurfaceConfigurationSelected;
|
||||
public event EventHandler<SurfaceConfigurationEventArgs> SurfaceConfigurationUpdated;
|
||||
|
||||
protected virtual void OnActiveSurfaceConfigurationChanged(SurfaceConfigurationEventArgs e)
|
||||
{
|
||||
ActiveSurfaceConfigurationChanged?.Invoke(this, e);
|
||||
ActiveSurfaceConfigurationSelected?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnSurfaceConfigurationUpdated(SurfaceConfigurationEventArgs e)
|
||||
|
||||
Reference in new issue
Block a user