mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Added Logitech support (limited to G910 and G403 for now)
Added a splashscreen
This commit is contained in:
1 parent
5597803e3c
commit
eecbe4636e
138 files changed
+1417
-64
No files matched your search
@@ -99,9 +99,12 @@ namespace Artemis.Core.Models.Surface
|
||||
(int) Math.Round(RgbDevice.Size.Height * Surface.Scale, MidpointRounding.AwayFromZero)
|
||||
);
|
||||
|
||||
if (!Leds.Any())
|
||||
return;
|
||||
|
||||
foreach (var led in Leds)
|
||||
led.CalculateRenderRectangle();
|
||||
|
||||
|
||||
var path = new GraphicsPath();
|
||||
path.AddRectangles(Leds.Select(l => l.AbsoluteRenderRectangle).ToArray());
|
||||
RenderPath = path;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using RGB.NET.Core;
|
||||
|
||||
@@ -16,5 +18,18 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
{
|
||||
DeviceProvider = deviceProvider ?? throw new ArgumentNullException(nameof(deviceProvider));
|
||||
}
|
||||
|
||||
|
||||
protected void ResolveAbsolutePath(Type type, object sender, ResolvePathEventArgs e)
|
||||
{
|
||||
if (sender.GetType().IsGenericType(type))
|
||||
{
|
||||
// Start from the plugin directory
|
||||
if (e.RelativePart != null && e.FileName != null)
|
||||
e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePart, e.FileName);
|
||||
else if (e.RelativePath != null)
|
||||
e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ namespace Artemis.Core.Services
|
||||
_surfaceService = surfaceService;
|
||||
_rgbService.Surface.Updating += SurfaceOnUpdating;
|
||||
_rgbService.Surface.Updated += SurfaceOnUpdated;
|
||||
|
||||
Task.Run(Initialize);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,20 @@ namespace Artemis.Core.Services.Interfaces
|
||||
/// <returns>Returns a list of plug instances of type <see cref="T" /></returns>
|
||||
List<T> GetPluginsOfType<T>() where T : Plugin;
|
||||
|
||||
Plugin GetDevicePlugin(IRGBDevice device);
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when built-in plugins are being loaded
|
||||
/// </summary>
|
||||
event EventHandler CopyingBuildInPlugins;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a plugin has started loading
|
||||
/// </summary>
|
||||
event EventHandler<PluginEventArgs> PluginLoading;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a plugin has loaded
|
||||
/// </summary>
|
||||
@@ -92,7 +104,5 @@ namespace Artemis.Core.Services.Interfaces
|
||||
event EventHandler<PluginEventArgs> PluginDisabled;
|
||||
|
||||
#endregion
|
||||
|
||||
Plugin GetDevicePlugin(IRGBDevice device);
|
||||
}
|
||||
}
|
||||
@@ -43,11 +43,12 @@ namespace Artemis.Core.Services
|
||||
/// <inheritdoc />
|
||||
public void CopyBuiltInPlugins()
|
||||
{
|
||||
OnCopyingBuildInPlugins();
|
||||
var pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins"));
|
||||
|
||||
// Iterate built-in plugins
|
||||
var varBuiltInPluginDirectory = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "Plugins"));
|
||||
foreach (var subDirectory in varBuiltInPluginDirectory.EnumerateDirectories())
|
||||
var builtInPluginDirectory = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "Plugins"));
|
||||
foreach (var subDirectory in builtInPluginDirectory.EnumerateDirectories())
|
||||
{
|
||||
// Load the metadata
|
||||
var builtInMetadataFile = Path.Combine(subDirectory.FullName, "plugin.json");
|
||||
@@ -118,6 +119,7 @@ namespace Artemis.Core.Services
|
||||
// Locate the main entry
|
||||
var pluginInfo = JsonConvert.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile));
|
||||
pluginInfo.Directory = subDirectory;
|
||||
OnPluginLoading(new PluginEventArgs(pluginInfo));
|
||||
LoadPlugin(pluginInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -307,11 +309,23 @@ namespace Artemis.Core.Services
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler CopyingBuildInPlugins;
|
||||
public event EventHandler<PluginEventArgs> PluginLoading;
|
||||
public event EventHandler<PluginEventArgs> PluginLoaded;
|
||||
public event EventHandler<PluginEventArgs> PluginUnloaded;
|
||||
public event EventHandler<PluginEventArgs> PluginEnabled;
|
||||
public event EventHandler<PluginEventArgs> PluginDisabled;
|
||||
|
||||
protected virtual void OnCopyingBuildInPlugins()
|
||||
{
|
||||
CopyingBuildInPlugins?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected virtual void OnPluginLoading(PluginEventArgs e)
|
||||
{
|
||||
PluginLoading?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnPluginLoaded(PluginEventArgs e)
|
||||
{
|
||||
PluginLoaded?.Invoke(this, e);
|
||||
|
||||
Reference in new issue
Block a user