Implemented layer elements

Added a brush layer element
Corsair - Added ST100 RGB layout
This commit is contained in:
SpoinkyNL committed 2019-12-01 18:55:49 +01:00
1 parent 482cbe79ed
commit 9148323ad5
81 files changed
+1610 -365

No files matched your search

@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.Models;
@@ -8,22 +9,24 @@ namespace Artemis.Core.Plugins.Abstract
{
/// <inheritdoc />
/// <summary>
/// Allows you to implement your own RGB device
/// Allows you to implement and register your own device provider
/// </summary>
public abstract class Device : Plugin
public abstract class DeviceProvider : Plugin
{
protected Device(PluginInfo pluginInfo, IRGBDeviceProvider deviceProvider) : base(pluginInfo)
protected DeviceProvider(PluginInfo pluginInfo, IRGBDeviceProvider rgbDeviceProvider) : base(pluginInfo)
{
DeviceProvider = deviceProvider ?? throw new ArgumentNullException(nameof(deviceProvider));
RgbDeviceProvider = rgbDeviceProvider ?? throw new ArgumentNullException(nameof(rgbDeviceProvider));
}
public IRGBDeviceProvider DeviceProvider { get; }
public IRGBDeviceProvider RgbDeviceProvider { get; }
protected void ResolveAbsolutePath(Type type, object sender, ResolvePathEventArgs e)
{
if (sender.GetType().IsGenericType(type))
{
Debug.WriteLine(e.RelativePart);
Debug.WriteLine(e.FileName);
// Start from the plugin directory
if (e.RelativePart != null && e.FileName != null)
e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePart, e.FileName);
@@ -1,29 +0,0 @@
using System.Drawing;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Models;
namespace Artemis.Core.Plugins.Abstract
{
/// <inheritdoc />
/// <summary>
/// Allows you to create your own layer type
/// </summary>
public abstract class LayerType : Plugin
{
protected LayerType(PluginInfo pluginInfo) : base(pluginInfo)
{
}
/// <summary>
/// Updates the layer type
/// </summary>
/// <param name="layer"></param>
public abstract void Update(Layer layer);
/// <summary>
/// Renders the layer type
/// </summary>
public abstract void Render(Layer device, ArtemisSurface surface, Graphics graphics);
}
}
@@ -9,7 +9,7 @@ namespace Artemis.Core.Plugins.Abstract
Module = module;
DisplayName = displayName;
}
public Module Module { get; }
}
}
@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Models;
@@ -34,8 +35,10 @@ namespace Artemis.Core.Plugins.Abstract
}
}
public void ChangeActiveProfile(Profile profile)
internal void ChangeActiveProfile(Profile profile, ArtemisSurface surface)
{
if (profile != null && profile.PluginInfo != PluginInfo)
throw new ArtemisCoreException($"Cannot activate a profile of plugin {profile.PluginInfo} on a module of plugin {PluginInfo}.");
lock (this)
{
if (profile == ActiveProfile)
@@ -44,7 +47,7 @@ namespace Artemis.Core.Plugins.Abstract
ActiveProfile?.Deactivate();
ActiveProfile = profile;
ActiveProfile?.Activate();
ActiveProfile?.Activate(surface);
}
OnActiveProfileChanged();
@@ -53,7 +56,7 @@ namespace Artemis.Core.Plugins.Abstract
#region Events
public event EventHandler ActiveProfileChanged;
protected virtual void OnActiveProfileChanged()
{
ActiveProfileChanged?.Invoke(this, EventArgs.Empty);