mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Experimental Corsair support
This commit is contained in:
parent
e8c6951e89
commit
51797c15f6
@ -204,7 +204,7 @@
|
||||
<value>TypeWave</value>
|
||||
</setting>
|
||||
<setting name="LastKeyboard" serializeAs="String">
|
||||
<value>Logitech G910 Orion Spark</value>
|
||||
<value>Razer BlackWidow Chroma</value>
|
||||
</setting>
|
||||
<setting name="EnablePointersUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
|
||||
@ -24,7 +24,6 @@ namespace Artemis
|
||||
MessageBox.Show("Startup failed :c \n" + ex.InnerException.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,6 +38,8 @@
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
@ -87,6 +89,10 @@
|
||||
<HintPath>..\packages\Colore.3.0.2\lib\net35\Corale.Colore.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CUE.NET, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CUE.NET.1.0.0\lib\net45\CUE.NET.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.4\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -134,6 +140,10 @@
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="VioletTape.WpfExceptionViewer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bfd09609f6784d58, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WpfExceptionViewer.1.0.0.0\lib\VioletTape.WpfExceptionViewer.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@ -269,6 +279,7 @@
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
||||
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModel.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="Views\EffectsView.xaml.cs">
|
||||
<DependentUpon>EffectsView.xaml</DependentUpon>
|
||||
@ -306,6 +317,9 @@
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayView.xaml.cs">
|
||||
<DependentUpon>VolumeDisplayView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\SettingsView.xaml.cs">
|
||||
<DependentUpon>SettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ShellView.xaml.cs">
|
||||
<DependentUpon>ShellView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -347,6 +361,7 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="MyMemory-x64.dll" />
|
||||
<None Include="packages.config" />
|
||||
<AppDesigner Include="Properties\" />
|
||||
<None Include="Settings\Offsets.settings">
|
||||
@ -415,6 +430,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SettingsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ShellView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -429,9 +448,6 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Resource Include="logo.ico" />
|
||||
<Content Include="MyMemory-x64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\gamestateConfigFileCsGo.txt" />
|
||||
<Resource Include="Resources\Entypo-license.txt" />
|
||||
<Resource Include="Resources\WindowsIcons-license.txt" />
|
||||
@ -449,6 +465,13 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\CUE.NET.1.0.0\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.0.0\build\net45\CUE.NET.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\CUE.NET.1.0.0\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.0.0\build\net45\CUE.NET.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@ -1,16 +1,23 @@
|
||||
using System.Drawing;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Devices.Keyboard;
|
||||
|
||||
namespace Artemis.KeyboardProviders.Corsair
|
||||
{
|
||||
internal class K95 : KeyboardProvider
|
||||
internal class K70 : KeyboardProvider
|
||||
{
|
||||
public K95()
|
||||
private CorsairKeyboard _keyboard;
|
||||
|
||||
public K70()
|
||||
{
|
||||
Name = "Corsair Gaming K95 RGB";
|
||||
Name = "Corsair Gaming K70 RGB";
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_keyboard = CueSDK.KeyboardSDK;
|
||||
_keyboard.UpdateMode = UpdateMode.Manual;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
@ -19,6 +26,16 @@ namespace Artemis.KeyboardProviders.Corsair
|
||||
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
// TODO: Resize bitmap to keyboard's size
|
||||
//if (bitmap.Width > width || bitmap.Height > height)
|
||||
// bitmap = ResizeImage(bitmap, width, height);
|
||||
|
||||
// One way of doing this, not sure at all if it's any good
|
||||
for (var y = 0; y < bitmap.Height - 1; y++)
|
||||
for (var x = 0; x < bitmap.Width - 1; x++)
|
||||
_keyboard[new PointF(x, y)].Led.Color = bitmap.GetPixel(x, y);
|
||||
|
||||
_keyboard.Update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,23 @@
|
||||
using System.Drawing;
|
||||
using CUE.NET;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Devices.Keyboard;
|
||||
|
||||
namespace Artemis.KeyboardProviders.Corsair
|
||||
{
|
||||
internal class K70 : KeyboardProvider
|
||||
internal class K95 : KeyboardProvider
|
||||
{
|
||||
public K70()
|
||||
private CorsairKeyboard _keyboard;
|
||||
|
||||
public K95()
|
||||
{
|
||||
Name = "Corsair Gaming K70 RGB";
|
||||
Name = "Corsair Gaming K95 RGB";
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
_keyboard = CueSDK.KeyboardSDK;
|
||||
_keyboard.UpdateMode = UpdateMode.Manual;
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
@ -19,7 +26,16 @@ namespace Artemis.KeyboardProviders.Corsair
|
||||
|
||||
public override void DrawBitmap(Bitmap bitmap)
|
||||
{
|
||||
// TODO: Convert bitmap to something tasty for CUE.NET
|
||||
// TODO: Resize bitmap to keyboard's size
|
||||
//if (bitmap.Width > width || bitmap.Height > height)
|
||||
// bitmap = ResizeImage(bitmap, width, height);
|
||||
|
||||
// One way of doing this, not sure at all if it's any good
|
||||
for (var y = 0; y < bitmap.Height - 1; y++)
|
||||
for (var x = 0; x < bitmap.Width - 1; x++)
|
||||
_keyboard[new PointF(x, y)].Led.Color = bitmap.GetPixel(x, y);
|
||||
|
||||
_keyboard.Update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using Artemis.KeyboardProviders.Logitech.Utilities;
|
||||
|
||||
|
||||
2
Artemis/Artemis/Settings/General.Designer.cs
generated
2
Artemis/Artemis/Settings/General.Designer.cs
generated
@ -37,7 +37,7 @@ namespace Artemis.Settings {
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 Orion Spark")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Razer BlackWidow Chroma")]
|
||||
public string LastKeyboard {
|
||||
get {
|
||||
return ((string)(this["LastKeyboard"]));
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastEffect" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">TypeWave</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Logitech G910 Orion Spark</Value>
|
||||
<Value Profile="(Default)">Razer BlackWidow Chroma</Value>
|
||||
</Setting>
|
||||
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
|
||||
53
Artemis/Artemis/ViewModels/SettingsViewModel.cs
Normal file
53
Artemis/Artemis/ViewModels/SettingsViewModel.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Artemis.Models;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.ViewModels
|
||||
{
|
||||
internal sealed class ShellViewModel : Conductor<IScreen>.Collection.OneActive
|
||||
{
|
||||
public ShellViewModel()
|
||||
{
|
||||
IEventAggregator events = new EventAggregator();
|
||||
MainModel = new MainModel(events);
|
||||
|
||||
DisplayName = "Artemis";
|
||||
|
||||
ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"});
|
||||
ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"});
|
||||
ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"});
|
||||
|
||||
// By now Effects are added to the MainModel so we can savely start one
|
||||
ToggleEffects();
|
||||
}
|
||||
|
||||
public bool EffectsEnabled
|
||||
{
|
||||
get { return MainModel.Enabled; }
|
||||
private set
|
||||
{
|
||||
MainModel.Enabled = value;
|
||||
NotifyOfPropertyChange(() => EffectsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
|
||||
public void ToggleEffects()
|
||||
{
|
||||
if (EffectsEnabled)
|
||||
MainModel.ShutdownEffects();
|
||||
else
|
||||
MainModel.StartEffects();
|
||||
|
||||
EffectsEnabled = !EffectsEnabled;
|
||||
}
|
||||
|
||||
public void OnClose(EventArgs e)
|
||||
{
|
||||
MainModel.ShutdownEffects();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,53 +1,12 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Artemis.Models;
|
||||
using Caliburn.Micro;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.ViewModels
|
||||
{
|
||||
internal sealed class ShellViewModel : Conductor<IScreen>.Collection.OneActive
|
||||
internal sealed class SettingsViewModel : Conductor<IScreen>.Collection.OneActive
|
||||
{
|
||||
public ShellViewModel()
|
||||
public SettingsViewModel()
|
||||
{
|
||||
IEventAggregator events = new EventAggregator();
|
||||
MainModel = new MainModel(events);
|
||||
|
||||
DisplayName = "Artemis";
|
||||
|
||||
ActivateItem(new EffectsViewModel(MainModel) {DisplayName = "Effects"});
|
||||
ActivateItem(new GamesViewModel(MainModel) {DisplayName = "Games"});
|
||||
ActivateItem(new OverlaysViewModel(MainModel) {DisplayName = "Overlays"});
|
||||
|
||||
// By now Effects are added to the MainModel so we can savely start one
|
||||
ToggleEffects();
|
||||
}
|
||||
|
||||
public bool EffectsEnabled
|
||||
{
|
||||
get { return MainModel.Enabled; }
|
||||
private set
|
||||
{
|
||||
MainModel.Enabled = value;
|
||||
NotifyOfPropertyChange(() => EffectsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
public MainModel MainModel { get; set; }
|
||||
|
||||
public void ToggleEffects()
|
||||
{
|
||||
if (EffectsEnabled)
|
||||
MainModel.ShutdownEffects();
|
||||
else
|
||||
MainModel.StartEffects();
|
||||
|
||||
EffectsEnabled = !EffectsEnabled;
|
||||
}
|
||||
|
||||
public void OnClose(EventArgs e)
|
||||
{
|
||||
MainModel.ShutdownEffects();
|
||||
Application.Current.Shutdown();
|
||||
DisplayName = "Artemis - Settings";
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Artemis/Artemis/Views/SettingsView.xaml
Normal file
13
Artemis/Artemis/Views/SettingsView.xaml
Normal file
@ -0,0 +1,13 @@
|
||||
<controls:MetroWindow x:Class="Artemis.Views.SettingsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Artemis.Views"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
Title="SettingsView" Height="300" Width="300">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</controls:MetroWindow>
|
||||
27
Artemis/Artemis/Views/SettingsView.xaml.cs
Normal file
27
Artemis/Artemis/Views/SettingsView.xaml.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Artemis.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SettingsView.xaml
|
||||
/// </summary>
|
||||
public partial class SettingsView : Window
|
||||
{
|
||||
public SettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@
|
||||
<package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Caliburn.Micro.Core" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Colore" version="3.0.2" targetFramework="net452" />
|
||||
<package id="CUE.NET" version="1.0.0" targetFramework="net452" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.5" targetFramework="net452" />
|
||||
<package id="log4net" version="2.0.4" targetFramework="net452" />
|
||||
<package id="MahApps.Metro" version="1.1.2.0" targetFramework="net452" />
|
||||
@ -11,4 +12,5 @@
|
||||
<package id="NAudio" version="1.7.3" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="Open.WinKeyboardHook" version="1.0.10.0" targetFramework="net452" />
|
||||
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user