mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added Corsair support as a plugin
This commit is contained in:
parent
1146de1fc5
commit
090c726880
@ -82,9 +82,6 @@
|
||||
<Reference Include="RGB.NET.Decorators, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Decorators.0.1.25\lib\net45\RGB.NET.Decorators.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RGB.NET.Devices.Corsair, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Devices.Corsair.0.1.25\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RGB.NET.Groups, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Groups.0.1.25\lib\net45\RGB.NET.Groups.dll</HintPath>
|
||||
</Reference>
|
||||
@ -99,8 +96,8 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data" />
|
||||
@ -145,7 +142,6 @@
|
||||
<Compile Include="Events\PluginEventArgs.cs" />
|
||||
<Compile Include="Services\PluginService.cs" />
|
||||
<Compile Include="Services\StorageService.cs" />
|
||||
<Compile Include="UtilitiesRemoveMe.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Groups;
|
||||
using Color = RGB.NET.Core.Color;
|
||||
@ -12,11 +13,10 @@ namespace Artemis.Core.RGB.NET
|
||||
|
||||
public GraphicsDecorator(ListLedGroup ledGroup)
|
||||
{
|
||||
// var width = ledGroup.GetLeds().Max(l => l.LedRectangle.X + l.LedRectangle.Width);
|
||||
// var height = ledGroup.GetLeds().Max(l => l.LedRectangle.Y + l.LedRectangle.Height);
|
||||
var width = 500;
|
||||
var height = 500;
|
||||
_bitmap = new DirectBitmap(width, height);
|
||||
var width = ledGroup.GetLeds().Max(l => l.AbsoluteLedRectangle.X + l.AbsoluteLedRectangle.Width);
|
||||
var height = ledGroup.GetLeds().Max(l => l.AbsoluteLedRectangle.Y + l.AbsoluteLedRectangle.Height);
|
||||
|
||||
_bitmap = new DirectBitmap((int) width, (int) height);
|
||||
}
|
||||
|
||||
public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color)
|
||||
|
||||
@ -40,7 +40,6 @@ namespace Artemis.Core.Services
|
||||
|
||||
// Initialize the services
|
||||
await Task.Run(() => _pluginService.LoadPlugins());
|
||||
await _rgbService.LoadDevices();
|
||||
|
||||
OnInitialized();
|
||||
}
|
||||
@ -61,7 +60,7 @@ namespace Artemis.Core.Services
|
||||
// Render all active modules
|
||||
using (var g = _rgbService.GraphicsDecorator.GetGraphics())
|
||||
{
|
||||
g.Clear(Color.Red);
|
||||
g.Clear(Color.Black);
|
||||
|
||||
foreach (var module in modules)
|
||||
module.Render(args.DeltaTime, _rgbService.Surface, g);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.RGB.NET;
|
||||
using RGB.NET.Core;
|
||||
@ -8,10 +7,9 @@ namespace Artemis.Core.Services.Interfaces
|
||||
{
|
||||
public interface IRgbService : IArtemisService
|
||||
{
|
||||
bool LoadingDevices { get; }
|
||||
RGBSurface Surface { get; set; }
|
||||
GraphicsDecorator GraphicsDecorator { get; }
|
||||
Task LoadDevices();
|
||||
void AddDeviceProvider(IRGBDeviceProvider deviceProvider);
|
||||
void Dispose();
|
||||
|
||||
/// <summary>
|
||||
@ -23,15 +21,5 @@ namespace Artemis.Core.Services.Interfaces
|
||||
/// Occurs when a single device has reloaded
|
||||
/// </summary>
|
||||
event EventHandler<DeviceEventArgs> DeviceReloaded;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when loading all devices has started
|
||||
/// </summary>
|
||||
event EventHandler StartingLoadingDevices;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when loading all devices has finished
|
||||
/// </summary>
|
||||
event EventHandler FinishedLoadedDevices;
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,6 @@ using Artemis.Core.RGB.NET;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Brushes;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Corsair;
|
||||
using RGB.NET.Groups;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
@ -39,49 +38,30 @@ namespace Artemis.Core.Services
|
||||
public RGBSurface Surface { get; set; }
|
||||
|
||||
public GraphicsDecorator GraphicsDecorator { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task LoadDevices()
|
||||
|
||||
public void AddDeviceProvider(IRGBDeviceProvider deviceProvider)
|
||||
{
|
||||
OnStartedLoadingDevices();
|
||||
Surface.LoadDevices(deviceProvider);
|
||||
Surface.AlignDevices();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// TODO SpoinkyNL 8-1-18: Keep settings into account
|
||||
// This one doesn't work well without ASUS devices installed
|
||||
// Surface.LoadDevices(AsusDeviceProvider.Instance);
|
||||
// Surface.LoadDevices(CoolerMasterDeviceProvider.Instance);
|
||||
Surface.LoadDevices(CorsairDeviceProvider.Instance);
|
||||
// Surface.LoadDevices(DMXDeviceProvider.Instance);
|
||||
// Surface.LoadDevices(LogitechDeviceProvider.Instance);
|
||||
// Surface.LoadDevices(MsiDeviceProvider.Instance);
|
||||
// Surface.LoadDevices(NovationDeviceProvider.Instance);
|
||||
// Surface.LoadDevices(RazerDeviceProvider.Instance);
|
||||
lock (_loadedDevices)
|
||||
{
|
||||
foreach (var surfaceDevice in deviceProvider.Devices)
|
||||
{
|
||||
if (!_loadedDevices.Contains(surfaceDevice))
|
||||
{
|
||||
_loadedDevices.Add(surfaceDevice);
|
||||
OnDeviceLoaded(new DeviceEventArgs(surfaceDevice));
|
||||
}
|
||||
else
|
||||
OnDeviceReloaded(new DeviceEventArgs(surfaceDevice));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO SpoinkyNL 8-1-18: Load alignment
|
||||
Surface.AlignDevices();
|
||||
|
||||
lock (_loadedDevices)
|
||||
{
|
||||
foreach (var surfaceDevice in Surface.Devices)
|
||||
{
|
||||
if (!_loadedDevices.Contains(surfaceDevice))
|
||||
{
|
||||
_loadedDevices.Add(surfaceDevice);
|
||||
OnDeviceLoaded(new DeviceEventArgs(surfaceDevice));
|
||||
}
|
||||
else
|
||||
OnDeviceReloaded(new DeviceEventArgs(surfaceDevice));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Apply the application wide brush and decorator
|
||||
var background = new ListLedGroup(Surface.Leds) {Brush = new SolidColorBrush(new Color(255, 255, 255, 255))};
|
||||
GraphicsDecorator = new GraphicsDecorator(background);
|
||||
background.Brush.AddDecorator(GraphicsDecorator);
|
||||
|
||||
OnFinishedLoadedDevices();
|
||||
// Apply the application wide brush and decorator
|
||||
var background = new ListLedGroup(Surface.Leds) { Brush = new SolidColorBrush(new Color(255, 255, 255, 255)) };
|
||||
GraphicsDecorator = new GraphicsDecorator(background);
|
||||
background.Brush.AddDecorator(GraphicsDecorator);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -101,8 +81,6 @@ namespace Artemis.Core.Services
|
||||
|
||||
public event EventHandler<DeviceEventArgs> DeviceLoaded;
|
||||
public event EventHandler<DeviceEventArgs> DeviceReloaded;
|
||||
public event EventHandler StartingLoadingDevices;
|
||||
public event EventHandler FinishedLoadedDevices;
|
||||
|
||||
private void OnDeviceLoaded(DeviceEventArgs e)
|
||||
{
|
||||
@ -113,19 +91,7 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
DeviceReloaded?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void OnStartedLoadingDevices()
|
||||
{
|
||||
LoadingDevices = true;
|
||||
StartingLoadingDevices?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void OnFinishedLoadedDevices()
|
||||
{
|
||||
LoadingDevices = false;
|
||||
FinishedLoadedDevices?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -10,9 +10,8 @@
|
||||
<package id="RGB.NET.Brushes" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Core" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Decorators" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Devices.Corsair" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Groups" version="0.1.25" targetFramework="net472" />
|
||||
<package id="Stylet" version="1.1.22" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -0,0 +1,85 @@
|
||||
<?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>{A779B2F8-C253-4C4B-8634-6EB8F594E96D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Artemis.Plugins.Devices.Corsair</RootNamespace>
|
||||
<AssemblyName>Artemis.Plugins.Devices.Corsair</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</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, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Core.0.1.25\lib\net45\RGB.NET.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="RGB.NET.Devices.Corsair, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Devices.Corsair.0.1.25\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<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="CorsairDevice.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>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="plugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets" Condition="Exists('..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets'))" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>(robocopy $(TargetDir) %25ProgramData%25\Artemis\plugins\$(ProjectName) /E /NFL /NDL /NJH /NJS /nc /ns /np) ^& IF %25ERRORLEVEL%25 LEQ 4 exit /B 0</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
41
src/Artemis.Plugins.Devices.Corsair/CorsairDevice.cs
Normal file
41
src/Artemis.Plugins.Devices.Corsair/CorsairDevice.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Devices.Corsair;
|
||||
|
||||
namespace Artemis.Plugins.Devices.Corsair
|
||||
{
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public class CorsairDevice : Device
|
||||
{
|
||||
private readonly IRgbService _rgbService;
|
||||
|
||||
public CorsairDevice(PluginInfo pluginInfo, IRgbService rgbService) : base(pluginInfo)
|
||||
{
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
CorsairDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CUESDK.dll"));
|
||||
CorsairDeviceProvider.PossibleX86NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x86", "CUESDK.dll"));
|
||||
_rgbService.AddDeviceProvider(CorsairDeviceProvider.Instance);
|
||||
}
|
||||
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
// TODO: Remove the device provider from the surface
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
// TODO: This will probably not go well without first removing the device provider
|
||||
// CorsairDeviceProvider.Instance.ResetDevices();
|
||||
// CorsairDeviceProvider.Instance.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Artemis.Plugins.Devices.CorsairDevice")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Artemis.Plugins.Devices.CorsairDevice")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a779b2f8-c253-4c4b-8634-6eb8f594e96d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
15
src/Artemis.Plugins.Devices.Corsair/app.config
Normal file
15
src/Artemis.Plugins.Devices.Corsair/app.config
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
7
src/Artemis.Plugins.Devices.Corsair/packages.config
Normal file
7
src/Artemis.Plugins.Devices.Corsair/packages.config
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="RGB.NET.Core" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Devices.Corsair" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Resources.Corsair" version="0.3.0.234" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
10
src/Artemis.Plugins.Devices.Corsair/plugin.json
Normal file
10
src/Artemis.Plugins.Devices.Corsair/plugin.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Guid": "926629ab-8170-42f3-be18-22c694aa91cd",
|
||||
"Name": "Corsair Devices",
|
||||
"Version": {
|
||||
"Major": 1,
|
||||
"Minor": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"Main": "Artemis.Plugins.Devices.Corsair.dll"
|
||||
}
|
||||
@ -48,8 +48,9 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -84,6 +85,6 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>(robocopy $(TargetDir) %25ProgramData%25\Artemis\plugins\$(ProjectName) /NFL /NDL /NJH /NJS /nc /ns /np) ^& IF %25ERRORLEVEL%25 LEQ 4 exit /B 0</PostBuildEvent>
|
||||
<PostBuildEvent>(robocopy $(TargetDir) %25ProgramData%25\Artemis\plugins\$(ProjectName) /E /NFL /NDL /NJH /NJS /nc /ns /np) ^& IF %25ERRORLEVEL%25 LEQ 4 exit /B 0</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -6,6 +6,10 @@
|
||||
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
<package id="QRCoder" version="1.2.5" targetFramework="net461" />
|
||||
<package id="RGB.NET.Core" version="0.1.25" targetFramework="net472" />
|
||||
<package id="Stylet" version="1.1.22" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -52,8 +52,9 @@
|
||||
<HintPath>..\packages\System.Drawing.Common.4.5.0\lib\net461\System.Drawing.Common.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -67,6 +68,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="GeneralDataModel.cs" />
|
||||
<Compile Include="GeneralModule.cs" />
|
||||
<Compile Include="ColorHelpers.cs" />
|
||||
<Compile Include="ViewModels\GeneralViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@ -92,6 +94,6 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>(robocopy $(TargetDir) %25ProgramData%25\Artemis\plugins\$(ProjectName) /NFL /NDL /NJH /NJS /nc /ns /np) ^& IF %25ERRORLEVEL%25 LEQ 4 exit /B 0</PostBuildEvent>
|
||||
<PostBuildEvent>(robocopy $(TargetDir) %25ProgramData%25\Artemis\plugins\$(ProjectName) /E /NFL /NDL /NJH /NJS /nc /ns /np) ^& IF %25ERRORLEVEL%25 LEQ 4 exit /B 0</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
namespace Artemis.Core
|
||||
namespace Artemis.Plugins.Modules.General
|
||||
{
|
||||
public static class ColorHelpers
|
||||
{
|
||||
@ -29,22 +29,6 @@ namespace Artemis.Core
|
||||
return returnColor;
|
||||
}
|
||||
|
||||
public static Color GetRandomRainbowMediaColor()
|
||||
{
|
||||
var colors = new List<byte>();
|
||||
for (var i = 0; i < 3; i++)
|
||||
colors.Add((byte) _rand.Next(0, 256));
|
||||
|
||||
var highest = colors.Max();
|
||||
var lowest = colors.Min();
|
||||
colors[colors.FindIndex(c => c == highest)] = 255;
|
||||
colors[colors.FindIndex(c => c == lowest)] = 0;
|
||||
|
||||
var returnColor = Color.FromArgb(255, colors[0], colors[1], colors[2]);
|
||||
|
||||
return returnColor;
|
||||
}
|
||||
|
||||
public static Color ShiftColor(Color c, int shiftAmount)
|
||||
{
|
||||
int newRed = c.R;
|
||||
@ -79,12 +63,7 @@ namespace Artemis.Core
|
||||
|
||||
private static int BringIntInColorRange(int i)
|
||||
{
|
||||
if (i < 0)
|
||||
return 0;
|
||||
if (i > 255)
|
||||
return 255;
|
||||
|
||||
return i;
|
||||
return Math.Min(255, Math.Max(0, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ namespace Artemis.Plugins.Modules.General
|
||||
private readonly PluginSettings _settings;
|
||||
private readonly RGBSurface _surface;
|
||||
private Dictionary<Led, Color> _colors;
|
||||
private double _circlePosition;
|
||||
|
||||
public GeneralModule(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo)
|
||||
{
|
||||
@ -28,8 +29,9 @@ namespace Artemis.Plugins.Modules.General
|
||||
|
||||
_surface = rgbService.Surface;
|
||||
_colors = new Dictionary<Led, Color>();
|
||||
|
||||
rgbService.FinishedLoadedDevices += (sender, args) => PopulateColors();
|
||||
|
||||
rgbService.DeviceLoaded += (sender, args) => PopulateColors();
|
||||
rgbService.DeviceReloaded += (sender, args) => PopulateColors();
|
||||
|
||||
var testSetting = _settings.GetSetting("TestSetting", DateTime.Now);
|
||||
}
|
||||
@ -55,6 +57,14 @@ namespace Artemis.Plugins.Modules.General
|
||||
|
||||
public override void Render(double deltaTime, RGBSurface surface, Graphics graphics)
|
||||
{
|
||||
_circlePosition += deltaTime * 200;
|
||||
if (_circlePosition > 500)
|
||||
_circlePosition = -200;
|
||||
var rect = new Rectangle((int) _circlePosition * 4, 0 , 200, 200);
|
||||
graphics.FillEllipse(new SolidBrush(Color.Blue), rect);
|
||||
return;
|
||||
|
||||
// Lets do this in the least performant way possible
|
||||
foreach (var surfaceLed in _surface.Leds)
|
||||
{
|
||||
if (!_colors.ContainsKey(surfaceLed))
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
<package id="RGB.NET.Core" version="0.1.25" targetFramework="net472" />
|
||||
<package id="Stylet" version="1.1.17" targetFramework="net461" />
|
||||
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -108,9 +108,6 @@
|
||||
<Reference Include="RGB.NET.Decorators, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Decorators.0.1.25\lib\net45\RGB.NET.Decorators.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RGB.NET.Devices.Corsair, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Devices.Corsair.0.1.25\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RGB.NET.Groups, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RGB.NET.Groups.0.1.25\lib\net45\RGB.NET.Groups.dll</HintPath>
|
||||
</Reference>
|
||||
@ -309,13 +306,11 @@
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props'))" />
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets" Condition="Exists('..\packages\RGB.NET.Resources.Corsair.0.3.0.234\build\RGB.NET.Resources.Corsair.targets')" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
|
||||
|
||||
@ -71,13 +71,37 @@ namespace Artemis.UI.ViewModels.Controls.RgbDevice
|
||||
|
||||
public void Update()
|
||||
{
|
||||
FillColor = Color.FromRgb((byte) Math.Round(255 * Led.Color.R), (byte) Math.Round(255 * Led.Color.G), (byte) Math.Round(255 * Led.Color.B));
|
||||
X = Led.LedRectangle.X;
|
||||
Y = Led.LedRectangle.Y;
|
||||
Width = Led.LedRectangle.Width;
|
||||
Height = Led.LedRectangle.Height;
|
||||
// Not leveraging on OnPropertyChanged since that'll update for each updated property
|
||||
var changed = false;
|
||||
|
||||
if (DisplayDrawing != null)
|
||||
var newFillColor = Color.FromRgb((byte) Math.Round(255 * Led.Color.R), (byte) Math.Round(255 * Led.Color.G), (byte) Math.Round(255 * Led.Color.B));
|
||||
if (!newFillColor.Equals(FillColor))
|
||||
{
|
||||
FillColor = newFillColor;
|
||||
changed = true;
|
||||
}
|
||||
if (Math.Abs(Led.LedRectangle.X - X) > 0.1)
|
||||
{
|
||||
X = Led.LedRectangle.X;
|
||||
changed = true;
|
||||
}
|
||||
if (Math.Abs(Led.LedRectangle.Y - Y) > 0.1)
|
||||
{
|
||||
Y = Led.LedRectangle.Y;
|
||||
changed = true;
|
||||
}
|
||||
if (Math.Abs(Led.LedRectangle.Width - Width) > 0.1)
|
||||
{
|
||||
Width = Led.LedRectangle.Width;
|
||||
changed = true;
|
||||
}
|
||||
if (Math.Abs(Led.LedRectangle.Height - Height) > 0.1)
|
||||
{
|
||||
Height = Led.LedRectangle.Height;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (DisplayDrawing != null && changed)
|
||||
{
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
|
||||
@ -28,7 +28,7 @@ namespace Artemis.UI.ViewModels.Screens
|
||||
|
||||
// Sync up with the plugin service
|
||||
Modules = new BindableCollection<Module>();
|
||||
Modules.AddRange(_pluginService.GetPluginsOfType<Module>());
|
||||
// Modules.AddRange(_pluginService.GetPluginsOfType<Module>());
|
||||
|
||||
_pluginService.PluginEnabled += PluginServiceOnPluginEnabled;
|
||||
_pluginService.PluginDisabled += PluginServiceOnPluginDisabled;
|
||||
|
||||
@ -17,9 +17,7 @@
|
||||
<package id="RGB.NET.Brushes" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Core" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Decorators" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Devices.Corsair" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Groups" version="0.1.25" targetFramework="net472" />
|
||||
<package id="RGB.NET.Resources.Corsair" version="0.3.0.234" targetFramework="net461" />
|
||||
<package id="SharpVectors.Reloaded" version="1.3.0" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.bundle_green" version="1.1.12" targetFramework="net472" />
|
||||
<package id="SQLitePCLRaw.core" version="1.1.12" targetFramework="net472" />
|
||||
|
||||
@ -7,6 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.UI", "Artemis.UI\Ar
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E592F239-FAA0-4840-9C85-46E5867D06D5} = {E592F239-FAA0-4840-9C85-46E5867D06D5}
|
||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2} = {0F288A66-6EB0-4589-8595-E33A3A3EAEA2}
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D} = {A779B2F8-C253-4C4B-8634-6EB8F594E96D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Storage", "Artemis.Storage\Artemis.Storage.csproj", "{E489E5E3-1A65-4AF5-A1EA-F9805FD19A65}"
|
||||
@ -19,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins.Modules.Gen
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins.LayerTypes.Brush", "Artemis.Plugins.LayerTypes.Brush\Artemis.Plugins.LayerTypes.Brush.csproj", "{0F288A66-6EB0-4589-8595-E33A3A3EAEA2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis.Plugins.Devices.Corsair", "Artemis.Plugins.Devices.Corsair\Artemis.Plugins.Devices.Corsair.csproj", "{A779B2F8-C253-4C4B-8634-6EB8F594E96D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -67,6 +70,14 @@ Global
|
||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -74,6 +85,7 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{E592F239-FAA0-4840-9C85-46E5867D06D5} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
{0F288A66-6EB0-4589-8595-E33A3A3EAEA2} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
{A779B2F8-C253-4C4B-8634-6EB8F594E96D} = {E830A02B-A7E5-4A6B-943F-76B0A542630C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user