1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Added Logitech support (limited to G910 and G403 for now)

Added a splashscreen
This commit is contained in:
SpoinkyNL 2019-11-10 17:36:18 +01:00
parent 5597803e3c
commit eecbe4636e
138 changed files with 1417 additions and 64 deletions

View File

@ -99,6 +99,9 @@ namespace Artemis.Core.Models.Surface
(int) Math.Round(RgbDevice.Size.Height * Surface.Scale, MidpointRounding.AwayFromZero) (int) Math.Round(RgbDevice.Size.Height * Surface.Scale, MidpointRounding.AwayFromZero)
); );
if (!Leds.Any())
return;
foreach (var led in Leds) foreach (var led in Leds)
led.CalculateRenderRectangle(); led.CalculateRenderRectangle();

View File

@ -1,4 +1,6 @@
using System; using System;
using System.IO;
using Artemis.Core.Extensions;
using Artemis.Core.Plugins.Models; using Artemis.Core.Plugins.Models;
using RGB.NET.Core; using RGB.NET.Core;
@ -16,5 +18,18 @@ namespace Artemis.Core.Plugins.Abstract
{ {
DeviceProvider = deviceProvider ?? throw new ArgumentNullException(nameof(deviceProvider)); 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);
}
}
} }
} }

View File

@ -30,6 +30,7 @@ namespace Artemis.Core.Services
_surfaceService = surfaceService; _surfaceService = surfaceService;
_rgbService.Surface.Updating += SurfaceOnUpdating; _rgbService.Surface.Updating += SurfaceOnUpdating;
_rgbService.Surface.Updated += SurfaceOnUpdated; _rgbService.Surface.Updated += SurfaceOnUpdated;
Task.Run(Initialize); Task.Run(Initialize);
} }

View File

@ -69,8 +69,20 @@ namespace Artemis.Core.Services.Interfaces
/// <returns>Returns a list of plug instances of type <see cref="T" /></returns> /// <returns>Returns a list of plug instances of type <see cref="T" /></returns>
List<T> GetPluginsOfType<T>() where T : Plugin; List<T> GetPluginsOfType<T>() where T : Plugin;
Plugin GetDevicePlugin(IRGBDevice device);
#region Events #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> /// <summary>
/// Occurs when a plugin has loaded /// Occurs when a plugin has loaded
/// </summary> /// </summary>
@ -92,7 +104,5 @@ namespace Artemis.Core.Services.Interfaces
event EventHandler<PluginEventArgs> PluginDisabled; event EventHandler<PluginEventArgs> PluginDisabled;
#endregion #endregion
Plugin GetDevicePlugin(IRGBDevice device);
} }
} }

View File

@ -43,11 +43,12 @@ namespace Artemis.Core.Services
/// <inheritdoc /> /// <inheritdoc />
public void CopyBuiltInPlugins() public void CopyBuiltInPlugins()
{ {
OnCopyingBuildInPlugins();
var pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins")); var pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins"));
// Iterate built-in plugins // Iterate built-in plugins
var varBuiltInPluginDirectory = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "Plugins")); var builtInPluginDirectory = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "Plugins"));
foreach (var subDirectory in varBuiltInPluginDirectory.EnumerateDirectories()) foreach (var subDirectory in builtInPluginDirectory.EnumerateDirectories())
{ {
// Load the metadata // Load the metadata
var builtInMetadataFile = Path.Combine(subDirectory.FullName, "plugin.json"); var builtInMetadataFile = Path.Combine(subDirectory.FullName, "plugin.json");
@ -118,6 +119,7 @@ namespace Artemis.Core.Services
// Locate the main entry // Locate the main entry
var pluginInfo = JsonConvert.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile)); var pluginInfo = JsonConvert.DeserializeObject<PluginInfo>(File.ReadAllText(metadataFile));
pluginInfo.Directory = subDirectory; pluginInfo.Directory = subDirectory;
OnPluginLoading(new PluginEventArgs(pluginInfo));
LoadPlugin(pluginInfo); LoadPlugin(pluginInfo);
} }
catch (Exception e) catch (Exception e)
@ -307,11 +309,23 @@ namespace Artemis.Core.Services
#region Events #region Events
public event EventHandler CopyingBuildInPlugins;
public event EventHandler<PluginEventArgs> PluginLoading;
public event EventHandler<PluginEventArgs> PluginLoaded; public event EventHandler<PluginEventArgs> PluginLoaded;
public event EventHandler<PluginEventArgs> PluginUnloaded; public event EventHandler<PluginEventArgs> PluginUnloaded;
public event EventHandler<PluginEventArgs> PluginEnabled; public event EventHandler<PluginEventArgs> PluginEnabled;
public event EventHandler<PluginEventArgs> PluginDisabled; 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) protected virtual void OnPluginLoaded(PluginEventArgs e)
{ {
PluginLoaded?.Invoke(this, e); PluginLoaded?.Invoke(this, e);

View File

@ -20,24 +20,12 @@ namespace Artemis.Plugins.Devices.Corsair
public override void EnablePlugin() public override void EnablePlugin()
{ {
PathHelper.ResolvingAbsolutePath += ResolveCorsairPath; PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(CorsairRGBDevice<>), sender, args);
CorsairDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CUESDK.dll")); CorsairDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CUESDK.dll"));
CorsairDeviceProvider.PossibleX86NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x86", "CUESDK.dll")); CorsairDeviceProvider.PossibleX86NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x86", "CUESDK.dll"));
_rgbService.AddDeviceProvider(DeviceProvider); _rgbService.AddDeviceProvider(DeviceProvider);
} }
private void ResolveCorsairPath(object sender, ResolvePathEventArgs e)
{
if (sender.GetType().IsGenericType(typeof(CorsairRGBDevice<>)))
{
// 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);
}
}
public override void DisablePlugin() public override void DisablePlugin()
{ {
// TODO: Remove the device provider from the surface // TODO: Remove the device provider from the surface

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{235A45C7-24AD-4F47-B9D4-CD67E610A04D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Artemis.Plugins.Devices.Logitech</RootNamespace>
<AssemblyName>Artemis.Plugins.Devices.Logitech</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="RGB.NET.Core">
<HintPath>..\..\..\RGB.NET\bin\net45\RGB.NET.Core.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Logitech">
<HintPath>..\..\..\RGB.NET\bin\net45\RGB.NET.Devices.Logitech.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LogitechDevice.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
<Project>{9B811F9B-86B9-4771-87AF-72BAE7078A36}</Project>
<Name>Artemis.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="x64\LogitechLedEnginesWrapper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\LogitechLedEnginesWrapper.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>echo Copying resources to plugin output directory
XCOPY "$(ProjectDir)Images" "$(TargetDir)Images" /s /q /i /y
XCOPY "$(ProjectDir)Layouts" "$(TargetDir)Layouts" /s /q /i /y
echo Copying plugin to Artemis.UI output directory
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /s /q /i /y</PostBuildEvent>
</PropertyGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More