mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
commit
38a2dc64e4
2
.gitignore
vendored
2
.gitignore
vendored
@ -68,6 +68,7 @@ ipch/
|
|||||||
*.opensdf
|
*.opensdf
|
||||||
*.sdf
|
*.sdf
|
||||||
*.cachefile
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
|
||||||
# Visual Studio profiler
|
# Visual Studio profiler
|
||||||
*.psess
|
*.psess
|
||||||
@ -189,3 +190,4 @@ FakesAssemblies/
|
|||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
# Visual Studio 6 workspace options file
|
||||||
*.opt
|
*.opt
|
||||||
|
*.opendb
|
||||||
|
|||||||
BIN
Artemis/Artemis.VC.db
Normal file
BIN
Artemis/Artemis.VC.db
Normal file
Binary file not shown.
@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.24720.0
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LogiLed2Artemis", "LogiLed2Artemis\LogiLed2Artemis.vcxproj", "{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
CD_ROM|Any CPU = CD_ROM|Any CPU
|
CD_ROM|Any CPU = CD_ROM|Any CPU
|
||||||
@ -54,6 +56,34 @@ Global
|
|||||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.Build.0 = Release|x64
|
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.Build.0 = Release|x64
|
||||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.ActiveCfg = Release|x86
|
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.ActiveCfg = Release|x86
|
||||||
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.Build.0 = Release|x86
|
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x86.Build.0 = Release|x86
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.CD_ROM|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.CD_ROM|Any CPU.Build.0 = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.CD_ROM|x64.ActiveCfg = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.CD_ROM|x64.Build.0 = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.CD_ROM|x86.ActiveCfg = Release|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.CD_ROM|x86.Build.0 = Release|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.DVD-5|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.DVD-5|Any CPU.Build.0 = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.DVD-5|x64.ActiveCfg = Debug|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.DVD-5|x64.Build.0 = Debug|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.DVD-5|x86.ActiveCfg = Debug|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.DVD-5|x86.Build.0 = Debug|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Release|x64.Build.0 = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.SingleImage|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.SingleImage|Any CPU.Build.0 = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.SingleImage|x64.ActiveCfg = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.SingleImage|x64.Build.0 = Release|x64
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.SingleImage|x86.ActiveCfg = Release|Win32
|
||||||
|
{D2EDB8F3-F0CB-4670-B472-0B46D5800D2C}.SingleImage|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -17,8 +17,9 @@
|
|||||||
<!-- Accent and AppTheme setting -->
|
<!-- Accent and AppTheme setting -->
|
||||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
|
||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
||||||
<ResourceDictionary Source="/Resources/Icons.xaml" />
|
<ResourceDictionary Source="/Resources/Icons.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/ColorBox.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
|||||||
@ -1,60 +1,60 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using WpfExceptionViewer;
|
using WpfExceptionViewer;
|
||||||
|
|
||||||
namespace Artemis
|
namespace Artemis
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for App.xaml
|
/// Interaction logic for App.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
if (!GeneralHelpers.IsRunAsAdministrator())
|
if (!GeneralHelpers.IsRunAsAdministrator())
|
||||||
GeneralHelpers.RunAsAdministrator();
|
GeneralHelpers.RunAsAdministrator();
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DoHandle { get; set; }
|
public bool DoHandle { get; set; }
|
||||||
|
|
||||||
private void Application_Startup(object sender, StartupEventArgs e)
|
private void Application_Startup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
if (DoHandle)
|
if (DoHandle)
|
||||||
{
|
{
|
||||||
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
GetArtemisExceptionViewer(e.Exception).ShowDialog();
|
||||||
e.Handled = false;
|
e.Handled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
var ex = e.ExceptionObject as Exception;
|
var ex = e.ExceptionObject as Exception;
|
||||||
GetArtemisExceptionViewer(ex).ShowDialog();
|
GetArtemisExceptionViewer(ex).ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ExceptionViewer GetArtemisExceptionViewer(Exception e)
|
private static ExceptionViewer GetArtemisExceptionViewer(Exception e)
|
||||||
{
|
{
|
||||||
return new ExceptionViewer("An unexpected error occurred in Artemis.", e)
|
return new ExceptionViewer("An unexpected error occurred in Artemis.", e)
|
||||||
{
|
{
|
||||||
Title = "Artemis - Exception :c",
|
Title = "Artemis - Exception :c",
|
||||||
Height = 400,
|
Height = 400,
|
||||||
Width = 800
|
Width = 800
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,6 +136,10 @@
|
|||||||
<HintPath>..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
|
<HintPath>..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="ColorBox, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f971124b2576acfc, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>lib\ColorBox.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Corale.Colore, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Corale.Colore, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Colore.4.0.0\lib\net35\Corale.Colore.dll</HintPath>
|
<HintPath>..\packages\Colore.4.0.0\lib\net35\Corale.Colore.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@ -145,7 +149,7 @@
|
|||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Kaliko.ImageLibrary, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Kaliko.ImageLibrary, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
@ -168,11 +172,7 @@
|
|||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Screna, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Screna.0.1.3\lib\Screna.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
<Reference Include="SharpDX, Version=3.0.2.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||||
@ -188,8 +188,13 @@
|
|||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Linq.Dynamic, Version=1.0.5840.25917, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Linq.Dynamic.1.0.6\lib\net40\System.Linq.Dynamic.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
@ -214,28 +219,28 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.DataGrid, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.DataGrid, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.6.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.Toolkit, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -249,9 +254,12 @@
|
|||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ArtemisBootstrapper.cs" />
|
<Compile Include="ArtemisBootstrapper.cs" />
|
||||||
|
<Compile Include="DAL\ProfileProvider.cs" />
|
||||||
|
<Compile Include="Events\ActiveKeyboardChanged.cs" />
|
||||||
<Compile Include="Events\ToggleEnabled.cs" />
|
<Compile Include="Events\ToggleEnabled.cs" />
|
||||||
<Compile Include="Events\ActiveEffectChanged.cs" />
|
<Compile Include="Events\ActiveEffectChanged.cs" />
|
||||||
<Compile Include="Events\ChangeBitmap.cs" />
|
<Compile Include="Events\ChangeBitmap.cs" />
|
||||||
|
<Compile Include="ItemBehaviours\BindableSelectedItemBehavior.cs" />
|
||||||
<Compile Include="KeyboardProviders\Corsair\CorsairRGB.cs" />
|
<Compile Include="KeyboardProviders\Corsair\CorsairRGB.cs" />
|
||||||
<Compile Include="KeyboardProviders\KeyboardProvider.cs" />
|
<Compile Include="KeyboardProviders\KeyboardProvider.cs" />
|
||||||
<Compile Include="KeyboardProviders\KeyboardRegion.cs" />
|
<Compile Include="KeyboardProviders\KeyboardRegion.cs" />
|
||||||
@ -269,6 +277,12 @@
|
|||||||
<Compile Include="Models\EffectModel.cs" />
|
<Compile Include="Models\EffectModel.cs" />
|
||||||
<Compile Include="Models\EffectSettings.cs" />
|
<Compile Include="Models\EffectSettings.cs" />
|
||||||
<Compile Include="Models\GameSettings.cs" />
|
<Compile Include="Models\GameSettings.cs" />
|
||||||
|
<Compile Include="Models\Interfaces\GameDataModel.cs" />
|
||||||
|
<Compile Include="Models\Profiles\LayerConditionModel.cs" />
|
||||||
|
<Compile Include="Models\Profiles\LayerModel.cs" />
|
||||||
|
<Compile Include="Models\Profiles\LayerDynamicPropertiesModel.cs" />
|
||||||
|
<Compile Include="Models\Profiles\LayerPropertiesModel.cs" />
|
||||||
|
<Compile Include="Models\Profiles\ProfileModel.cs" />
|
||||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectModel.cs" />
|
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectModel.cs" />
|
||||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectSettings.cs" />
|
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectSettings.cs" />
|
||||||
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectView.xaml.cs">
|
<Compile Include="Modules\Effects\AmbientLightning\AmbientLightningEffectView.xaml.cs">
|
||||||
@ -298,6 +312,7 @@
|
|||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Modules\Games\CounterStrike\CounterStrikeDataModel.cs" />
|
||||||
<Compile Include="Modules\Games\CounterStrike\CounterStrikeModel.cs" />
|
<Compile Include="Modules\Games\CounterStrike\CounterStrikeModel.cs" />
|
||||||
<Compile Include="Modules\Games\CounterStrike\CounterStrikeSettings.cs" />
|
<Compile Include="Modules\Games\CounterStrike\CounterStrikeSettings.cs" />
|
||||||
<Compile Include="Modules\Games\Dota2\Dota2.Designer.cs">
|
<Compile Include="Modules\Games\Dota2\Dota2.Designer.cs">
|
||||||
@ -313,6 +328,7 @@
|
|||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Modules\Games\RocketLeague\RocketLeagueDataModel.cs" />
|
||||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
|
||||||
<Compile Include="Modules\Games\TheDivision\TheDivision.Designer.cs">
|
<Compile Include="Modules\Games\TheDivision\TheDivision.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@ -366,11 +382,13 @@
|
|||||||
<DependentUpon>Offsets.settings</DependentUpon>
|
<DependentUpon>Offsets.settings</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Utilities\ColorHelpers.cs" />
|
<Compile Include="Utilities\ColorHelpers.cs" />
|
||||||
|
<Compile Include="Utilities\ExtensionMethods.cs" />
|
||||||
<Compile Include="Utilities\GameState\GameDataReceivedEventArgs.cs" />
|
<Compile Include="Utilities\GameState\GameDataReceivedEventArgs.cs" />
|
||||||
<Compile Include="Utilities\GameState\GameStateWebServer.cs" />
|
<Compile Include="Utilities\GameState\GameStateWebServer.cs" />
|
||||||
<Compile Include="Utilities\GeneralHelpers.cs" />
|
<Compile Include="Utilities\GeneralHelpers.cs" />
|
||||||
<Compile Include="Utilities\ImageUtilities.cs" />
|
<Compile Include="Utilities\ImageUtilities.cs" />
|
||||||
<Compile Include="Utilities\Keyboard\KeyboardHook.cs" />
|
<Compile Include="Utilities\Keyboard\KeyboardHook.cs" />
|
||||||
|
<Compile Include="Utilities\LayerDrawer.cs" />
|
||||||
<Compile Include="Utilities\LogitechDll\DllManager.cs" />
|
<Compile Include="Utilities\LogitechDll\DllManager.cs" />
|
||||||
<Compile Include="Utilities\LogitechDll\NamedPipeServer.cs" />
|
<Compile Include="Utilities\LogitechDll\NamedPipeServer.cs" />
|
||||||
<Compile Include="Utilities\LogitechDll\PipeServer.cs" />
|
<Compile Include="Utilities\LogitechDll\PipeServer.cs" />
|
||||||
@ -380,9 +398,12 @@
|
|||||||
<Compile Include="Utilities\Memory\Win32.cs" />
|
<Compile Include="Utilities\Memory\Win32.cs" />
|
||||||
<Compile Include="Utilities\Keyboard\Key.cs" />
|
<Compile Include="Utilities\Keyboard\Key.cs" />
|
||||||
<Compile Include="Utilities\Keyboard\KeyboardRectangle.cs" />
|
<Compile Include="Utilities\Keyboard\KeyboardRectangle.cs" />
|
||||||
|
<Compile Include="Utilities\ParentChild\ChildItemCollection.cs" />
|
||||||
|
<Compile Include="Utilities\ParentChild\IChildItem.cs" />
|
||||||
<Compile Include="Utilities\ShellLink.cs" />
|
<Compile Include="Utilities\ShellLink.cs" />
|
||||||
<Compile Include="Utilities\StickyValue.cs" />
|
<Compile Include="Utilities\StickyValue.cs" />
|
||||||
<Compile Include="Utilities\Updater.cs" />
|
<Compile Include="Utilities\Updater.cs" />
|
||||||
|
<Compile Include="Utilities\ValueConverters.cs" />
|
||||||
<Compile Include="ViewModels\Abstract\EffectViewModel.cs" />
|
<Compile Include="ViewModels\Abstract\EffectViewModel.cs" />
|
||||||
<Compile Include="ViewModels\Abstract\GameViewModel.cs" />
|
<Compile Include="ViewModels\Abstract\GameViewModel.cs" />
|
||||||
<Compile Include="ViewModels\EffectsViewModel.cs" />
|
<Compile Include="ViewModels\EffectsViewModel.cs" />
|
||||||
@ -397,8 +418,12 @@
|
|||||||
<Compile Include="Modules\Games\Dota2\Dota2ViewModel.cs" />
|
<Compile Include="Modules\Games\Dota2\Dota2ViewModel.cs" />
|
||||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueViewModel.cs" />
|
<Compile Include="Modules\Games\RocketLeague\RocketLeagueViewModel.cs" />
|
||||||
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\LayerEditor\LayerConditionViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\LayerEditor\LayerDynamicPropertiesViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\LayerEditor\LayerEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
||||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ProfileEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||||
<Compile Include="ViewModels\SystemTrayViewModel.cs" />
|
<Compile Include="ViewModels\SystemTrayViewModel.cs" />
|
||||||
<Compile Include="ViewModels\WelcomeViewModel.cs" />
|
<Compile Include="ViewModels\WelcomeViewModel.cs" />
|
||||||
@ -435,12 +460,24 @@
|
|||||||
<Compile Include="Modules\Games\Witcher3\Witcher3View.xaml.cs">
|
<Compile Include="Modules\Games\Witcher3\Witcher3View.xaml.cs">
|
||||||
<DependentUpon>Witcher3View.xaml</DependentUpon>
|
<DependentUpon>Witcher3View.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\LayerEditor\LayerConditionView.xaml.cs">
|
||||||
|
<DependentUpon>LayerConditionView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\LayerEditor\LayerDynamicPropertiesView.xaml.cs">
|
||||||
|
<DependentUpon>LayerDynamicPropertiesView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\LayerEditor\LayerEditorView.xaml.cs">
|
||||||
|
<DependentUpon>LayerEditorView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\OverlaysView.xaml.cs">
|
<Compile Include="Views\OverlaysView.xaml.cs">
|
||||||
<DependentUpon>OverlaysView.xaml</DependentUpon>
|
<DependentUpon>OverlaysView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayView.xaml.cs">
|
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayView.xaml.cs">
|
||||||
<DependentUpon>VolumeDisplayView.xaml</DependentUpon>
|
<DependentUpon>VolumeDisplayView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\ProfileEditorView.xaml.cs">
|
||||||
|
<DependentUpon>ProfileEditorView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\ShellView.xaml.cs">
|
<Compile Include="Views\ShellView.xaml.cs">
|
||||||
<DependentUpon>ShellView.xaml</DependentUpon>
|
<DependentUpon>ShellView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -457,8 +494,8 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="Modules\Effects\AudioVisualizer\AudioVisualization.settings">
|
<None Include="Modules\Effects\AudioVisualizer\AudioVisualization.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
@ -495,18 +532,24 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<AppDesigner Include="Properties\" />
|
<AppDesigner Include="Properties\" />
|
||||||
<Resource Include="Resources\bow.png" />
|
<Resource Include="Resources\bow.png" />
|
||||||
<Resource Include="Resources\WindowsIcons-license.txt" />
|
|
||||||
<Resource Include="Resources\Entypo-license.txt" />
|
|
||||||
<Content Include="logo.ico">
|
<Content Include="logo.ico">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Resource Include="Resources\logo.ico" />
|
<Resource Include="Resources\logo.ico" />
|
||||||
<Resource Include="Resources\logo-disabled.ico" />
|
<Resource Include="Resources\logo-disabled.ico" />
|
||||||
<Resource Include="Resources\Dota2\dotaGamestateConfiguration.txt" />
|
<Resource Include="Resources\Dota2\dotaGamestateConfiguration.txt" />
|
||||||
|
<Resource Include="Resources\Entypo.ttf" />
|
||||||
<None Include="Resources\LogitechLED.dll" />
|
<None Include="Resources\LogitechLED.dll" />
|
||||||
|
<None Include="Resources\folder.png" />
|
||||||
|
<Resource Include="Resources\Keyboards\k65.png" />
|
||||||
|
<Resource Include="Resources\Keyboards\k70.png" />
|
||||||
|
<Resource Include="Resources\Keyboards\k95.png" />
|
||||||
|
<Resource Include="Resources\Keyboards\strafe.png" />
|
||||||
|
<Resource Include="Resources\Keyboards\g910.png" />
|
||||||
|
<Resource Include="Resources\WindowsIcons-license.txt" />
|
||||||
|
<Resource Include="Resources\Entypo-license.txt" />
|
||||||
<Content Include="Resources\Witcher3\playerWitcher.txt" />
|
<Content Include="Resources\Witcher3\playerWitcher.txt" />
|
||||||
<Content Include="Resources\Witcher3\artemis.txt" />
|
<Content Include="Resources\Witcher3\artemis.txt" />
|
||||||
<Resource Include="Resources\Entypo.ttf" />
|
|
||||||
<None Include="Settings\Offsets.settings">
|
<None Include="Settings\Offsets.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Offsets.Designer.cs</LastGenOutput>
|
<LastGenOutput>Offsets.Designer.cs</LastGenOutput>
|
||||||
@ -532,6 +575,14 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Styles\Accents\CorsairYellow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Styles\ColorBox.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\EffectsView.xaml">
|
<Page Include="Views\EffectsView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -576,6 +627,18 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\LayerEditor\LayerConditionView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\LayerEditor\LayerDynamicPropertiesView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\LayerEditor\LayerEditorView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\OverlaysView.xaml">
|
<Page Include="Views\OverlaysView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -584,6 +647,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\ProfileEditorView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\ShellView.xaml">
|
<Page Include="Views\ShellView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@ -1,50 +1,92 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Windows;
|
||||||
using System.Windows;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.ViewModels;
|
using Artemis.ViewModels;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
using Caliburn.Micro.Autofac;
|
using Caliburn.Micro.Autofac;
|
||||||
using Application = System.Windows.Application;
|
using Application = System.Windows.Application;
|
||||||
using MessageBox = System.Windows.Forms.MessageBox;
|
using MessageBox = System.Windows.Forms.MessageBox;
|
||||||
|
|
||||||
namespace Artemis
|
namespace Artemis
|
||||||
{
|
{
|
||||||
public class ArtemisBootstrapper : AutofacBootstrapper<SystemTrayViewModel>
|
public class ArtemisBootstrapper : AutofacBootstrapper<SystemTrayViewModel>
|
||||||
{
|
{
|
||||||
public ArtemisBootstrapper()
|
public ArtemisBootstrapper()
|
||||||
{
|
{
|
||||||
CheckDuplicateInstances();
|
CheckDuplicateInstances();
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
|
||||||
|
MessageBinder.SpecialValues.Add("$scaledmousex", (ctx) =>
|
||||||
protected override void ConfigureContainer(ContainerBuilder builder)
|
{
|
||||||
{
|
var img = ctx.Source as Image;
|
||||||
base.ConfigureContainer(builder);
|
var input = ctx.Source as IInputElement;
|
||||||
|
var e = ctx.EventArgs as System.Windows.Input.MouseEventArgs;
|
||||||
// create a window manager instance to be used by everyone asking for one (including Caliburn.Micro)
|
|
||||||
builder.RegisterInstance<IWindowManager>(new WindowManager());
|
// If there is an image control, get the scaled position
|
||||||
builder.RegisterType<SystemTrayViewModel>();
|
if (img != null && e != null)
|
||||||
builder.RegisterType<ShellViewModel>();
|
{
|
||||||
}
|
Point position = e.GetPosition(img);
|
||||||
|
return (int)(img.Source.Width * (position.X / img.ActualWidth));
|
||||||
protected override void OnStartup(object sender, StartupEventArgs e)
|
}
|
||||||
{
|
|
||||||
DisplayRootViewFor<SystemTrayViewModel>();
|
// If there is another type of of IInputControl get the non-scaled position - or do some processing to get a scaled position, whatever needs to happen
|
||||||
}
|
if (e != null && input != null)
|
||||||
|
return e.GetPosition(input).X;
|
||||||
private void CheckDuplicateInstances()
|
|
||||||
{
|
// Return 0 if no processing could be done
|
||||||
if (Process.GetProcesses().Count(p => p.ProcessName.Contains(Assembly.GetExecutingAssembly()
|
return 0;
|
||||||
.FullName.Split(',')[0]) && !p.Modules[0].FileName.Contains("vshost")) < 2)
|
});
|
||||||
return;
|
MessageBinder.SpecialValues.Add("$scaledmousey", (ctx) =>
|
||||||
|
{
|
||||||
MessageBox.Show("An instance of Artemis is already running (check your system tray).",
|
var img = ctx.Source as Image;
|
||||||
"Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
var input = ctx.Source as IInputElement;
|
||||||
Application.Current.Shutdown();
|
var e = ctx.EventArgs as System.Windows.Input.MouseEventArgs;
|
||||||
}
|
|
||||||
}
|
// If there is an image control, get the scaled position
|
||||||
|
if (img != null && e != null)
|
||||||
|
{
|
||||||
|
Point position = e.GetPosition(img);
|
||||||
|
return (int)(img.Source.Width * (position.Y / img.ActualWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is another type of of IInputControl get the non-scaled position - or do some processing to get a scaled position, whatever needs to happen
|
||||||
|
if (e != null && input != null)
|
||||||
|
return e.GetPosition(input).Y;
|
||||||
|
|
||||||
|
// Return 0 if no processing could be done
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ConfigureContainer(ContainerBuilder builder)
|
||||||
|
{
|
||||||
|
base.ConfigureContainer(builder);
|
||||||
|
|
||||||
|
// create a window manager instance to be used by everyone asking for one (including Caliburn.Micro)
|
||||||
|
builder.RegisterInstance<IWindowManager>(new WindowManager());
|
||||||
|
builder.RegisterType<SystemTrayViewModel>();
|
||||||
|
builder.RegisterType<ShellViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStartup(object sender, StartupEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayRootViewFor<SystemTrayViewModel>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckDuplicateInstances()
|
||||||
|
{
|
||||||
|
var processes = Process.GetProcesses();
|
||||||
|
if (processes.Count(p => p.ProcessName == "Artemis") < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MessageBox.Show("An instance of Artemis is already running (check your system tray).",
|
||||||
|
"Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
91
Artemis/Artemis/DAL/ProfileProvider.cs
Normal file
91
Artemis/Artemis/DAL/ProfileProvider.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using Artemis.Models;
|
||||||
|
using Artemis.Models.Profiles;
|
||||||
|
|
||||||
|
namespace Artemis.DAL
|
||||||
|
{
|
||||||
|
public static class ProfileProvider
|
||||||
|
{
|
||||||
|
private static readonly string ProfileFolder =
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\profiles";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all profiles
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>All profiles</returns>
|
||||||
|
public static List<ProfileModel> GetAll()
|
||||||
|
{
|
||||||
|
return ReadProfiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all profiles matching the provided game
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="game">The game to match</param>
|
||||||
|
/// <returns>All profiles matching the provided game</returns>
|
||||||
|
public static List<ProfileModel> GetAll(GameModel game)
|
||||||
|
{
|
||||||
|
return GetAll().Where(g => g.GameName.Equals(game.Name)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds or update the given profile.
|
||||||
|
/// Updates occur when a profile with the same name and game exist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prof">The profile to add or update</param>
|
||||||
|
public static void AddOrUpdate(ProfileModel prof)
|
||||||
|
{
|
||||||
|
if (!(prof.GameName?.Length > 1) || !(prof.KeyboardName?.Length > 1) || !(prof.Name?.Length > 1))
|
||||||
|
throw new ArgumentException("Profile is invalid. Name, GameName and KeyboardName are required");
|
||||||
|
|
||||||
|
var path = ProfileFolder + $@"\{prof.KeyboardName}\{prof.GameName}";
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
var serializer = new XmlSerializer(typeof (ProfileModel));
|
||||||
|
using (var file = new StreamWriter(path + $@"\{prof.Name}.xml"))
|
||||||
|
{
|
||||||
|
serializer.Serialize(file, prof);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<ProfileModel> ReadProfiles()
|
||||||
|
{
|
||||||
|
CheckProfiles();
|
||||||
|
var profiles = new List<ProfileModel>();
|
||||||
|
|
||||||
|
// Create the directory structure
|
||||||
|
var profilePaths = Directory.GetFiles(ProfileFolder, "*.xml", SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
// Parse the JSON files into objects and add them if they are valid
|
||||||
|
// TODO: Invalid file handling
|
||||||
|
var deserializer = new XmlSerializer(typeof (ProfileModel));
|
||||||
|
foreach (var path in profilePaths)
|
||||||
|
{
|
||||||
|
using (var file = new StreamReader(path))
|
||||||
|
{
|
||||||
|
var prof = (ProfileModel) deserializer.Deserialize(file);
|
||||||
|
if (prof.GameName?.Length > 1 && prof.KeyboardName?.Length > 1 && prof.Name?.Length > 1)
|
||||||
|
profiles.Add(prof);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return profiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckProfiles()
|
||||||
|
{
|
||||||
|
// Create the directory structure
|
||||||
|
if (Directory.Exists(ProfileFolder))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Directory.CreateDirectory(ProfileFolder);
|
||||||
|
Debug.WriteLine("Place presets");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
namespace Artemis.Events
|
namespace Artemis.Events
|
||||||
{
|
{
|
||||||
public class ActiveEffectChanged
|
public class ActiveEffectChanged
|
||||||
{
|
{
|
||||||
public ActiveEffectChanged(string activeEffect)
|
public ActiveEffectChanged(string activeEffect)
|
||||||
{
|
{
|
||||||
ActiveEffect = activeEffect;
|
ActiveEffect = activeEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ActiveEffect { get; set; }
|
public string ActiveEffect { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
12
Artemis/Artemis/Events/ActiveKeyboardChanged.cs
Normal file
12
Artemis/Artemis/Events/ActiveKeyboardChanged.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Artemis.Events
|
||||||
|
{
|
||||||
|
public class ActiveKeyboardChanged
|
||||||
|
{
|
||||||
|
public ActiveKeyboardChanged(string activeKeyboard)
|
||||||
|
{
|
||||||
|
ActiveKeyboard = activeKeyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ActiveKeyboard { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,19 +1,19 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Artemis.Events
|
namespace Artemis.Events
|
||||||
{
|
{
|
||||||
public class ChangeBitmap
|
public class ChangeBitmap
|
||||||
{
|
{
|
||||||
public ChangeBitmap(Bitmap bitmap)
|
public ChangeBitmap(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
Bitmap = bitmap;
|
Bitmap = bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap Bitmap { get; private set; }
|
public Bitmap Bitmap { get; private set; }
|
||||||
|
|
||||||
public void ChangeTextMessage(Bitmap bitmap)
|
public void ChangeTextMessage(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
Bitmap = bitmap;
|
Bitmap = bitmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,12 @@
|
|||||||
namespace Artemis.Events
|
namespace Artemis.Events
|
||||||
{
|
{
|
||||||
public class ToggleEnabled
|
public class ToggleEnabled
|
||||||
{
|
{
|
||||||
public ToggleEnabled(bool enabled)
|
public ToggleEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
Enabled = enabled;
|
Enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Interactivity;
|
||||||
|
|
||||||
|
namespace Artemis.ItemBehaviours
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Steve Greatrex - http://stackoverflow.com/a/5118406/5015269
|
||||||
|
/// </summary>
|
||||||
|
public class BindableSelectedItemBehavior : Behavior<TreeView>
|
||||||
|
{
|
||||||
|
protected override void OnAttached()
|
||||||
|
{
|
||||||
|
base.OnAttached();
|
||||||
|
|
||||||
|
AssociatedObject.SelectedItemChanged += OnTreeViewSelectedItemChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDetaching()
|
||||||
|
{
|
||||||
|
base.OnDetaching();
|
||||||
|
|
||||||
|
if (AssociatedObject != null)
|
||||||
|
AssociatedObject.SelectedItemChanged -= OnTreeViewSelectedItemChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||||
|
{
|
||||||
|
SelectedItem = e.NewValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region SelectedItem Property
|
||||||
|
|
||||||
|
public object SelectedItem
|
||||||
|
{
|
||||||
|
get { return GetValue(SelectedItemProperty); }
|
||||||
|
set { SetValue(SelectedItemProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem",
|
||||||
|
typeof (object), typeof (BindableSelectedItemBehavior), new UIPropertyMetadata(null, OnSelectedItemChanged));
|
||||||
|
|
||||||
|
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var item = ((BindableSelectedItemBehavior) sender).AssociatedObject
|
||||||
|
.ItemContainerGenerator.ContainerFromItem(e.NewValue) as TreeViewItem;
|
||||||
|
if (item != null)
|
||||||
|
item.SetValue(TreeViewItem.IsSelectedProperty, true);
|
||||||
|
else
|
||||||
|
ClearTreeViewSelection(((BindableSelectedItemBehavior) sender).AssociatedObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears a TreeView's selected item recursively
|
||||||
|
/// Tom Wright - http://stackoverflow.com/a/1406116/5015269
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tv"></param>
|
||||||
|
public static void ClearTreeViewSelection(TreeView tv)
|
||||||
|
{
|
||||||
|
if (tv != null)
|
||||||
|
ClearTreeViewItemsControlSelection(tv.Items, tv.ItemContainerGenerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears a TreeView's selected item recursively
|
||||||
|
/// Tom Wright - http://stackoverflow.com/a/1406116/5015269
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ic"></param>
|
||||||
|
/// <param name="icg"></param>
|
||||||
|
private static void ClearTreeViewItemsControlSelection(ICollection ic, ItemContainerGenerator icg)
|
||||||
|
{
|
||||||
|
if ((ic == null) || (icg == null))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (var i = 0; i < ic.Count; i++)
|
||||||
|
{
|
||||||
|
var tvi = icg.ContainerFromIndex(i) as TreeViewItem;
|
||||||
|
if (tvi == null)
|
||||||
|
continue;
|
||||||
|
ClearTreeViewItemsControlSelection(tvi.Items, tvi.ItemContainerGenerator);
|
||||||
|
tvi.IsSelected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,20 +1,22 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using CUE.NET;
|
using CUE.NET;
|
||||||
using CUE.NET.Brushes;
|
using CUE.NET.Brushes;
|
||||||
using CUE.NET.Devices.Generic.Enums;
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
using CUE.NET.Devices.Headset;
|
|
||||||
using CUE.NET.Devices.Keyboard;
|
using CUE.NET.Devices.Keyboard;
|
||||||
using CUE.NET.Devices.Mouse;
|
|
||||||
using CUE.NET.Exceptions;
|
using CUE.NET.Exceptions;
|
||||||
|
using Point = System.Drawing.Point;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders.Corsair
|
namespace Artemis.KeyboardProviders.Corsair
|
||||||
{
|
{
|
||||||
internal class CorsairRGB : KeyboardProvider
|
internal class CorsairRGB : KeyboardProvider
|
||||||
{
|
{
|
||||||
private CorsairKeyboard _keyboard;
|
private CorsairKeyboard _keyboard;
|
||||||
|
|
||||||
public CorsairRGB()
|
public CorsairRGB()
|
||||||
{
|
{
|
||||||
Name = "Corsair RGB Keyboards";
|
Name = "Corsair RGB Keyboards";
|
||||||
@ -74,6 +76,7 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
case "K95 RGB":
|
case "K95 RGB":
|
||||||
Height = 7;
|
Height = 7;
|
||||||
Width = 25;
|
Width = 25;
|
||||||
|
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0,-15,0,0), Resources.k95);
|
||||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(20, 1)));
|
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(20, 1)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(21, 2), new Point(25, 7)));
|
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(21, 2), new Point(25, 7)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(5, 3), new Point(8, 3)));
|
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(5, 3), new Point(8, 3)));
|
||||||
@ -81,6 +84,7 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
case "K70 RGB":
|
case "K70 RGB":
|
||||||
Height = 7;
|
Height = 7;
|
||||||
Width = 21;
|
Width = 21;
|
||||||
|
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k70);
|
||||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(21, 7)));
|
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(21, 7)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 3), new Point(5, 3)));
|
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 3), new Point(5, 3)));
|
||||||
@ -88,16 +92,18 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
case "K65 RGB":
|
case "K65 RGB":
|
||||||
Height = 7;
|
Height = 7;
|
||||||
Width = 18;
|
Width = 18;
|
||||||
|
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k65);
|
||||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(20, 7)));
|
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(17, 2), new Point(20, 7)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 3), new Point(5, 3)));
|
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 3), new Point(5, 3)));
|
||||||
break;
|
break;
|
||||||
case "STRAFE RGB":
|
case "STRAFE RGB":
|
||||||
Height = 6;
|
Height = 6;
|
||||||
|
Width = 22;
|
||||||
|
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.strafe);
|
||||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 1), new Point(18, 1)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(18, 2), new Point(22, 7)));
|
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(18, 2), new Point(22, 7)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(1, 3), new Point(4, 3)));
|
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(1, 3), new Point(4, 3)));
|
||||||
Width = 22;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +112,7 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
{
|
{
|
||||||
CueSDK.Reinitialize();
|
CueSDK.Reinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap
|
/// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap
|
||||||
/// size.
|
/// size.
|
||||||
@ -118,7 +124,7 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
using (var g = Graphics.FromImage(fixedBmp))
|
using (var g = Graphics.FromImage(fixedBmp))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Black);
|
g.Clear(Color.Black);
|
||||||
g.DrawImage(bitmap, 0,0);
|
g.DrawImage(bitmap, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var fixedImage = ImageUtilities.ResizeImage(fixedBmp, Width, Height);
|
var fixedImage = ImageUtilities.ResizeImage(fixedBmp, Width, Height);
|
||||||
@ -131,4 +137,4 @@ namespace Artemis.KeyboardProviders.Corsair
|
|||||||
_keyboard.Update();
|
_keyboard.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,32 +1,54 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Windows;
|
||||||
namespace Artemis.KeyboardProviders
|
using Size = System.Windows.Size;
|
||||||
{
|
|
||||||
public abstract class KeyboardProvider
|
namespace Artemis.KeyboardProviders
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public abstract class KeyboardProvider
|
||||||
public int Height { get; set; }
|
{
|
||||||
public int Width { get; set; }
|
public string Name { get; set; }
|
||||||
public string CantEnableText { get; set; }
|
public int Height { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
public List<KeyboardRegion> KeyboardRegions { get; set; }
|
public string CantEnableText { get; set; }
|
||||||
|
|
||||||
public abstract bool CanEnable();
|
public List<KeyboardRegion> KeyboardRegions { get; set; }
|
||||||
public abstract void Enable();
|
|
||||||
public abstract void Disable();
|
public PreviewSettings PreviewSettings { get; set; }
|
||||||
public abstract void DrawBitmap(Bitmap bitmap);
|
|
||||||
|
public abstract bool CanEnable();
|
||||||
/// <summary>
|
public abstract void Enable();
|
||||||
/// Returns a bitmap matching the keyboard's dimensions
|
public abstract void Disable();
|
||||||
/// </summary>
|
public abstract void DrawBitmap(Bitmap bitmap);
|
||||||
/// <returns></returns>
|
|
||||||
public Bitmap KeyboardBitmap() => new Bitmap(Width, Height);
|
/// <summary>
|
||||||
|
/// Returns a bitmap matching the keyboard's dimensions
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Returns a bitmap matching the keyboard's dimensions using the provided scale
|
/// <returns></returns>
|
||||||
/// </summary>
|
public Bitmap KeyboardBitmap() => new Bitmap(Width, Height);
|
||||||
/// <returns></returns>
|
|
||||||
public Bitmap KeyboardBitmap(int scale) => new Bitmap(Width*scale, Height*scale);
|
/// <summary>
|
||||||
}
|
/// Returns a bitmap matching the keyboard's dimensions using the provided scale
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Bitmap KeyboardBitmap(int scale) => new Bitmap(Width*scale, Height*scale);
|
||||||
|
|
||||||
|
public Rect KeyboardRectangle(int scale) => new Rect(new Size(Width*scale, Height*scale));
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct PreviewSettings
|
||||||
|
{
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
public Thickness Margin { get; set; }
|
||||||
|
public Bitmap Image { get; set; }
|
||||||
|
|
||||||
|
public PreviewSettings(int width, int height, Thickness margin, Bitmap image)
|
||||||
|
{
|
||||||
|
Width = width;
|
||||||
|
Height = height;
|
||||||
|
Margin = margin;
|
||||||
|
Image = image;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,20 +1,20 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders
|
namespace Artemis.KeyboardProviders
|
||||||
{
|
{
|
||||||
public class KeyboardRegion
|
public class KeyboardRegion
|
||||||
{
|
{
|
||||||
public KeyboardRegion(string regionName, Point topLeft, Point bottomRight)
|
public KeyboardRegion(string regionName, Point topLeft, Point bottomRight)
|
||||||
{
|
{
|
||||||
RegionName = regionName;
|
RegionName = regionName;
|
||||||
TopLeft = topLeft;
|
TopLeft = topLeft;
|
||||||
BottomRight = bottomRight;
|
BottomRight = bottomRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RegionName { get; set; }
|
public string RegionName { get; set; }
|
||||||
public Point TopLeft { get; set; }
|
public Point TopLeft { get; set; }
|
||||||
public Point BottomRight { get; set; }
|
public Point BottomRight { get; set; }
|
||||||
|
|
||||||
public Rectangle GetRectangle() => new Rectangle(TopLeft.X, TopLeft.Y, BottomRight.X - TopLeft.X, BottomRight.Y - TopLeft.Y);
|
public Rectangle GetRectangle() => new Rectangle(TopLeft.X, TopLeft.Y, BottomRight.X - TopLeft.X, BottomRight.Y - TopLeft.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@ using System.Drawing;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Artemis.KeyboardProviders.Logitech.Utilities;
|
using Artemis.KeyboardProviders.Logitech.Utilities;
|
||||||
|
using Artemis.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.LogitechDll;
|
using Artemis.Utilities.LogitechDll;
|
||||||
using Point = System.Drawing.Point;
|
using Point = System.Drawing.Point;
|
||||||
@ -16,10 +17,11 @@ namespace Artemis.KeyboardProviders.Logitech
|
|||||||
Name = "Logitech G910 RGB";
|
Name = "Logitech G910 RGB";
|
||||||
CantEnableText = "Couldn't connect to your Logitech G910.\n" +
|
CantEnableText = "Couldn't connect to your Logitech G910.\n" +
|
||||||
"Please check your cables and updating the Logitech Gaming Software\n" +
|
"Please check your cables and updating the Logitech Gaming Software\n" +
|
||||||
"A minimum version of 8.81.15 is required).\n\n" +
|
"A minimum version of 8.81.15 is required.\n\n" +
|
||||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||||
Height = 6;
|
Height = 6;
|
||||||
Width = 21;
|
Width = 21;
|
||||||
|
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.g910);
|
||||||
KeyboardRegions = new List<KeyboardRegion>
|
KeyboardRegions = new List<KeyboardRegion>
|
||||||
{
|
{
|
||||||
new KeyboardRegion("TopRow", new Point(0, 0), new Point(18, 0)),
|
new KeyboardRegion("TopRow", new Point(0, 0), new Point(18, 0)),
|
||||||
@ -40,6 +42,12 @@ namespace Artemis.KeyboardProviders.Logitech
|
|||||||
|
|
||||||
// Turn it into one long number...
|
// Turn it into one long number...
|
||||||
var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
|
var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
|
||||||
|
CantEnableText = "Couldn't connect to your Logitech G910.\n" +
|
||||||
|
"Please check your cables and updating the Logitech Gaming Software\n" +
|
||||||
|
$"A minimum version of 8.81.15 is required (detected {majorNum}.{minorNum}.{buildNum}).\n\n" +
|
||||||
|
"If the detected version differs from the version LGS is reporting, reinstall LGS or see the FAQ.\n\n" +
|
||||||
|
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||||
|
|
||||||
return version >= 88115;
|
return version >= 88115;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,137 +1,137 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
||||||
{
|
{
|
||||||
public static class KeyMap
|
public static class KeyMap
|
||||||
{
|
{
|
||||||
static KeyMap()
|
static KeyMap()
|
||||||
{
|
{
|
||||||
// There are several keyboard layouts
|
// There are several keyboard layouts
|
||||||
// TODO: Implemented more layouts and an option to select them
|
// TODO: Implemented more layouts and an option to select them
|
||||||
UsEnglishOrionKeys = new List<Key>
|
UsEnglishOrionKeys = new List<Key>
|
||||||
{
|
{
|
||||||
// Row 1
|
// Row 1
|
||||||
new Key(Keys.Escape, 0, 0),
|
new Key(Keys.Escape, 0, 0),
|
||||||
new Key(Keys.F1, 1, 0),
|
new Key(Keys.F1, 1, 0),
|
||||||
new Key(Keys.F2, 2, 0),
|
new Key(Keys.F2, 2, 0),
|
||||||
new Key(Keys.F3, 3, 0),
|
new Key(Keys.F3, 3, 0),
|
||||||
new Key(Keys.F4, 4, 0),
|
new Key(Keys.F4, 4, 0),
|
||||||
new Key(Keys.F5, 5, 0),
|
new Key(Keys.F5, 5, 0),
|
||||||
new Key(Keys.F6, 6, 0),
|
new Key(Keys.F6, 6, 0),
|
||||||
new Key(Keys.F7, 7, 0),
|
new Key(Keys.F7, 7, 0),
|
||||||
new Key(Keys.F8, 8, 0),
|
new Key(Keys.F8, 8, 0),
|
||||||
new Key(Keys.F9, 9, 0),
|
new Key(Keys.F9, 9, 0),
|
||||||
new Key(Keys.F10, 10, 0),
|
new Key(Keys.F10, 10, 0),
|
||||||
new Key(Keys.F11, 11, 0),
|
new Key(Keys.F11, 11, 0),
|
||||||
new Key(Keys.F12, 12, 0),
|
new Key(Keys.F12, 12, 0),
|
||||||
new Key(Keys.PrintScreen, 13, 0),
|
new Key(Keys.PrintScreen, 13, 0),
|
||||||
new Key(Keys.Scroll, 14, 0),
|
new Key(Keys.Scroll, 14, 0),
|
||||||
new Key(Keys.Pause, 15, 0),
|
new Key(Keys.Pause, 15, 0),
|
||||||
|
|
||||||
// Row 2
|
// Row 2
|
||||||
new Key(Keys.Oemtilde, 0, 1),
|
new Key(Keys.Oemtilde, 0, 1),
|
||||||
new Key(Keys.D1, 1, 1),
|
new Key(Keys.D1, 1, 1),
|
||||||
new Key(Keys.D2, 2, 1),
|
new Key(Keys.D2, 2, 1),
|
||||||
new Key(Keys.D3, 3, 1),
|
new Key(Keys.D3, 3, 1),
|
||||||
new Key(Keys.D4, 4, 1),
|
new Key(Keys.D4, 4, 1),
|
||||||
new Key(Keys.D5, 5, 1),
|
new Key(Keys.D5, 5, 1),
|
||||||
new Key(Keys.D6, 6, 1),
|
new Key(Keys.D6, 6, 1),
|
||||||
new Key(Keys.D7, 7, 1),
|
new Key(Keys.D7, 7, 1),
|
||||||
new Key(Keys.D8, 8, 1),
|
new Key(Keys.D8, 8, 1),
|
||||||
new Key(Keys.D9, 9, 1),
|
new Key(Keys.D9, 9, 1),
|
||||||
new Key(Keys.D0, 10, 1),
|
new Key(Keys.D0, 10, 1),
|
||||||
new Key(Keys.OemMinus, 11, 1),
|
new Key(Keys.OemMinus, 11, 1),
|
||||||
new Key(Keys.Oemplus, 12, 1),
|
new Key(Keys.Oemplus, 12, 1),
|
||||||
new Key(Keys.Back, 13, 1),
|
new Key(Keys.Back, 13, 1),
|
||||||
new Key(Keys.Insert, 14, 1),
|
new Key(Keys.Insert, 14, 1),
|
||||||
new Key(Keys.Home, 15, 1),
|
new Key(Keys.Home, 15, 1),
|
||||||
new Key(Keys.PageUp, 16, 1),
|
new Key(Keys.PageUp, 16, 1),
|
||||||
new Key(Keys.NumLock, 17, 1),
|
new Key(Keys.NumLock, 17, 1),
|
||||||
new Key(Keys.Divide, 18, 1),
|
new Key(Keys.Divide, 18, 1),
|
||||||
new Key(Keys.Multiply, 19, 1),
|
new Key(Keys.Multiply, 19, 1),
|
||||||
new Key(Keys.Subtract, 20, 1),
|
new Key(Keys.Subtract, 20, 1),
|
||||||
|
|
||||||
// Row 3
|
// Row 3
|
||||||
new Key(Keys.Tab, 0, 2),
|
new Key(Keys.Tab, 0, 2),
|
||||||
new Key(Keys.Q, 1, 2),
|
new Key(Keys.Q, 1, 2),
|
||||||
new Key(Keys.W, 2, 2),
|
new Key(Keys.W, 2, 2),
|
||||||
new Key(Keys.E, 3, 2),
|
new Key(Keys.E, 3, 2),
|
||||||
new Key(Keys.R, 4, 2),
|
new Key(Keys.R, 4, 2),
|
||||||
new Key(Keys.T, 5, 2),
|
new Key(Keys.T, 5, 2),
|
||||||
new Key(Keys.Y, 6, 2),
|
new Key(Keys.Y, 6, 2),
|
||||||
new Key(Keys.U, 7, 2),
|
new Key(Keys.U, 7, 2),
|
||||||
new Key(Keys.I, 8, 2),
|
new Key(Keys.I, 8, 2),
|
||||||
new Key(Keys.O, 9, 2),
|
new Key(Keys.O, 9, 2),
|
||||||
new Key(Keys.P, 10, 2),
|
new Key(Keys.P, 10, 2),
|
||||||
new Key(Keys.OemOpenBrackets, 11, 2),
|
new Key(Keys.OemOpenBrackets, 11, 2),
|
||||||
new Key(Keys.Oem6, 12, 2),
|
new Key(Keys.Oem6, 12, 2),
|
||||||
new Key(Keys.Delete, 14, 2),
|
new Key(Keys.Delete, 14, 2),
|
||||||
new Key(Keys.End, 15, 2),
|
new Key(Keys.End, 15, 2),
|
||||||
new Key(Keys.Next, 16, 2),
|
new Key(Keys.Next, 16, 2),
|
||||||
new Key(Keys.NumPad7, 17, 2),
|
new Key(Keys.NumPad7, 17, 2),
|
||||||
new Key(Keys.NumPad8, 18, 2),
|
new Key(Keys.NumPad8, 18, 2),
|
||||||
new Key(Keys.NumPad9, 19, 2),
|
new Key(Keys.NumPad9, 19, 2),
|
||||||
new Key(Keys.Add, 20, 2),
|
new Key(Keys.Add, 20, 2),
|
||||||
|
|
||||||
// Row 4
|
// Row 4
|
||||||
new Key(Keys.Capital, 0, 3),
|
new Key(Keys.Capital, 0, 3),
|
||||||
new Key(Keys.A, 1, 3),
|
new Key(Keys.A, 1, 3),
|
||||||
new Key(Keys.S, 2, 3),
|
new Key(Keys.S, 2, 3),
|
||||||
new Key(Keys.D, 3, 3),
|
new Key(Keys.D, 3, 3),
|
||||||
new Key(Keys.F, 4, 3),
|
new Key(Keys.F, 4, 3),
|
||||||
new Key(Keys.G, 5, 3),
|
new Key(Keys.G, 5, 3),
|
||||||
new Key(Keys.H, 6, 3),
|
new Key(Keys.H, 6, 3),
|
||||||
new Key(Keys.J, 7, 3),
|
new Key(Keys.J, 7, 3),
|
||||||
new Key(Keys.K, 8, 3),
|
new Key(Keys.K, 8, 3),
|
||||||
new Key(Keys.L, 9, 3),
|
new Key(Keys.L, 9, 3),
|
||||||
new Key(Keys.Oem1, 10, 3),
|
new Key(Keys.Oem1, 10, 3),
|
||||||
new Key(Keys.Oem7, 11, 3),
|
new Key(Keys.Oem7, 11, 3),
|
||||||
new Key(Keys.Oem5, 12, 3),
|
new Key(Keys.Oem5, 12, 3),
|
||||||
new Key(Keys.Return, 13, 3),
|
new Key(Keys.Return, 13, 3),
|
||||||
new Key(Keys.NumPad4, 17, 3),
|
new Key(Keys.NumPad4, 17, 3),
|
||||||
new Key(Keys.NumPad5, 18, 3),
|
new Key(Keys.NumPad5, 18, 3),
|
||||||
new Key(Keys.NumPad6, 19, 3),
|
new Key(Keys.NumPad6, 19, 3),
|
||||||
|
|
||||||
// Row 5
|
// Row 5
|
||||||
new Key(Keys.LShiftKey, 1, 4),
|
new Key(Keys.LShiftKey, 1, 4),
|
||||||
new Key(Keys.OemBackslash, 2, 4),
|
new Key(Keys.OemBackslash, 2, 4),
|
||||||
new Key(Keys.Z, 2, 4),
|
new Key(Keys.Z, 2, 4),
|
||||||
new Key(Keys.X, 3, 4),
|
new Key(Keys.X, 3, 4),
|
||||||
new Key(Keys.C, 4, 4),
|
new Key(Keys.C, 4, 4),
|
||||||
new Key(Keys.V, 5, 4),
|
new Key(Keys.V, 5, 4),
|
||||||
new Key(Keys.B, 6, 4),
|
new Key(Keys.B, 6, 4),
|
||||||
new Key(Keys.N, 7, 4),
|
new Key(Keys.N, 7, 4),
|
||||||
new Key(Keys.M, 8, 4),
|
new Key(Keys.M, 8, 4),
|
||||||
new Key(Keys.Oemcomma, 9, 4),
|
new Key(Keys.Oemcomma, 9, 4),
|
||||||
new Key(Keys.OemPeriod, 10, 4),
|
new Key(Keys.OemPeriod, 10, 4),
|
||||||
new Key(Keys.OemQuestion, 11, 4),
|
new Key(Keys.OemQuestion, 11, 4),
|
||||||
new Key(Keys.RShiftKey, 13, 4),
|
new Key(Keys.RShiftKey, 13, 4),
|
||||||
new Key(Keys.Up, 15, 4),
|
new Key(Keys.Up, 15, 4),
|
||||||
new Key(Keys.NumPad1, 17, 4),
|
new Key(Keys.NumPad1, 17, 4),
|
||||||
new Key(Keys.NumPad2, 18, 4),
|
new Key(Keys.NumPad2, 18, 4),
|
||||||
new Key(Keys.NumPad3, 19, 4),
|
new Key(Keys.NumPad3, 19, 4),
|
||||||
// Both returns return "Return" (Yes...)
|
// Both returns return "Return" (Yes...)
|
||||||
// new OrionKey(System.Windows.Forms.Keys.Return, 20, 4),
|
// new OrionKey(System.Windows.Forms.Keys.Return, 20, 4),
|
||||||
|
|
||||||
// Row 6
|
// Row 6
|
||||||
new Key(Keys.LControlKey, 0, 5),
|
new Key(Keys.LControlKey, 0, 5),
|
||||||
new Key(Keys.LWin, 1, 5),
|
new Key(Keys.LWin, 1, 5),
|
||||||
new Key(Keys.LMenu, 2, 5),
|
new Key(Keys.LMenu, 2, 5),
|
||||||
new Key(Keys.Space, 5, 5),
|
new Key(Keys.Space, 5, 5),
|
||||||
new Key(Keys.RMenu, 11, 5),
|
new Key(Keys.RMenu, 11, 5),
|
||||||
new Key(Keys.RWin, 12, 5),
|
new Key(Keys.RWin, 12, 5),
|
||||||
new Key(Keys.Apps, 13, 5),
|
new Key(Keys.Apps, 13, 5),
|
||||||
new Key(Keys.RControlKey, 14, 5),
|
new Key(Keys.RControlKey, 14, 5),
|
||||||
new Key(Keys.Left, 15, 5),
|
new Key(Keys.Left, 15, 5),
|
||||||
new Key(Keys.Down, 16, 5),
|
new Key(Keys.Down, 16, 5),
|
||||||
new Key(Keys.Right, 17, 5),
|
new Key(Keys.Right, 17, 5),
|
||||||
new Key(Keys.NumPad0, 18, 5),
|
new Key(Keys.NumPad0, 18, 5),
|
||||||
new Key(Keys.Decimal, 19, 5)
|
new Key(Keys.Decimal, 19, 5)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Key> UsEnglishOrionKeys { get; set; }
|
public static List<Key> UsEnglishOrionKeys { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,111 +1,111 @@
|
|||||||
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
||||||
{
|
{
|
||||||
public enum KeyboardNames
|
public enum KeyboardNames
|
||||||
{
|
{
|
||||||
ESC = 0x01,
|
ESC = 0x01,
|
||||||
F1 = 0x3b,
|
F1 = 0x3b,
|
||||||
F2 = 0x3c,
|
F2 = 0x3c,
|
||||||
F3 = 0x3d,
|
F3 = 0x3d,
|
||||||
F4 = 0x3e,
|
F4 = 0x3e,
|
||||||
F5 = 0x3f,
|
F5 = 0x3f,
|
||||||
F6 = 0x40,
|
F6 = 0x40,
|
||||||
F7 = 0x41,
|
F7 = 0x41,
|
||||||
F8 = 0x42,
|
F8 = 0x42,
|
||||||
F9 = 0x43,
|
F9 = 0x43,
|
||||||
F10 = 0x44,
|
F10 = 0x44,
|
||||||
F11 = 0x57,
|
F11 = 0x57,
|
||||||
F12 = 0x58,
|
F12 = 0x58,
|
||||||
PRINT_SCREEN = 0x137,
|
PRINT_SCREEN = 0x137,
|
||||||
SCROLL_LOCK = 0x46,
|
SCROLL_LOCK = 0x46,
|
||||||
PAUSE_BREAK = 0x45,
|
PAUSE_BREAK = 0x45,
|
||||||
TILDE = 0x29,
|
TILDE = 0x29,
|
||||||
ONE = 0x02,
|
ONE = 0x02,
|
||||||
TWO = 0x03,
|
TWO = 0x03,
|
||||||
THREE = 0x04,
|
THREE = 0x04,
|
||||||
FOUR = 0x05,
|
FOUR = 0x05,
|
||||||
FIVE = 0x06,
|
FIVE = 0x06,
|
||||||
SIX = 0x07,
|
SIX = 0x07,
|
||||||
SEVEN = 0x08,
|
SEVEN = 0x08,
|
||||||
EIGHT = 0x09,
|
EIGHT = 0x09,
|
||||||
NINE = 0x0A,
|
NINE = 0x0A,
|
||||||
ZERO = 0x0B,
|
ZERO = 0x0B,
|
||||||
MINUS = 0x0C,
|
MINUS = 0x0C,
|
||||||
EQUALS = 0x0D,
|
EQUALS = 0x0D,
|
||||||
BACKSPACE = 0x0E,
|
BACKSPACE = 0x0E,
|
||||||
INSERT = 0x152,
|
INSERT = 0x152,
|
||||||
HOME = 0x147,
|
HOME = 0x147,
|
||||||
PAGE_UP = 0x149,
|
PAGE_UP = 0x149,
|
||||||
NUM_LOCK = 0x145,
|
NUM_LOCK = 0x145,
|
||||||
NUM_SLASH = 0x135,
|
NUM_SLASH = 0x135,
|
||||||
NUM_ASTERISK = 0x37,
|
NUM_ASTERISK = 0x37,
|
||||||
NUM_MINUS = 0x4A,
|
NUM_MINUS = 0x4A,
|
||||||
TAB = 0x0F,
|
TAB = 0x0F,
|
||||||
Q = 0x10,
|
Q = 0x10,
|
||||||
W = 0x11,
|
W = 0x11,
|
||||||
E = 0x12,
|
E = 0x12,
|
||||||
R = 0x13,
|
R = 0x13,
|
||||||
T = 0x14,
|
T = 0x14,
|
||||||
Y = 0x15,
|
Y = 0x15,
|
||||||
U = 0x16,
|
U = 0x16,
|
||||||
I = 0x17,
|
I = 0x17,
|
||||||
O = 0x18,
|
O = 0x18,
|
||||||
P = 0x19,
|
P = 0x19,
|
||||||
OPEN_BRACKET = 0x1A,
|
OPEN_BRACKET = 0x1A,
|
||||||
CLOSE_BRACKET = 0x1B,
|
CLOSE_BRACKET = 0x1B,
|
||||||
BACKSLASH = 0x2B,
|
BACKSLASH = 0x2B,
|
||||||
KEYBOARD_DELETE = 0x153,
|
KEYBOARD_DELETE = 0x153,
|
||||||
END = 0x14F,
|
END = 0x14F,
|
||||||
PAGE_DOWN = 0x151,
|
PAGE_DOWN = 0x151,
|
||||||
NUM_SEVEN = 0x47,
|
NUM_SEVEN = 0x47,
|
||||||
NUM_EIGHT = 0x48,
|
NUM_EIGHT = 0x48,
|
||||||
NUM_NINE = 0x49,
|
NUM_NINE = 0x49,
|
||||||
NUM_PLUS = 0x4E,
|
NUM_PLUS = 0x4E,
|
||||||
CAPS_LOCK = 0x3A,
|
CAPS_LOCK = 0x3A,
|
||||||
A = 0x1E,
|
A = 0x1E,
|
||||||
S = 0x1F,
|
S = 0x1F,
|
||||||
D = 0x20,
|
D = 0x20,
|
||||||
F = 0x21,
|
F = 0x21,
|
||||||
G = 0x22,
|
G = 0x22,
|
||||||
H = 0x23,
|
H = 0x23,
|
||||||
J = 0x24,
|
J = 0x24,
|
||||||
K = 0x25,
|
K = 0x25,
|
||||||
L = 0x26,
|
L = 0x26,
|
||||||
SEMICOLON = 0x27,
|
SEMICOLON = 0x27,
|
||||||
APOSTROPHE = 0x28,
|
APOSTROPHE = 0x28,
|
||||||
ENTER = 0x1C,
|
ENTER = 0x1C,
|
||||||
NUM_FOUR = 0x4B,
|
NUM_FOUR = 0x4B,
|
||||||
NUM_FIVE = 0x4C,
|
NUM_FIVE = 0x4C,
|
||||||
NUM_SIX = 0x4D,
|
NUM_SIX = 0x4D,
|
||||||
LEFT_SHIFT = 0x2A,
|
LEFT_SHIFT = 0x2A,
|
||||||
Z = 0x2C,
|
Z = 0x2C,
|
||||||
X = 0x2D,
|
X = 0x2D,
|
||||||
C = 0x2E,
|
C = 0x2E,
|
||||||
V = 0x2F,
|
V = 0x2F,
|
||||||
B = 0x30,
|
B = 0x30,
|
||||||
N = 0x31,
|
N = 0x31,
|
||||||
M = 0x32,
|
M = 0x32,
|
||||||
COMMA = 0x33,
|
COMMA = 0x33,
|
||||||
PERIOD = 0x34,
|
PERIOD = 0x34,
|
||||||
FORWARD_SLASH = 0x35,
|
FORWARD_SLASH = 0x35,
|
||||||
RIGHT_SHIFT = 0x36,
|
RIGHT_SHIFT = 0x36,
|
||||||
ARROW_UP = 0x148,
|
ARROW_UP = 0x148,
|
||||||
NUM_ONE = 0x4F,
|
NUM_ONE = 0x4F,
|
||||||
NUM_TWO = 0x50,
|
NUM_TWO = 0x50,
|
||||||
NUM_THREE = 0x51,
|
NUM_THREE = 0x51,
|
||||||
NUM_ENTER = 0x11C,
|
NUM_ENTER = 0x11C,
|
||||||
LEFT_CONTROL = 0x1D,
|
LEFT_CONTROL = 0x1D,
|
||||||
LEFT_WINDOWS = 0x15B,
|
LEFT_WINDOWS = 0x15B,
|
||||||
LEFT_ALT = 0x38,
|
LEFT_ALT = 0x38,
|
||||||
SPACE = 0x39,
|
SPACE = 0x39,
|
||||||
RIGHT_ALT = 0x138,
|
RIGHT_ALT = 0x138,
|
||||||
RIGHT_WINDOWS = 0x15C,
|
RIGHT_WINDOWS = 0x15C,
|
||||||
APPLICATION_SELECT = 0x15D,
|
APPLICATION_SELECT = 0x15D,
|
||||||
RIGHT_CONTROL = 0x11D,
|
RIGHT_CONTROL = 0x11D,
|
||||||
ARROW_LEFT = 0x14B,
|
ARROW_LEFT = 0x14B,
|
||||||
ARROW_DOWN = 0x150,
|
ARROW_DOWN = 0x150,
|
||||||
ARROW_RIGHT = 0x14D,
|
ARROW_RIGHT = 0x14D,
|
||||||
NUM_ZERO = 0x52,
|
NUM_ZERO = 0x52,
|
||||||
NUM_PERIOD = 0x53,
|
NUM_PERIOD = 0x53,
|
||||||
TEST = 0x1
|
TEST = 0x1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,95 +1,95 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
||||||
{
|
{
|
||||||
public class LogitechGSDK
|
public class LogitechGSDK
|
||||||
{
|
{
|
||||||
//LED SDK
|
//LED SDK
|
||||||
private const int LOGI_DEVICETYPE_MONOCHROME_ORD = 0;
|
private const int LOGI_DEVICETYPE_MONOCHROME_ORD = 0;
|
||||||
private const int LOGI_DEVICETYPE_RGB_ORD = 1;
|
private const int LOGI_DEVICETYPE_RGB_ORD = 1;
|
||||||
private const int LOGI_DEVICETYPE_PERKEY_RGB_ORD = 2;
|
private const int LOGI_DEVICETYPE_PERKEY_RGB_ORD = 2;
|
||||||
|
|
||||||
public const int LOGI_DEVICETYPE_MONOCHROME = 1 << LOGI_DEVICETYPE_MONOCHROME_ORD;
|
public const int LOGI_DEVICETYPE_MONOCHROME = 1 << LOGI_DEVICETYPE_MONOCHROME_ORD;
|
||||||
public const int LOGI_DEVICETYPE_RGB = 1 << LOGI_DEVICETYPE_RGB_ORD;
|
public const int LOGI_DEVICETYPE_RGB = 1 << LOGI_DEVICETYPE_RGB_ORD;
|
||||||
public const int LOGI_DEVICETYPE_PERKEY_RGB = 1 << LOGI_DEVICETYPE_PERKEY_RGB_ORD;
|
public const int LOGI_DEVICETYPE_PERKEY_RGB = 1 << LOGI_DEVICETYPE_PERKEY_RGB_ORD;
|
||||||
public const int LOGI_LED_BITMAP_WIDTH = 21;
|
public const int LOGI_LED_BITMAP_WIDTH = 21;
|
||||||
public const int LOGI_LED_BITMAP_HEIGHT = 6;
|
public const int LOGI_LED_BITMAP_HEIGHT = 6;
|
||||||
public const int LOGI_LED_BITMAP_BYTES_PER_KEY = 4;
|
public const int LOGI_LED_BITMAP_BYTES_PER_KEY = 4;
|
||||||
|
|
||||||
public const int LOGI_LED_BITMAP_SIZE =
|
public const int LOGI_LED_BITMAP_SIZE =
|
||||||
LOGI_LED_BITMAP_WIDTH*LOGI_LED_BITMAP_HEIGHT*LOGI_LED_BITMAP_BYTES_PER_KEY;
|
LOGI_LED_BITMAP_WIDTH*LOGI_LED_BITMAP_HEIGHT*LOGI_LED_BITMAP_BYTES_PER_KEY;
|
||||||
|
|
||||||
public const int LOGI_LED_DURATION_INFINITE = 0;
|
public const int LOGI_LED_DURATION_INFINITE = 0;
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedInit();
|
public static extern bool LogiLedInit();
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetTargetDevice(int targetDevice);
|
public static extern bool LogiLedSetTargetDevice(int targetDevice);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedGetSdkVersion(ref int majorNum, ref int minorNum, ref int buildNum);
|
public static extern bool LogiLedGetSdkVersion(ref int majorNum, ref int minorNum, ref int buildNum);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSaveCurrentLighting();
|
public static extern bool LogiLedSaveCurrentLighting();
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetLighting(int redPercentage, int greenPercentage, int bluePercentage);
|
public static extern bool LogiLedSetLighting(int redPercentage, int greenPercentage, int bluePercentage);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedRestoreLighting();
|
public static extern bool LogiLedRestoreLighting();
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedFlashLighting(int redPercentage, int greenPercentage, int bluePercentage,
|
public static extern bool LogiLedFlashLighting(int redPercentage, int greenPercentage, int bluePercentage,
|
||||||
int milliSecondsDuration, int milliSecondsInterval);
|
int milliSecondsDuration, int milliSecondsInterval);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedPulseLighting(int redPercentage, int greenPercentage, int bluePercentage,
|
public static extern bool LogiLedPulseLighting(int redPercentage, int greenPercentage, int bluePercentage,
|
||||||
int milliSecondsDuration, int milliSecondsInterval);
|
int milliSecondsDuration, int milliSecondsInterval);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedStopEffects();
|
public static extern bool LogiLedStopEffects();
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetLightingFromBitmap(byte[] bitmap);
|
public static extern bool LogiLedSetLightingFromBitmap(byte[] bitmap);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetLightingForKeyWithScanCode(int keyCode, int redPercentage,
|
public static extern bool LogiLedSetLightingForKeyWithScanCode(int keyCode, int redPercentage,
|
||||||
int greenPercentage, int bluePercentage);
|
int greenPercentage, int bluePercentage);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetLightingForKeyWithHidCode(int keyCode, int redPercentage,
|
public static extern bool LogiLedSetLightingForKeyWithHidCode(int keyCode, int redPercentage,
|
||||||
int greenPercentage, int bluePercentage);
|
int greenPercentage, int bluePercentage);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetLightingForKeyWithQuartzCode(int keyCode, int redPercentage,
|
public static extern bool LogiLedSetLightingForKeyWithQuartzCode(int keyCode, int redPercentage,
|
||||||
int greenPercentage, int bluePercentage);
|
int greenPercentage, int bluePercentage);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSetLightingForKeyWithKeyName(int keyCode, int redPercentage,
|
public static extern bool LogiLedSetLightingForKeyWithKeyName(int keyCode, int redPercentage,
|
||||||
int greenPercentage, int bluePercentage);
|
int greenPercentage, int bluePercentage);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedSaveLightingForKey(KeyboardNames keyName);
|
public static extern bool LogiLedSaveLightingForKey(KeyboardNames keyName);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedRestoreLightingForKey(KeyboardNames keyName);
|
public static extern bool LogiLedRestoreLightingForKey(KeyboardNames keyName);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedFlashSingleKey(KeyboardNames keyName, int redPercentage, int greenPercentage,
|
public static extern bool LogiLedFlashSingleKey(KeyboardNames keyName, int redPercentage, int greenPercentage,
|
||||||
int bluePercentage, int msDuration, int msInterval);
|
int bluePercentage, int msDuration, int msInterval);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedPulseSingleKey(KeyboardNames keyName, int startRedPercentage,
|
public static extern bool LogiLedPulseSingleKey(KeyboardNames keyName, int startRedPercentage,
|
||||||
int startGreenPercentage, int startBluePercentage, int finishRedPercentage, int finishGreenPercentage,
|
int startGreenPercentage, int startBluePercentage, int finishRedPercentage, int finishGreenPercentage,
|
||||||
int finishBluePercentage, int msDuration, bool isInfinite);
|
int finishBluePercentage, int msDuration, bool isInfinite);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool LogiLedStopEffectsOnKey(KeyboardNames keyName);
|
public static extern bool LogiLedStopEffectsOnKey(KeyboardNames keyName);
|
||||||
|
|
||||||
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("LogitechLedEnginesWrapper ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void LogiLedShutdown();
|
public static extern void LogiLedShutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,230 +1,230 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
namespace Artemis.KeyboardProviders.Logitech.Utilities
|
||||||
{
|
{
|
||||||
public static class OrionUtilities
|
public static class OrionUtilities
|
||||||
{
|
{
|
||||||
public static KeyMapping[] Keymappings =
|
public static KeyMapping[] Keymappings =
|
||||||
{
|
{
|
||||||
// First row
|
// First row
|
||||||
new KeyMapping(0, 0),
|
new KeyMapping(0, 0),
|
||||||
new KeyMapping(1, 1),
|
new KeyMapping(1, 1),
|
||||||
new KeyMapping(2, 1),
|
new KeyMapping(2, 1),
|
||||||
new KeyMapping(3, 2),
|
new KeyMapping(3, 2),
|
||||||
new KeyMapping(4, 3),
|
new KeyMapping(4, 3),
|
||||||
new KeyMapping(5, 4),
|
new KeyMapping(5, 4),
|
||||||
new KeyMapping(6, 5),
|
new KeyMapping(6, 5),
|
||||||
new KeyMapping(7, 6),
|
new KeyMapping(7, 6),
|
||||||
new KeyMapping(8, 7),
|
new KeyMapping(8, 7),
|
||||||
new KeyMapping(9, 8),
|
new KeyMapping(9, 8),
|
||||||
new KeyMapping(10, 9),
|
new KeyMapping(10, 9),
|
||||||
new KeyMapping(11, 9),
|
new KeyMapping(11, 9),
|
||||||
new KeyMapping(12, 10),
|
new KeyMapping(12, 10),
|
||||||
new KeyMapping(13, 11),
|
new KeyMapping(13, 11),
|
||||||
new KeyMapping(13, 12),
|
new KeyMapping(13, 12),
|
||||||
new KeyMapping(14, 13),
|
new KeyMapping(14, 13),
|
||||||
new KeyMapping(15, 14),
|
new KeyMapping(15, 14),
|
||||||
new KeyMapping(16, 15),
|
new KeyMapping(16, 15),
|
||||||
new KeyMapping(17, 16),
|
new KeyMapping(17, 16),
|
||||||
new KeyMapping(18, 17),
|
new KeyMapping(18, 17),
|
||||||
new KeyMapping(19, 18),
|
new KeyMapping(19, 18),
|
||||||
|
|
||||||
// Second row
|
// Second row
|
||||||
new KeyMapping(21, 21),
|
new KeyMapping(21, 21),
|
||||||
new KeyMapping(22, 22),
|
new KeyMapping(22, 22),
|
||||||
new KeyMapping(23, 23),
|
new KeyMapping(23, 23),
|
||||||
new KeyMapping(24, 24),
|
new KeyMapping(24, 24),
|
||||||
new KeyMapping(25, 25),
|
new KeyMapping(25, 25),
|
||||||
new KeyMapping(26, 26),
|
new KeyMapping(26, 26),
|
||||||
new KeyMapping(27, 27),
|
new KeyMapping(27, 27),
|
||||||
new KeyMapping(28, 28),
|
new KeyMapping(28, 28),
|
||||||
new KeyMapping(29, 29),
|
new KeyMapping(29, 29),
|
||||||
new KeyMapping(30, 30),
|
new KeyMapping(30, 30),
|
||||||
new KeyMapping(31, 31),
|
new KeyMapping(31, 31),
|
||||||
new KeyMapping(32, 32),
|
new KeyMapping(32, 32),
|
||||||
new KeyMapping(33, 33),
|
new KeyMapping(33, 33),
|
||||||
new KeyMapping(34, 34),
|
new KeyMapping(34, 34),
|
||||||
new KeyMapping(35, 35),
|
new KeyMapping(35, 35),
|
||||||
new KeyMapping(36, 36),
|
new KeyMapping(36, 36),
|
||||||
new KeyMapping(37, 37),
|
new KeyMapping(37, 37),
|
||||||
new KeyMapping(38, 38),
|
new KeyMapping(38, 38),
|
||||||
new KeyMapping(39, 39),
|
new KeyMapping(39, 39),
|
||||||
new KeyMapping(40, 40),
|
new KeyMapping(40, 40),
|
||||||
new KeyMapping(41, 41),
|
new KeyMapping(41, 41),
|
||||||
|
|
||||||
// Third row
|
// Third row
|
||||||
new KeyMapping(42, 42),
|
new KeyMapping(42, 42),
|
||||||
new KeyMapping(43, 43),
|
new KeyMapping(43, 43),
|
||||||
new KeyMapping(44, 44),
|
new KeyMapping(44, 44),
|
||||||
new KeyMapping(45, 45),
|
new KeyMapping(45, 45),
|
||||||
new KeyMapping(46, 46),
|
new KeyMapping(46, 46),
|
||||||
new KeyMapping(47, 46),
|
new KeyMapping(47, 46),
|
||||||
new KeyMapping(48, 47),
|
new KeyMapping(48, 47),
|
||||||
new KeyMapping(49, 48),
|
new KeyMapping(49, 48),
|
||||||
new KeyMapping(50, 49),
|
new KeyMapping(50, 49),
|
||||||
new KeyMapping(51, 50),
|
new KeyMapping(51, 50),
|
||||||
new KeyMapping(52, 51),
|
new KeyMapping(52, 51),
|
||||||
new KeyMapping(53, 52),
|
new KeyMapping(53, 52),
|
||||||
new KeyMapping(54, 53),
|
new KeyMapping(54, 53),
|
||||||
new KeyMapping(54, 54),
|
new KeyMapping(54, 54),
|
||||||
new KeyMapping(55, 55),
|
new KeyMapping(55, 55),
|
||||||
new KeyMapping(56, 56),
|
new KeyMapping(56, 56),
|
||||||
new KeyMapping(57, 57),
|
new KeyMapping(57, 57),
|
||||||
new KeyMapping(58, 58),
|
new KeyMapping(58, 58),
|
||||||
new KeyMapping(59, 59),
|
new KeyMapping(59, 59),
|
||||||
new KeyMapping(60, 60),
|
new KeyMapping(60, 60),
|
||||||
new KeyMapping(61, 61),
|
new KeyMapping(61, 61),
|
||||||
new KeyMapping(62, 62),
|
new KeyMapping(62, 62),
|
||||||
|
|
||||||
// Fourth row
|
// Fourth row
|
||||||
new KeyMapping(63, 63),
|
new KeyMapping(63, 63),
|
||||||
new KeyMapping(64, 64),
|
new KeyMapping(64, 64),
|
||||||
new KeyMapping(65, 65),
|
new KeyMapping(65, 65),
|
||||||
new KeyMapping(66, 65),
|
new KeyMapping(66, 65),
|
||||||
new KeyMapping(67, 66),
|
new KeyMapping(67, 66),
|
||||||
new KeyMapping(68, 67),
|
new KeyMapping(68, 67),
|
||||||
new KeyMapping(69, 68),
|
new KeyMapping(69, 68),
|
||||||
new KeyMapping(70, 69),
|
new KeyMapping(70, 69),
|
||||||
new KeyMapping(71, 70),
|
new KeyMapping(71, 70),
|
||||||
new KeyMapping(72, 71),
|
new KeyMapping(72, 71),
|
||||||
new KeyMapping(73, 72),
|
new KeyMapping(73, 72),
|
||||||
new KeyMapping(74, 73),
|
new KeyMapping(74, 73),
|
||||||
new KeyMapping(75, 74),
|
new KeyMapping(75, 74),
|
||||||
new KeyMapping(76, 75),
|
new KeyMapping(76, 75),
|
||||||
new KeyMapping(76, 76),
|
new KeyMapping(76, 76),
|
||||||
new KeyMapping(78, 77),
|
new KeyMapping(78, 77),
|
||||||
new KeyMapping(79, 78),
|
new KeyMapping(79, 78),
|
||||||
new KeyMapping(79, 79),
|
new KeyMapping(79, 79),
|
||||||
new KeyMapping(80, 80),
|
new KeyMapping(80, 80),
|
||||||
new KeyMapping(81, 81),
|
new KeyMapping(81, 81),
|
||||||
new KeyMapping(82, 82),
|
new KeyMapping(82, 82),
|
||||||
|
|
||||||
// Fifth row
|
// Fifth row
|
||||||
new KeyMapping(84, 84),
|
new KeyMapping(84, 84),
|
||||||
new KeyMapping(85, 85),
|
new KeyMapping(85, 85),
|
||||||
new KeyMapping(86, 86),
|
new KeyMapping(86, 86),
|
||||||
new KeyMapping(87, 87),
|
new KeyMapping(87, 87),
|
||||||
new KeyMapping(88, 88),
|
new KeyMapping(88, 88),
|
||||||
new KeyMapping(89, 89),
|
new KeyMapping(89, 89),
|
||||||
new KeyMapping(90, 90),
|
new KeyMapping(90, 90),
|
||||||
new KeyMapping(91, 91),
|
new KeyMapping(91, 91),
|
||||||
new KeyMapping(92, 92),
|
new KeyMapping(92, 92),
|
||||||
new KeyMapping(93, 93),
|
new KeyMapping(93, 93),
|
||||||
new KeyMapping(94, 94),
|
new KeyMapping(94, 94),
|
||||||
new KeyMapping(95, 95),
|
new KeyMapping(95, 95),
|
||||||
new KeyMapping(96, 96),
|
new KeyMapping(96, 96),
|
||||||
new KeyMapping(97, 97),
|
new KeyMapping(97, 97),
|
||||||
new KeyMapping(98, 98),
|
new KeyMapping(98, 98),
|
||||||
new KeyMapping(99, 99),
|
new KeyMapping(99, 99),
|
||||||
new KeyMapping(100, 100),
|
new KeyMapping(100, 100),
|
||||||
new KeyMapping(101, 101),
|
new KeyMapping(101, 101),
|
||||||
new KeyMapping(102, 102),
|
new KeyMapping(102, 102),
|
||||||
new KeyMapping(103, 103),
|
new KeyMapping(103, 103),
|
||||||
new KeyMapping(104, 104),
|
new KeyMapping(104, 104),
|
||||||
|
|
||||||
// Sixth row
|
// Sixth row
|
||||||
new KeyMapping(105, 105),
|
new KeyMapping(105, 105),
|
||||||
new KeyMapping(106, 106),
|
new KeyMapping(106, 106),
|
||||||
new KeyMapping(107, 107),
|
new KeyMapping(107, 107),
|
||||||
new KeyMapping(108, 107),
|
new KeyMapping(108, 107),
|
||||||
new KeyMapping(109, 109),
|
new KeyMapping(109, 109),
|
||||||
new KeyMapping(110, 110),
|
new KeyMapping(110, 110),
|
||||||
new KeyMapping(111, 110),
|
new KeyMapping(111, 110),
|
||||||
new KeyMapping(112, 111),
|
new KeyMapping(112, 111),
|
||||||
new KeyMapping(113, 112),
|
new KeyMapping(113, 112),
|
||||||
new KeyMapping(114, 113),
|
new KeyMapping(114, 113),
|
||||||
new KeyMapping(115, 114),
|
new KeyMapping(115, 114),
|
||||||
new KeyMapping(116, 115),
|
new KeyMapping(116, 115),
|
||||||
new KeyMapping(115, 116), // ALTGR
|
new KeyMapping(115, 116), // ALTGR
|
||||||
new KeyMapping(116, 117),
|
new KeyMapping(116, 117),
|
||||||
new KeyMapping(117, 118),
|
new KeyMapping(117, 118),
|
||||||
new KeyMapping(118, 119),
|
new KeyMapping(118, 119),
|
||||||
new KeyMapping(119, 120),
|
new KeyMapping(119, 120),
|
||||||
new KeyMapping(120, 121),
|
new KeyMapping(120, 121),
|
||||||
new KeyMapping(121, 122),
|
new KeyMapping(121, 122),
|
||||||
new KeyMapping(122, 123),
|
new KeyMapping(122, 123),
|
||||||
new KeyMapping(124, 124),
|
new KeyMapping(124, 124),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static byte[] BitmapToByteArray(Bitmap b, bool remap = true)
|
public static byte[] BitmapToByteArray(Bitmap b, bool remap = true)
|
||||||
{
|
{
|
||||||
if (b.Width > 21 || b.Height > 6)
|
if (b.Width > 21 || b.Height > 6)
|
||||||
b = ResizeImage(b, 21, 6);
|
b = ResizeImage(b, 21, 6);
|
||||||
|
|
||||||
var rect = new Rectangle(0, 0, b.Width, b.Height);
|
var rect = new Rectangle(0, 0, b.Width, b.Height);
|
||||||
var bitmapData = b.LockBits(rect, ImageLockMode.ReadWrite, b.PixelFormat);
|
var bitmapData = b.LockBits(rect, ImageLockMode.ReadWrite, b.PixelFormat);
|
||||||
|
|
||||||
var depth = Image.GetPixelFormatSize(b.PixelFormat);
|
var depth = Image.GetPixelFormatSize(b.PixelFormat);
|
||||||
var step = depth/8;
|
var step = depth/8;
|
||||||
var pixels = new byte[21*6*step];
|
var pixels = new byte[21*6*step];
|
||||||
var iptr = bitmapData.Scan0;
|
var iptr = bitmapData.Scan0;
|
||||||
|
|
||||||
// Copy data from pointer to array
|
// Copy data from pointer to array
|
||||||
Marshal.Copy(iptr, pixels, 0, pixels.Length);
|
Marshal.Copy(iptr, pixels, 0, pixels.Length);
|
||||||
|
|
||||||
if (!remap)
|
if (!remap)
|
||||||
return pixels;
|
return pixels;
|
||||||
|
|
||||||
var remapped = new byte[pixels.Length];
|
var remapped = new byte[pixels.Length];
|
||||||
|
|
||||||
// Every key is 4 bytes
|
// Every key is 4 bytes
|
||||||
for (var i = 0; i <= pixels.Length /4; i++)
|
for (var i = 0; i <= pixels.Length /4; i++)
|
||||||
{
|
{
|
||||||
var firstSByte = Keymappings[i].Source * 4;
|
var firstSByte = Keymappings[i].Source * 4;
|
||||||
var firstTByte = Keymappings[i].Target * 4;
|
var firstTByte = Keymappings[i].Target * 4;
|
||||||
|
|
||||||
for (var j = 0; j < 4; j++)
|
for (var j = 0; j < 4; j++)
|
||||||
remapped[firstTByte + j] = pixels[firstSByte + j];
|
remapped[firstTByte + j] = pixels[firstSByte + j];
|
||||||
}
|
}
|
||||||
|
|
||||||
return remapped;
|
return remapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resize the image to the specified width and height.
|
/// Resize the image to the specified width and height.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="image">The image to resize.</param>
|
/// <param name="image">The image to resize.</param>
|
||||||
/// <param name="width">The width to resize to.</param>
|
/// <param name="width">The width to resize to.</param>
|
||||||
/// <param name="height">The height to resize to.</param>
|
/// <param name="height">The height to resize to.</param>
|
||||||
/// <returns>The resized image.</returns>
|
/// <returns>The resized image.</returns>
|
||||||
public static Bitmap ResizeImage(Image image, int width, int height)
|
public static Bitmap ResizeImage(Image image, int width, int height)
|
||||||
{
|
{
|
||||||
var destRect = new Rectangle(0, 0, width, height);
|
var destRect = new Rectangle(0, 0, width, height);
|
||||||
var destImage = new Bitmap(width, height);
|
var destImage = new Bitmap(width, height);
|
||||||
|
|
||||||
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
||||||
|
|
||||||
using (var graphics = Graphics.FromImage(destImage))
|
using (var graphics = Graphics.FromImage(destImage))
|
||||||
{
|
{
|
||||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
|
|
||||||
using (var wrapMode = new ImageAttributes())
|
using (var wrapMode = new ImageAttributes())
|
||||||
{
|
{
|
||||||
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
||||||
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
|
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return destImage;
|
return destImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct KeyMapping
|
public struct KeyMapping
|
||||||
{
|
{
|
||||||
public KeyMapping(int source, int target)
|
public KeyMapping(int source, int target)
|
||||||
{
|
{
|
||||||
Source = source;
|
Source = source;
|
||||||
Target = target;
|
Target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Source { get; set; }
|
public int Source { get; set; }
|
||||||
public int Target { get; set; }
|
public int Target { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,20 +1,20 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Artemis.KeyboardProviders.Corsair;
|
using Artemis.KeyboardProviders.Corsair;
|
||||||
using Artemis.KeyboardProviders.Logitech;
|
using Artemis.KeyboardProviders.Logitech;
|
||||||
using Artemis.KeyboardProviders.Razer;
|
using Artemis.KeyboardProviders.Razer;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders
|
namespace Artemis.KeyboardProviders
|
||||||
{
|
{
|
||||||
public static class ProviderHelper
|
public static class ProviderHelper
|
||||||
{
|
{
|
||||||
public static List<KeyboardProvider> GetKeyboardProviders()
|
public static List<KeyboardProvider> GetKeyboardProviders()
|
||||||
{
|
{
|
||||||
return new List<KeyboardProvider>
|
return new List<KeyboardProvider>
|
||||||
{
|
{
|
||||||
new CorsairRGB(),
|
new CorsairRGB(),
|
||||||
new Orion(),
|
new Orion(),
|
||||||
new BlackWidow()
|
new BlackWidow()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,55 +1,53 @@
|
|||||||
using System;
|
using System.Drawing;
|
||||||
using System.Drawing;
|
using Artemis.KeyboardProviders.Razer.Utilities;
|
||||||
using Artemis.KeyboardProviders.Razer.Utilities;
|
using Corale.Colore.Core;
|
||||||
using Corale.Colore.Core;
|
using Corale.Colore.Razer;
|
||||||
using Corale.Colore.Razer.Keyboard;
|
using Constants = Corale.Colore.Razer.Keyboard.Constants;
|
||||||
using ColoreColor = Corale.Colore.Core.Color;
|
|
||||||
using KeyboardCustom = Corale.Colore.Razer.Keyboard.Effects.Custom;
|
namespace Artemis.KeyboardProviders.Razer
|
||||||
|
{
|
||||||
namespace Artemis.KeyboardProviders.Razer
|
public class BlackWidow : KeyboardProvider
|
||||||
{
|
{
|
||||||
public class BlackWidow : KeyboardProvider
|
public BlackWidow()
|
||||||
{
|
{
|
||||||
public BlackWidow()
|
Name = "Razer BlackWidow Chroma";
|
||||||
{
|
CantEnableText = "Couldn't connect to your Razer BlackWidow Chroma.\n" +
|
||||||
Name = "Razer BlackWidow Chroma";
|
"Please check your cables and try updating Razer Synapse.\n\n" +
|
||||||
CantEnableText = "Couldn't connect to your Razer BlackWidow Chroma.\n " +
|
"If needed, you can select a different keyboard in Artemis under settings.";
|
||||||
"Please check your cables and try updating Razer Synapse.\n\n " +
|
}
|
||||||
"If needed, you can select a different keyboard in Artemis under settings.";
|
|
||||||
}
|
public override bool CanEnable()
|
||||||
|
{
|
||||||
public override bool CanEnable()
|
if (!Chroma.IsSdkAvailable())
|
||||||
{
|
return false;
|
||||||
if (!Chroma.IsSdkAvailable())
|
|
||||||
return false;
|
// Some people have Synapse installed, but not a Chroma keyboard, deal with this
|
||||||
|
var blackWidowFound = Chroma.Instance.Query(Devices.Blackwidow).Connected;
|
||||||
// Some people have Synapse installed, but not a Chroma keyboard, deal with this
|
var blackWidowTeFound = Chroma.Instance.Query(Devices.BlackwidowTe).Connected;
|
||||||
var blackWidowFound = Chroma.Instance.Query(Corale.Colore.Razer.Devices.Blackwidow).Connected;
|
return blackWidowFound || blackWidowTeFound;
|
||||||
var blackWidowTeFound = Chroma.Instance.Query(Corale.Colore.Razer.Devices.BlackwidowTe).Connected;
|
}
|
||||||
return (blackWidowFound || blackWidowTeFound);
|
|
||||||
}
|
public override void Enable()
|
||||||
|
{
|
||||||
public override void Enable()
|
Chroma.Instance.Initialize();
|
||||||
{
|
Height = Constants.MaxRows;
|
||||||
Chroma.Instance.Initialize();
|
Width = Constants.MaxColumns;
|
||||||
Height = Constants.MaxRows;
|
|
||||||
Width = Constants.MaxColumns;
|
|
||||||
|
|
||||||
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 0), new Point(19, 0)));
|
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(0, 0), new Point(19, 0)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(20, 1), new Point(23, 6)));
|
KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(20, 1), new Point(23, 6)));
|
||||||
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 2), new Point(5, 2)));
|
KeyboardRegions.Add(new KeyboardRegion("QWER", new Point(2, 2), new Point(5, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
Chroma.Instance.Uninitialize();
|
Chroma.Instance.Uninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawBitmap(Bitmap bitmap)
|
public override void DrawBitmap(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
var razerArray = RazerUtilities.BitmapColorArray(bitmap, Height, Width);
|
var razerArray = RazerUtilities.BitmapColorArray(bitmap, Height, Width);
|
||||||
|
|
||||||
Chroma.Instance.Keyboard.SetCustom(razerArray);
|
Chroma.Instance.Keyboard.SetCustom(razerArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,24 +1,24 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Corale.Colore.Razer.Keyboard.Effects;
|
using Corale.Colore.Razer.Keyboard.Effects;
|
||||||
|
|
||||||
namespace Artemis.KeyboardProviders.Razer.Utilities
|
namespace Artemis.KeyboardProviders.Razer.Utilities
|
||||||
{
|
{
|
||||||
public static class RazerUtilities
|
public static class RazerUtilities
|
||||||
{
|
{
|
||||||
public static Custom BitmapColorArray(Bitmap b, int height, int width)
|
public static Custom BitmapColorArray(Bitmap b, int height, int width)
|
||||||
{
|
{
|
||||||
var keyboardGrid = Custom.Create();
|
var keyboardGrid = Custom.Create();
|
||||||
if (b.Width > width || b.Height > height)
|
if (b.Width > width || b.Height > height)
|
||||||
b = ImageUtilities.ResizeImage(b, width, height);
|
b = ImageUtilities.ResizeImage(b, width, height);
|
||||||
|
|
||||||
for (var y = 0; y < b.Height; y++)
|
for (var y = 0; y < b.Height; y++)
|
||||||
for (var x = 0; x < b.Width; x++)
|
for (var x = 0; x < b.Width; x++)
|
||||||
keyboardGrid[y, x] = b.GetPixel(x, y);
|
keyboardGrid[y, x] = b.GetPixel(x, y);
|
||||||
|
|
||||||
return keyboardGrid;
|
return keyboardGrid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,6 +14,7 @@ namespace Artemis.Managers
|
|||||||
private readonly MainManager _mainManager;
|
private readonly MainManager _mainManager;
|
||||||
private bool _clearing;
|
private bool _clearing;
|
||||||
private EffectModel _pauseEffect;
|
private EffectModel _pauseEffect;
|
||||||
|
private EffectModel _activeEffect;
|
||||||
|
|
||||||
public EffectManager(MainManager mainManager, IEventAggregator events)
|
public EffectManager(MainManager mainManager, IEventAggregator events)
|
||||||
{
|
{
|
||||||
@ -24,7 +25,16 @@ namespace Artemis.Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<EffectModel> EffectModels { get; set; }
|
public List<EffectModel> EffectModels { get; set; }
|
||||||
public EffectModel ActiveEffect { get; private set; }
|
|
||||||
|
public EffectModel ActiveEffect
|
||||||
|
{
|
||||||
|
get { return _activeEffect; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_activeEffect = value;
|
||||||
|
_events.PublishOnUIThread(new ActiveEffectChanged(value?.Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<OverlayModel> EnabledOverlays
|
public IEnumerable<OverlayModel> EnabledOverlays
|
||||||
{
|
{
|
||||||
@ -101,7 +111,7 @@ namespace Artemis.Managers
|
|||||||
ActiveEffect.Enable();
|
ActiveEffect.Enable();
|
||||||
|
|
||||||
// Let the ViewModels know
|
// Let the ViewModels know
|
||||||
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
|
//_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
|
||||||
|
|
||||||
_mainManager.Unpause();
|
_mainManager.Unpause();
|
||||||
_pauseEffect = null;
|
_pauseEffect = null;
|
||||||
@ -143,7 +153,7 @@ namespace Artemis.Managers
|
|||||||
General.Default.LastEffect = null;
|
General.Default.LastEffect = null;
|
||||||
General.Default.Save();
|
General.Default.Save();
|
||||||
|
|
||||||
_events.PublishOnUIThread(new ActiveEffectChanged(""));
|
//_events.PublishOnUIThread(new ActiveEffectChanged(""));
|
||||||
|
|
||||||
_clearing = false;
|
_clearing = false;
|
||||||
_mainManager.Unpause();
|
_mainManager.Unpause();
|
||||||
|
|||||||
@ -1,23 +1,37 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using Artemis.Events;
|
||||||
using Artemis.KeyboardProviders;
|
using Artemis.KeyboardProviders;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Managers
|
namespace Artemis.Managers
|
||||||
{
|
{
|
||||||
public class KeyboardManager
|
public class KeyboardManager
|
||||||
{
|
{
|
||||||
|
private readonly IEventAggregator _events;
|
||||||
private readonly MainManager _mainManager;
|
private readonly MainManager _mainManager;
|
||||||
|
private KeyboardProvider _activeKeyboard;
|
||||||
|
|
||||||
public KeyboardManager(MainManager mainManager)
|
public KeyboardManager(MainManager mainManager, IEventAggregator events)
|
||||||
{
|
{
|
||||||
_mainManager = mainManager;
|
_mainManager = mainManager;
|
||||||
|
_events = events;
|
||||||
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
|
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<KeyboardProvider> KeyboardProviders { get; set; }
|
public List<KeyboardProvider> KeyboardProviders { get; set; }
|
||||||
public KeyboardProvider ActiveKeyboard { get; set; }
|
|
||||||
|
public KeyboardProvider ActiveKeyboard
|
||||||
|
{
|
||||||
|
get { return _activeKeyboard; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_activeKeyboard = value;
|
||||||
|
// Let the ViewModels know
|
||||||
|
_events.PublishOnUIThread(new ActiveKeyboardChanged(value?.Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables the last keyboard according to the settings file
|
/// Enables the last keyboard according to the settings file
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
|
||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Services;
|
using Artemis.Services;
|
||||||
@ -26,7 +25,7 @@ namespace Artemis.Managers
|
|||||||
Events = events;
|
Events = events;
|
||||||
DialogService = dialogService;
|
DialogService = dialogService;
|
||||||
|
|
||||||
KeyboardManager = new KeyboardManager(this);
|
KeyboardManager = new KeyboardManager(this, Events);
|
||||||
EffectManager = new EffectManager(this, Events);
|
EffectManager = new EffectManager(this, Events);
|
||||||
KeyboardHook = new KeyboardHook();
|
KeyboardHook = new KeyboardHook();
|
||||||
|
|
||||||
@ -51,8 +50,8 @@ namespace Artemis.Managers
|
|||||||
GameStateWebServer.Start();
|
GameStateWebServer.Start();
|
||||||
|
|
||||||
// Start the named pipe
|
// Start the named pipe
|
||||||
//PipeServer = new PipeServer();
|
PipeServer = new PipeServer();
|
||||||
//PipeServer.Start("artemis");
|
PipeServer.Start("artemis");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PipeServer PipeServer { get; set; }
|
public PipeServer PipeServer { get; set; }
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
namespace Artemis.Models
|
namespace Artemis.Models
|
||||||
{
|
{
|
||||||
public abstract class EffectSettings
|
public abstract class EffectSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the settings from the settings file
|
/// Loads the settings from the settings file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Load();
|
public abstract void Load();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the settings to the settings file
|
/// Saves the settings to the settings file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Save();
|
public abstract void Save();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the settings to their default value
|
/// Returns the settings to their default value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void ToDefault();
|
public abstract void ToDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,14 +1,18 @@
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
namespace Artemis.Models
|
using Artemis.Models.Profiles;
|
||||||
{
|
|
||||||
public abstract class GameModel : EffectModel
|
namespace Artemis.Models
|
||||||
{
|
{
|
||||||
public bool Enabled;
|
public abstract class GameModel : EffectModel
|
||||||
public string ProcessName;
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
protected GameModel(MainManager mainManager) : base(mainManager)
|
public string ProcessName { get; set; }
|
||||||
{
|
public IGameDataModel GameDataModel { get; set; }
|
||||||
}
|
public ProfileModel Profile { get; set; }
|
||||||
}
|
|
||||||
|
protected GameModel(MainManager mainManager) : base(mainManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
6
Artemis/Artemis/Models/Interfaces/GameDataModel.cs
Normal file
6
Artemis/Artemis/Models/Interfaces/GameDataModel.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace Artemis.Models.Interfaces
|
||||||
|
{
|
||||||
|
public interface IGameDataModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,46 +1,46 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
|
|
||||||
namespace Artemis.Models
|
namespace Artemis.Models
|
||||||
{
|
{
|
||||||
public abstract class OverlayModel : EffectModel
|
public abstract class OverlayModel : EffectModel
|
||||||
{
|
{
|
||||||
private bool _enabled;
|
private bool _enabled;
|
||||||
public string ProcessName;
|
public string ProcessName;
|
||||||
|
|
||||||
protected OverlayModel(MainManager mainManager) : base(mainManager)
|
protected OverlayModel(MainManager mainManager) : base(mainManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Enabled
|
public bool Enabled
|
||||||
{
|
{
|
||||||
get { return _enabled; }
|
get { return _enabled; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_enabled == value)
|
if (_enabled == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
Enable();
|
Enable();
|
||||||
else
|
else
|
||||||
Dispose();
|
Dispose();
|
||||||
_enabled = value;
|
_enabled = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEnabled(bool enabled)
|
public void SetEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (Enabled == enabled)
|
if (Enabled == enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
Enable();
|
Enable();
|
||||||
else
|
else
|
||||||
Dispose();
|
Dispose();
|
||||||
|
|
||||||
Enabled = enabled;
|
Enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Bitmap GenerateBitmap(Bitmap bitmap);
|
public abstract Bitmap GenerateBitmap(Bitmap bitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
32
Artemis/Artemis/Models/Profiles/LayerConditionModel.cs
Normal file
32
Artemis/Artemis/Models/Profiles/LayerConditionModel.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Dynamic;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
|
||||||
|
namespace Artemis.Models.Profiles
|
||||||
|
{
|
||||||
|
public class LayerConditionModel
|
||||||
|
{
|
||||||
|
public string Field { get; set; }
|
||||||
|
public string Value { get; set; }
|
||||||
|
public string Operator { get; set; }
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
public bool ConditionMet<T>(IGameDataModel subject)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Field) || string.IsNullOrEmpty(Value) || string.IsNullOrEmpty(Type))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var inspect = GeneralHelpers.GetPropertyValue(subject, Field);
|
||||||
|
if (inspect == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Put the subject in a list, allowing Dynamic Linq to be used.
|
||||||
|
var subjectList = new List<T> {(T) subject};
|
||||||
|
var res = Type == "String"
|
||||||
|
? subjectList.Where($"{Field}.ToLower() {Operator} @0", Value.ToLower()).Any()
|
||||||
|
: subjectList.Where($"{Field} {Operator} {Value}").Any();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using static System.Decimal;
|
||||||
|
|
||||||
|
namespace Artemis.Models.Profiles
|
||||||
|
{
|
||||||
|
public class LayerDynamicPropertiesModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Property this dynamic property applies on
|
||||||
|
/// </summary>
|
||||||
|
public string LayerProperty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Property to base the percentage upon
|
||||||
|
/// </summary>
|
||||||
|
public string GameProperty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Percentage source, the number that defines 100%
|
||||||
|
/// </summary>
|
||||||
|
public string PercentageSource { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Type of property
|
||||||
|
/// </summary>
|
||||||
|
public LayerPropertyType LayerPropertyType { get; set; }
|
||||||
|
|
||||||
|
internal void ApplyProperty<T>(IGameDataModel data, LayerPropertiesModel userProps, LayerPropertiesModel props)
|
||||||
|
{
|
||||||
|
if (LayerPropertyType == LayerPropertyType.PercentageOf)
|
||||||
|
Apply(props, userProps, data, int.Parse(PercentageSource));
|
||||||
|
if (LayerPropertyType == LayerPropertyType.PercentageOfProperty)
|
||||||
|
ApplyProp(props, userProps, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Apply(LayerPropertiesModel props, LayerPropertiesModel userProps, IGameDataModel data,
|
||||||
|
int percentageSource)
|
||||||
|
{
|
||||||
|
// Property to apply on
|
||||||
|
var layerProp = props.GetType().GetProperty(LayerProperty);
|
||||||
|
// User's settings
|
||||||
|
var userProp = userProps.GetType().GetProperty(LayerProperty);
|
||||||
|
// Property to base the percentage upon
|
||||||
|
var gameProperty = data.GetPropValue<int>(GameProperty);
|
||||||
|
if (layerProp == null || userProp == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var percentage = ToDouble(gameProperty) / percentageSource;
|
||||||
|
layerProp.SetValue(props, (int) (percentage*(int) userProp.GetValue(userProps, null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyProp(LayerPropertiesModel props, LayerPropertiesModel userProps, IGameDataModel data)
|
||||||
|
{
|
||||||
|
var value = data.GetPropValue<int>(PercentageSource);
|
||||||
|
Apply(props, userProps, data, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum LayerPropertyType
|
||||||
|
{
|
||||||
|
[Description("None")] None,
|
||||||
|
[Description("% of")] PercentageOf,
|
||||||
|
[Description("% of property")] PercentageOfProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
150
Artemis/Artemis/Models/Profiles/LayerModel.cs
Normal file
150
Artemis/Artemis/Models/Profiles/LayerModel.cs
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using Artemis.Utilities.ParentChild;
|
||||||
|
|
||||||
|
namespace Artemis.Models.Profiles
|
||||||
|
{
|
||||||
|
public class LayerModel : IChildItem<LayerModel>, IChildItem<ProfileModel>
|
||||||
|
{
|
||||||
|
[XmlIgnore] private readonly LayerDrawer _drawer;
|
||||||
|
[XmlIgnore] private bool _mustDraw;
|
||||||
|
|
||||||
|
public LayerModel()
|
||||||
|
{
|
||||||
|
UserProps = new LayerPropertiesModel();
|
||||||
|
CalcProps = new LayerPropertiesModel();
|
||||||
|
|
||||||
|
Children = new ChildItemCollection<LayerModel, LayerModel>(this);
|
||||||
|
LayerConditions = new List<LayerConditionModel>();
|
||||||
|
LayerProperties = new List<LayerDynamicPropertiesModel>();
|
||||||
|
|
||||||
|
_mustDraw = true;
|
||||||
|
_drawer = new LayerDrawer(this, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public LayerType LayerType { get; set; }
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
public int Order { get; set; }
|
||||||
|
public LayerPropertiesModel UserProps { get; set; }
|
||||||
|
|
||||||
|
public ChildItemCollection<LayerModel, LayerModel> Children { get; }
|
||||||
|
public List<LayerConditionModel> LayerConditions { get; set; }
|
||||||
|
public List<LayerDynamicPropertiesModel> LayerProperties { get; set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public LayerPropertiesModel CalcProps { get; set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public ImageSource LayerImage => _drawer.GetThumbnail();
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public LayerModel ParentLayer { get; internal set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public ProfileModel ParentProfile { get; internal set; }
|
||||||
|
|
||||||
|
public bool ConditionsMet<T>(IGameDataModel dataModel)
|
||||||
|
{
|
||||||
|
return Enabled && LayerConditions.All(cm => cm.ConditionMet<T>(dataModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawPreview(DrawingContext c)
|
||||||
|
{
|
||||||
|
GeneralHelpers.CopyProperties(CalcProps, UserProps);
|
||||||
|
if (LayerType == LayerType.Keyboard || LayerType == LayerType.Keyboard)
|
||||||
|
_drawer.Draw(c, _mustDraw);
|
||||||
|
else if (LayerType == LayerType.KeyboardGif)
|
||||||
|
_drawer.DrawGif(c);
|
||||||
|
_mustDraw = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Draw<T>(IGameDataModel dataModel, DrawingContext c)
|
||||||
|
{
|
||||||
|
if (!ConditionsMet<T>(dataModel))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (LayerType == LayerType.Folder)
|
||||||
|
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
||||||
|
layerModel.Draw<T>(dataModel, c);
|
||||||
|
else if (LayerType == LayerType.Keyboard || LayerType == LayerType.Keyboard)
|
||||||
|
_drawer.Draw(c);
|
||||||
|
else if (LayerType == LayerType.KeyboardGif)
|
||||||
|
_drawer.DrawGif(c);
|
||||||
|
else if (LayerType == LayerType.Mouse)
|
||||||
|
_drawer.UpdateMouse();
|
||||||
|
else if (LayerType == LayerType.Headset)
|
||||||
|
_drawer.UpdateHeadset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update<T>(IGameDataModel dataModel)
|
||||||
|
{
|
||||||
|
if (LayerType == LayerType.Folder)
|
||||||
|
{
|
||||||
|
foreach (var layerModel in Children)
|
||||||
|
layerModel.Update<T>(dataModel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeneralHelpers.CopyProperties(CalcProps, UserProps);
|
||||||
|
foreach (var dynamicProperty in LayerProperties)
|
||||||
|
dynamicProperty.ApplyProperty<T>(dataModel, UserProps, CalcProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reorder(LayerModel selectedLayer, bool moveUp)
|
||||||
|
{
|
||||||
|
// Fix the sorting just in case
|
||||||
|
FixOrder();
|
||||||
|
|
||||||
|
int newOrder;
|
||||||
|
if (moveUp)
|
||||||
|
newOrder = selectedLayer.Order - 1;
|
||||||
|
else
|
||||||
|
newOrder = selectedLayer.Order + 1;
|
||||||
|
|
||||||
|
var target = Children.FirstOrDefault(l => l.Order == newOrder);
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
target.Order = selectedLayer.Order;
|
||||||
|
selectedLayer.Order = newOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FixOrder()
|
||||||
|
{
|
||||||
|
Children.Sort(l => l.Order);
|
||||||
|
for (var i = 0; i < Children.Count; i++)
|
||||||
|
Children[i].Order = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IChildItem<Parent> Members
|
||||||
|
|
||||||
|
LayerModel IChildItem<LayerModel>.Parent
|
||||||
|
{
|
||||||
|
get { return ParentLayer; }
|
||||||
|
set { ParentLayer = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
ProfileModel IChildItem<ProfileModel>.Parent
|
||||||
|
{
|
||||||
|
get { return ParentProfile; }
|
||||||
|
set { ParentProfile = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum LayerType
|
||||||
|
{
|
||||||
|
[Description("Folder")] Folder,
|
||||||
|
[Description("Keyboard")] Keyboard,
|
||||||
|
[Description("Keyboard - GIF")] KeyboardGif,
|
||||||
|
[Description("Mouse")] Mouse,
|
||||||
|
[Description("Headset")] Headset
|
||||||
|
}
|
||||||
|
}
|
||||||
41
Artemis/Artemis/Models/Profiles/LayerPropertiesModel.cs
Normal file
41
Artemis/Artemis/Models/Profiles/LayerPropertiesModel.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace Artemis.Models.Profiles
|
||||||
|
{
|
||||||
|
[XmlInclude(typeof (SolidColorBrush))]
|
||||||
|
[XmlInclude(typeof (LinearGradientBrush))]
|
||||||
|
[XmlInclude(typeof (RadialGradientBrush))]
|
||||||
|
[XmlInclude(typeof (MatrixTransform))]
|
||||||
|
public class LayerPropertiesModel
|
||||||
|
{
|
||||||
|
public int X { get; set; }
|
||||||
|
public int Y { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
public double Opacity { get; set; }
|
||||||
|
public bool ContainedBrush { get; set; }
|
||||||
|
public LayerAnimation Animation { get; set; }
|
||||||
|
public double AnimationSpeed { get; set; }
|
||||||
|
public Brush Brush { get; set; }
|
||||||
|
|
||||||
|
public Rect GetRect(int scale = 4)
|
||||||
|
{
|
||||||
|
return new Rect(X*scale, Y*scale, Width*scale, Height*scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public enum LayerAnimation
|
||||||
|
{
|
||||||
|
[Description("None")] None,
|
||||||
|
[Description("Slide left")] SlideLeft,
|
||||||
|
[Description("Slide right")] SlideRight,
|
||||||
|
[Description("Slide up")] SlideUp,
|
||||||
|
[Description("Slide down")] SlideDown,
|
||||||
|
[Description("Grow")] Grow,
|
||||||
|
[Description("Pulse")] Pulse
|
||||||
|
}
|
||||||
|
}
|
||||||
134
Artemis/Artemis/Models/Profiles/ProfileModel.cs
Normal file
134
Artemis/Artemis/Models/Profiles/ProfileModel.cs
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using Artemis.Utilities.ParentChild;
|
||||||
|
using Color = System.Windows.Media.Color;
|
||||||
|
|
||||||
|
namespace Artemis.Models.Profiles
|
||||||
|
{
|
||||||
|
public class ProfileModel
|
||||||
|
{
|
||||||
|
public ProfileModel()
|
||||||
|
{
|
||||||
|
Layers = new ChildItemCollection<ProfileModel, LayerModel>(this);
|
||||||
|
DrawingVisual = new DrawingVisual();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChildItemCollection<ProfileModel, LayerModel> Layers { get; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string KeyboardName { get; set; }
|
||||||
|
public string GameName { get; set; }
|
||||||
|
public DrawingVisual DrawingVisual { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
protected bool Equals(ProfileModel other)
|
||||||
|
{
|
||||||
|
return string.Equals(Name, other.Name) && string.Equals(KeyboardName, other.KeyboardName) &&
|
||||||
|
string.Equals(GameName, other.GameName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (ReferenceEquals(null, obj)) return false;
|
||||||
|
if (ReferenceEquals(this, obj)) return true;
|
||||||
|
if (obj.GetType() != GetType()) return false;
|
||||||
|
return Equals((ProfileModel) obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
unchecked
|
||||||
|
{
|
||||||
|
var hashCode = Name?.GetHashCode() ?? 0;
|
||||||
|
hashCode = (hashCode*397) ^ (KeyboardName?.GetHashCode() ?? 0);
|
||||||
|
hashCode = (hashCode*397) ^ (GameName?.GetHashCode() ?? 0);
|
||||||
|
return hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new layer with default settings to the profile
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The newly added layer</returns>
|
||||||
|
public LayerModel AddLayer()
|
||||||
|
{
|
||||||
|
var layer = new LayerModel
|
||||||
|
{
|
||||||
|
Name = "New layer",
|
||||||
|
Enabled = true,
|
||||||
|
Order = -1,
|
||||||
|
LayerType = LayerType.Keyboard,
|
||||||
|
UserProps = new LayerPropertiesModel
|
||||||
|
{
|
||||||
|
Brush = new SolidColorBrush(ColorHelpers.GetRandomRainbowMediaColor()),
|
||||||
|
Animation = LayerAnimation.None,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
X = 0,
|
||||||
|
Y = 0,
|
||||||
|
Opacity = 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Layers.Add(layer);
|
||||||
|
FixOrder();
|
||||||
|
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reorder(LayerModel selectedLayer, bool moveUp)
|
||||||
|
{
|
||||||
|
// Fix the sorting just in case
|
||||||
|
FixOrder();
|
||||||
|
|
||||||
|
int newOrder;
|
||||||
|
if (moveUp)
|
||||||
|
newOrder = selectedLayer.Order - 1;
|
||||||
|
else
|
||||||
|
newOrder = selectedLayer.Order + 1;
|
||||||
|
|
||||||
|
var target = Layers.FirstOrDefault(l => l.Order == newOrder);
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
target.Order = selectedLayer.Order;
|
||||||
|
selectedLayer.Order = newOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FixOrder()
|
||||||
|
{
|
||||||
|
Layers.Sort(l => l.Order);
|
||||||
|
for (var i = 0; i < Layers.Count; i++)
|
||||||
|
Layers[i].Order = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap GenerateBitmap<T>(Rect keyboardRect, IGameDataModel gameDataModel)
|
||||||
|
{
|
||||||
|
Bitmap bitmap = null;
|
||||||
|
DrawingVisual.Dispatcher.Invoke(delegate
|
||||||
|
{
|
||||||
|
var visual = new DrawingVisual();
|
||||||
|
using (var c = visual.RenderOpen())
|
||||||
|
{
|
||||||
|
// Setup the DrawingVisual's size
|
||||||
|
c.PushClip(new RectangleGeometry(keyboardRect));
|
||||||
|
c.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, keyboardRect);
|
||||||
|
|
||||||
|
// Draw the layers
|
||||||
|
foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
|
||||||
|
layerModel.Draw<T>(gameDataModel, c);
|
||||||
|
|
||||||
|
// Remove the clip
|
||||||
|
c.Pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
bitmap = ImageUtilities.DrawinVisualToBitmap(visual, keyboardRect);
|
||||||
|
});
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,37 +1,37 @@
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AmbientLightning
|
namespace Artemis.Modules.Effects.AmbientLightning
|
||||||
{
|
{
|
||||||
internal class AmbientLightningEffectSettings : EffectSettings
|
internal class AmbientLightningEffectSettings : EffectSettings
|
||||||
{
|
{
|
||||||
public AmbientLightningEffectSettings()
|
public AmbientLightningEffectSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
public bool Rotate { get; set; }
|
public bool Rotate { get; set; }
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
public LinearGradientMode Type { get; set; }
|
public LinearGradientMode Type { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
ToDefault();
|
ToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Width = 84;
|
Width = 84;
|
||||||
Height = 24;
|
Height = 24;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
Type = LinearGradientMode.Horizontal;
|
Type = LinearGradientMode.Horizontal;
|
||||||
Rotate = true;
|
Rotate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,32 +1,32 @@
|
|||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AmbientLightning
|
namespace Artemis.Modules.Effects.AmbientLightning
|
||||||
{
|
{
|
||||||
internal class AmbientLightningEffectViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
internal class AmbientLightningEffectViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||||
{
|
{
|
||||||
public AmbientLightningEffectViewModel(MainManager mainManager)
|
public AmbientLightningEffectViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
// Subscribe to main model
|
// Subscribe to main model
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
MainManager.Events.Subscribe(this);
|
MainManager.Events.Subscribe(this);
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
EffectSettings = new AmbientLightningEffectSettings();
|
EffectSettings = new AmbientLightningEffectSettings();
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
EffectModel = new AmbientLightningEffectModel(mainManager, (AmbientLightningEffectSettings) EffectSettings);
|
EffectModel = new AmbientLightningEffectModel(mainManager, (AmbientLightningEffectSettings) EffectSettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string Name => "Ambient Lightning";
|
public static string Name => "Ambient Lightning";
|
||||||
|
|
||||||
public void Handle(ActiveEffectChanged message)
|
public void Handle(ActiveEffectChanged message)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => EffectEnabled);
|
NotifyOfPropertyChange(() => EffectEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,110 +1,110 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.42000
|
// Runtime Version:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer {
|
namespace Artemis.Modules.Effects.AudioVisualizer {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||||
internal sealed partial class AudioVisualization : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class AudioVisualization : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static AudioVisualization defaultInstance = ((AudioVisualization)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AudioVisualization())));
|
private static AudioVisualization defaultInstance = ((AudioVisualization)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AudioVisualization())));
|
||||||
|
|
||||||
public static AudioVisualization Default {
|
public static AudioVisualization Default {
|
||||||
get {
|
get {
|
||||||
return defaultInstance;
|
return defaultInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("4")]
|
[global::System.Configuration.DefaultSettingValueAttribute("4")]
|
||||||
public int Sensitivity {
|
public int Sensitivity {
|
||||||
get {
|
get {
|
||||||
return ((int)(this["Sensitivity"]));
|
return ((int)(this["Sensitivity"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["Sensitivity"] = value;
|
this["Sensitivity"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("21")]
|
[global::System.Configuration.DefaultSettingValueAttribute("21")]
|
||||||
public int Bars {
|
public int Bars {
|
||||||
get {
|
get {
|
||||||
return ((int)(this["Bars"]));
|
return ((int)(this["Bars"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["Bars"] = value;
|
this["Bars"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
public bool FromBottom {
|
public bool FromBottom {
|
||||||
get {
|
get {
|
||||||
return ((bool)(this["FromBottom"]));
|
return ((bool)(this["FromBottom"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["FromBottom"] = value;
|
this["FromBottom"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("3")]
|
[global::System.Configuration.DefaultSettingValueAttribute("3")]
|
||||||
public int FadeSpeed {
|
public int FadeSpeed {
|
||||||
get {
|
get {
|
||||||
return ((int)(this["FadeSpeed"]));
|
return ((int)(this["FadeSpeed"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["FadeSpeed"] = value;
|
this["FadeSpeed"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFF90000")]
|
[global::System.Configuration.DefaultSettingValueAttribute("#FFF90000")]
|
||||||
public global::System.Windows.Media.Color TopColor {
|
public global::System.Windows.Media.Color TopColor {
|
||||||
get {
|
get {
|
||||||
return ((global::System.Windows.Media.Color)(this["TopColor"]));
|
return ((global::System.Windows.Media.Color)(this["TopColor"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["TopColor"] = value;
|
this["TopColor"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF761E")]
|
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF761E")]
|
||||||
public global::System.Windows.Media.Color MiddleColor {
|
public global::System.Windows.Media.Color MiddleColor {
|
||||||
get {
|
get {
|
||||||
return ((global::System.Windows.Media.Color)(this["MiddleColor"]));
|
return ((global::System.Windows.Media.Color)(this["MiddleColor"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["MiddleColor"] = value;
|
this["MiddleColor"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("#FF00DF00")]
|
[global::System.Configuration.DefaultSettingValueAttribute("#FF00DF00")]
|
||||||
public global::System.Windows.Media.Color BottomColor {
|
public global::System.Windows.Media.Color BottomColor {
|
||||||
get {
|
get {
|
||||||
return ((global::System.Windows.Media.Color)(this["BottomColor"]));
|
return ((global::System.Windows.Media.Color)(this["BottomColor"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["BottomColor"] = value;
|
this["BottomColor"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,203 +1,203 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Modules.Effects.AudioVisualizer.Utilities;
|
using Artemis.Modules.Effects.AudioVisualizer.Utilities;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using NAudio.CoreAudioApi;
|
using NAudio.CoreAudioApi;
|
||||||
using NAudio.Wave;
|
using NAudio.Wave;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||||
{
|
{
|
||||||
public class AudioVisualizerModel : EffectModel
|
public class AudioVisualizerModel : EffectModel
|
||||||
{
|
{
|
||||||
private const int FftLength = 2048;
|
private const int FftLength = 2048;
|
||||||
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
|
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
|
||||||
private bool _fromBottom;
|
private bool _fromBottom;
|
||||||
private bool _generating;
|
private bool _generating;
|
||||||
private int _sensitivity;
|
private int _sensitivity;
|
||||||
private IWaveIn _waveIn;
|
private IWaveIn _waveIn;
|
||||||
|
|
||||||
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
|
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Name = "Audiovisualizer";
|
Name = "Audiovisualizer";
|
||||||
DeviceIds = new List<string>();
|
DeviceIds = new List<string>();
|
||||||
SpectrumData = new List<byte>();
|
SpectrumData = new List<byte>();
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Lines { get; set; }
|
public int Lines { get; set; }
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public AudioVisualizerSettings Settings { get; set; }
|
public AudioVisualizerSettings Settings { get; set; }
|
||||||
public List<byte> SpectrumData { get; set; }
|
public List<byte> SpectrumData { get; set; }
|
||||||
public List<KeyboardRectangle> SoundRectangles { get; set; }
|
public List<KeyboardRectangle> SoundRectangles { get; set; }
|
||||||
|
|
||||||
public List<string> DeviceIds { get; set; }
|
public List<string> DeviceIds { get; set; }
|
||||||
public string SelectedDeviceId { get; set; }
|
public string SelectedDeviceId { get; set; }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
_sampleAggregator.PerformFFT = false;
|
_sampleAggregator.PerformFFT = false;
|
||||||
_sampleAggregator.FftCalculated -= FftCalculated;
|
_sampleAggregator.FftCalculated -= FftCalculated;
|
||||||
|
|
||||||
_waveIn.StopRecording();
|
_waveIn.StopRecording();
|
||||||
_waveIn.DataAvailable -= OnDataAvailable;
|
_waveIn.DataAvailable -= OnDataAvailable;
|
||||||
_waveIn = null;
|
_waveIn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
Lines = MainManager.KeyboardManager.ActiveKeyboard.Width;
|
Lines = MainManager.KeyboardManager.ActiveKeyboard.Width;
|
||||||
|
|
||||||
// TODO: Device selection
|
// TODO: Device selection
|
||||||
SelectedDeviceId = new MMDeviceEnumerator()
|
SelectedDeviceId = new MMDeviceEnumerator()
|
||||||
.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active)
|
.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active)
|
||||||
.FirstOrDefault()?.ID;
|
.FirstOrDefault()?.ID;
|
||||||
|
|
||||||
// Apply settings
|
// Apply settings
|
||||||
SoundRectangles = new List<KeyboardRectangle>();
|
SoundRectangles = new List<KeyboardRectangle>();
|
||||||
for (var i = 0; i < Lines; i++)
|
for (var i = 0; i < Lines; i++)
|
||||||
{
|
{
|
||||||
SoundRectangles.Add(new KeyboardRectangle(
|
SoundRectangles.Add(new KeyboardRectangle(
|
||||||
MainManager.KeyboardManager.ActiveKeyboard,
|
MainManager.KeyboardManager.ActiveKeyboard,
|
||||||
0, 0, new List<Color>
|
0, 0, new List<Color>
|
||||||
{
|
{
|
||||||
ColorHelpers.ToDrawingColor(Settings.TopColor),
|
ColorHelpers.ToDrawingColor(Settings.TopColor),
|
||||||
ColorHelpers.ToDrawingColor(Settings.MiddleColor),
|
ColorHelpers.ToDrawingColor(Settings.MiddleColor),
|
||||||
ColorHelpers.ToDrawingColor(Settings.BottomColor)
|
ColorHelpers.ToDrawingColor(Settings.BottomColor)
|
||||||
},
|
},
|
||||||
LinearGradientMode.Vertical) {ContainedBrush = false, Height = 0});
|
LinearGradientMode.Vertical) {ContainedBrush = false, Height = 0});
|
||||||
}
|
}
|
||||||
_sensitivity = Settings.Sensitivity;
|
_sensitivity = Settings.Sensitivity;
|
||||||
_fromBottom = Settings.FromBottom;
|
_fromBottom = Settings.FromBottom;
|
||||||
_sampleAggregator.FftCalculated += FftCalculated;
|
_sampleAggregator.FftCalculated += FftCalculated;
|
||||||
_sampleAggregator.PerformFFT = true;
|
_sampleAggregator.PerformFFT = true;
|
||||||
|
|
||||||
// Start listening for sound data
|
// Start listening for sound data
|
||||||
_waveIn = new WasapiLoopbackCapture();
|
_waveIn = new WasapiLoopbackCapture();
|
||||||
_waveIn.DataAvailable += OnDataAvailable;
|
_waveIn.DataAvailable += OnDataAvailable;
|
||||||
_waveIn.StartRecording();
|
_waveIn.StartRecording();
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
// TODO: Use lock instead of a bool
|
// TODO: Use lock instead of a bool
|
||||||
// Start filling the model
|
// Start filling the model
|
||||||
_generating = true;
|
_generating = true;
|
||||||
|
|
||||||
if (SelectedDeviceId == null)
|
if (SelectedDeviceId == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var device = new MMDeviceEnumerator()
|
var device = new MMDeviceEnumerator()
|
||||||
.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active)
|
.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active)
|
||||||
.FirstOrDefault(d => d.ID == SelectedDeviceId);
|
.FirstOrDefault(d => d.ID == SelectedDeviceId);
|
||||||
|
|
||||||
if (device == null || SpectrumData == null)
|
if (device == null || SpectrumData == null)
|
||||||
return;
|
return;
|
||||||
if (!SpectrumData.Any())
|
if (!SpectrumData.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Parse spectrum data
|
// Parse spectrum data
|
||||||
for (var i = 0; i < Lines; i++)
|
for (var i = 0; i < Lines; i++)
|
||||||
{
|
{
|
||||||
int height;
|
int height;
|
||||||
if (SpectrumData.Count - 1 < i || SpectrumData[i] == 0)
|
if (SpectrumData.Count - 1 < i || SpectrumData[i] == 0)
|
||||||
height = 0;
|
height = 0;
|
||||||
else
|
else
|
||||||
height = (int) Math.Round(SpectrumData[i]/2.55);
|
height = (int) Math.Round(SpectrumData[i]/2.55);
|
||||||
|
|
||||||
// Apply Sensitivity setting
|
// Apply Sensitivity setting
|
||||||
height = height*_sensitivity;
|
height = height*_sensitivity;
|
||||||
var keyboardHeight =
|
var keyboardHeight =
|
||||||
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
|
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
|
||||||
if (keyboardHeight > SoundRectangles[i].Height)
|
if (keyboardHeight > SoundRectangles[i].Height)
|
||||||
SoundRectangles[i].Height = keyboardHeight;
|
SoundRectangles[i].Height = keyboardHeight;
|
||||||
else
|
else
|
||||||
SoundRectangles[i].Height = SoundRectangles[i].Height - Settings.FadeSpeed;
|
SoundRectangles[i].Height = SoundRectangles[i].Height - Settings.FadeSpeed;
|
||||||
// Apply Bars setting
|
// Apply Bars setting
|
||||||
SoundRectangles[i].X = i*Scale;
|
SoundRectangles[i].X = i*Scale;
|
||||||
SoundRectangles[i].Width = Scale;
|
SoundRectangles[i].Width = Scale;
|
||||||
|
|
||||||
if (_fromBottom)
|
if (_fromBottom)
|
||||||
SoundRectangles[i].Y = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale -
|
SoundRectangles[i].Y = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale -
|
||||||
SoundRectangles[i].Height;
|
SoundRectangles[i].Height;
|
||||||
}
|
}
|
||||||
_generating = false;
|
_generating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
if (SpectrumData == null || SoundRectangles == null)
|
if (SpectrumData == null || SoundRectangles == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Lock the _spectrumData array while busy with it
|
// Lock the _spectrumData array while busy with it
|
||||||
_generating = true;
|
_generating = true;
|
||||||
|
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
foreach (var soundRectangle in SoundRectangles)
|
foreach (var soundRectangle in SoundRectangles)
|
||||||
soundRectangle.Draw(g);
|
soundRectangle.Draw(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
_generating = false;
|
_generating = false;
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDataAvailable(object sender, WaveInEventArgs e)
|
private void OnDataAvailable(object sender, WaveInEventArgs e)
|
||||||
{
|
{
|
||||||
var buffer = e.Buffer;
|
var buffer = e.Buffer;
|
||||||
var bytesRecorded = e.BytesRecorded;
|
var bytesRecorded = e.BytesRecorded;
|
||||||
var bufferIncrement = _waveIn.WaveFormat.BlockAlign;
|
var bufferIncrement = _waveIn.WaveFormat.BlockAlign;
|
||||||
|
|
||||||
for (var index = 0; index < bytesRecorded; index += bufferIncrement)
|
for (var index = 0; index < bytesRecorded; index += bufferIncrement)
|
||||||
{
|
{
|
||||||
var sample32 = BitConverter.ToSingle(buffer, index);
|
var sample32 = BitConverter.ToSingle(buffer, index);
|
||||||
_sampleAggregator.Add(sample32);
|
_sampleAggregator.Add(sample32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FftCalculated(object sender, FftEventArgs e)
|
private void FftCalculated(object sender, FftEventArgs e)
|
||||||
{
|
{
|
||||||
if (_generating)
|
if (_generating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
var b0 = 0;
|
var b0 = 0;
|
||||||
|
|
||||||
SpectrumData.Clear();
|
SpectrumData.Clear();
|
||||||
for (x = 0; x < Lines; x++)
|
for (x = 0; x < Lines; x++)
|
||||||
{
|
{
|
||||||
float peak = 0;
|
float peak = 0;
|
||||||
var b1 = (int) Math.Pow(2, x*10.0/(Lines - 1));
|
var b1 = (int) Math.Pow(2, x*10.0/(Lines - 1));
|
||||||
if (b1 > 2047)
|
if (b1 > 2047)
|
||||||
b1 = 2047;
|
b1 = 2047;
|
||||||
if (b1 <= b0)
|
if (b1 <= b0)
|
||||||
b1 = b0 + 1;
|
b1 = b0 + 1;
|
||||||
for (; b0 < b1; b0++)
|
for (; b0 < b1; b0++)
|
||||||
{
|
{
|
||||||
if (peak < e.Result[1 + b0].X)
|
if (peak < e.Result[1 + b0].X)
|
||||||
peak = e.Result[1 + b0].X;
|
peak = e.Result[1 + b0].X;
|
||||||
}
|
}
|
||||||
var y = (int) (Math.Sqrt(peak)*3*255 - 4);
|
var y = (int) (Math.Sqrt(peak)*3*255 - 4);
|
||||||
if (y > 255)
|
if (y > 255)
|
||||||
y = 255;
|
y = 255;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = 0;
|
y = 0;
|
||||||
SpectrumData.Add((byte) y);
|
SpectrumData.Add((byte) y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,56 +1,56 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||||
{
|
{
|
||||||
public class AudioVisualizerSettings : EffectSettings
|
public class AudioVisualizerSettings : EffectSettings
|
||||||
{
|
{
|
||||||
public AudioVisualizerSettings()
|
public AudioVisualizerSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Sensitivity { get; set; }
|
public int Sensitivity { get; set; }
|
||||||
public int Bars { get; set; }
|
public int Bars { get; set; }
|
||||||
public bool FromBottom { get; set; }
|
public bool FromBottom { get; set; }
|
||||||
public int FadeSpeed { get; set; }
|
public int FadeSpeed { get; set; }
|
||||||
public Color TopColor { get; set; }
|
public Color TopColor { get; set; }
|
||||||
public Color MiddleColor { get; set; }
|
public Color MiddleColor { get; set; }
|
||||||
public Color BottomColor { get; set; }
|
public Color BottomColor { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
Sensitivity = AudioVisualization.Default.Sensitivity;
|
Sensitivity = AudioVisualization.Default.Sensitivity;
|
||||||
Bars = AudioVisualization.Default.Bars;
|
Bars = AudioVisualization.Default.Bars;
|
||||||
FromBottom = AudioVisualization.Default.FromBottom;
|
FromBottom = AudioVisualization.Default.FromBottom;
|
||||||
FadeSpeed = AudioVisualization.Default.FadeSpeed;
|
FadeSpeed = AudioVisualization.Default.FadeSpeed;
|
||||||
TopColor = AudioVisualization.Default.TopColor;
|
TopColor = AudioVisualization.Default.TopColor;
|
||||||
MiddleColor = AudioVisualization.Default.MiddleColor;
|
MiddleColor = AudioVisualization.Default.MiddleColor;
|
||||||
BottomColor = AudioVisualization.Default.BottomColor;
|
BottomColor = AudioVisualization.Default.BottomColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
AudioVisualization.Default.Sensitivity = Sensitivity;
|
AudioVisualization.Default.Sensitivity = Sensitivity;
|
||||||
AudioVisualization.Default.Bars = Bars;
|
AudioVisualization.Default.Bars = Bars;
|
||||||
AudioVisualization.Default.FromBottom = FromBottom;
|
AudioVisualization.Default.FromBottom = FromBottom;
|
||||||
AudioVisualization.Default.FadeSpeed = FadeSpeed;
|
AudioVisualization.Default.FadeSpeed = FadeSpeed;
|
||||||
AudioVisualization.Default.TopColor = TopColor;
|
AudioVisualization.Default.TopColor = TopColor;
|
||||||
AudioVisualization.Default.MiddleColor = MiddleColor;
|
AudioVisualization.Default.MiddleColor = MiddleColor;
|
||||||
AudioVisualization.Default.BottomColor = BottomColor;
|
AudioVisualization.Default.BottomColor = BottomColor;
|
||||||
|
|
||||||
AudioVisualization.Default.Save();
|
AudioVisualization.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Sensitivity = 4;
|
Sensitivity = 4;
|
||||||
Bars = 21;
|
Bars = 21;
|
||||||
FromBottom = true;
|
FromBottom = true;
|
||||||
FadeSpeed = 3;
|
FadeSpeed = 3;
|
||||||
TopColor = Color.FromArgb(255, 249, 0, 0);
|
TopColor = Color.FromArgb(255, 249, 0, 0);
|
||||||
MiddleColor = Color.FromArgb(255, 255, 118, 30);
|
MiddleColor = Color.FromArgb(255, 255, 118, 30);
|
||||||
BottomColor = Color.FromArgb(255, 0, 223, 0);
|
BottomColor = Color.FromArgb(255, 0, 223, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for AudioVisualizerView.xaml
|
/// Interaction logic for AudioVisualizerView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class AudioVisualizerView : UserControl
|
public partial class AudioVisualizerView : UserControl
|
||||||
{
|
{
|
||||||
public AudioVisualizerView()
|
public AudioVisualizerView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,31 +1,31 @@
|
|||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||||
{
|
{
|
||||||
public class AudioVisualizerViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
public class AudioVisualizerViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||||
{
|
{
|
||||||
public AudioVisualizerViewModel(MainManager mainManager)
|
public AudioVisualizerViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
// Subscribe to main model
|
// Subscribe to main model
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
MainManager.Events.Subscribe(this);
|
MainManager.Events.Subscribe(this);
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
EffectSettings = new AudioVisualizerSettings();
|
EffectSettings = new AudioVisualizerSettings();
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings);
|
EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Name => "Audio Visualizer";
|
public static string Name => "Audio Visualizer";
|
||||||
|
|
||||||
public void Handle(ActiveEffectChanged message)
|
public void Handle(ActiveEffectChanged message)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => EffectEnabled);
|
NotifyOfPropertyChange(() => EffectEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,16 +2,16 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using NAudio.Dsp;
|
using NAudio.Dsp;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer.Utilities
|
namespace Artemis.Modules.Effects.AudioVisualizer.Utilities
|
||||||
{
|
{
|
||||||
public class FftEventArgs : EventArgs
|
public class FftEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
[DebuggerStepThrough]
|
[DebuggerStepThrough]
|
||||||
public FftEventArgs(Complex[] result)
|
public FftEventArgs(Complex[] result)
|
||||||
{
|
{
|
||||||
Result = result;
|
Result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Complex[] Result { get; private set; }
|
public Complex[] Result { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,55 +1,55 @@
|
|||||||
using System;
|
using System;
|
||||||
using NAudio.Dsp;
|
using NAudio.Dsp;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer.Utilities
|
namespace Artemis.Modules.Effects.AudioVisualizer.Utilities
|
||||||
{ // The Complex and FFT are here!
|
{ // The Complex and FFT are here!
|
||||||
|
|
||||||
public class SampleAggregator
|
public class SampleAggregator
|
||||||
{
|
{
|
||||||
private readonly FftEventArgs fftArgs;
|
private readonly FftEventArgs fftArgs;
|
||||||
|
|
||||||
// This Complex is NAudio's own!
|
// This Complex is NAudio's own!
|
||||||
private readonly Complex[] fftBuffer;
|
private readonly Complex[] fftBuffer;
|
||||||
private readonly int fftLength;
|
private readonly int fftLength;
|
||||||
private readonly int m;
|
private readonly int m;
|
||||||
private int fftPos;
|
private int fftPos;
|
||||||
|
|
||||||
public SampleAggregator(int fftLength)
|
public SampleAggregator(int fftLength)
|
||||||
{
|
{
|
||||||
if (!IsPowerOfTwo(fftLength))
|
if (!IsPowerOfTwo(fftLength))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("FFT Length must be a power of two");
|
throw new ArgumentException("FFT Length must be a power of two");
|
||||||
}
|
}
|
||||||
m = (int) Math.Log(fftLength, 2.0);
|
m = (int) Math.Log(fftLength, 2.0);
|
||||||
this.fftLength = fftLength;
|
this.fftLength = fftLength;
|
||||||
fftBuffer = new Complex[fftLength];
|
fftBuffer = new Complex[fftLength];
|
||||||
fftArgs = new FftEventArgs(fftBuffer);
|
fftArgs = new FftEventArgs(fftBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PerformFFT { get; set; }
|
public bool PerformFFT { get; set; }
|
||||||
// FFT
|
// FFT
|
||||||
public event EventHandler<FftEventArgs> FftCalculated;
|
public event EventHandler<FftEventArgs> FftCalculated;
|
||||||
|
|
||||||
private bool IsPowerOfTwo(int x)
|
private bool IsPowerOfTwo(int x)
|
||||||
{
|
{
|
||||||
return (x & (x - 1)) == 0;
|
return (x & (x - 1)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(float value)
|
public void Add(float value)
|
||||||
{
|
{
|
||||||
if (PerformFFT && FftCalculated != null)
|
if (PerformFFT && FftCalculated != null)
|
||||||
{
|
{
|
||||||
// Remember the window function! There are many others as well.
|
// Remember the window function! There are many others as well.
|
||||||
fftBuffer[fftPos].X = (float) (value*FastFourierTransform.HammingWindow(fftPos, fftLength));
|
fftBuffer[fftPos].X = (float) (value*FastFourierTransform.HammingWindow(fftPos, fftLength));
|
||||||
fftBuffer[fftPos].Y = 0; // This is always zero with audio.
|
fftBuffer[fftPos].Y = 0; // This is always zero with audio.
|
||||||
fftPos++;
|
fftPos++;
|
||||||
if (fftPos >= fftLength)
|
if (fftPos >= fftLength)
|
||||||
{
|
{
|
||||||
fftPos = 0;
|
fftPos = 0;
|
||||||
FastFourierTransform.FFT(true, m, fftBuffer);
|
FastFourierTransform.FFT(true, m, fftBuffer);
|
||||||
FftCalculated(this, fftArgs);
|
FftCalculated(this, fftArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,71 +1,71 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.Debug
|
namespace Artemis.Modules.Effects.Debug
|
||||||
{
|
{
|
||||||
internal class DebugEffectModel : EffectModel
|
internal class DebugEffectModel : EffectModel
|
||||||
{
|
{
|
||||||
public DebugEffectModel(MainManager mainManager, DebugEffectSettings settings) : base(mainManager)
|
public DebugEffectModel(MainManager mainManager, DebugEffectSettings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Name = "Debug Effect";
|
Name = "Debug Effect";
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public DebugEffectSettings Settings { get; set; }
|
public DebugEffectSettings Settings { get; set; }
|
||||||
|
|
||||||
public KeyboardRectangle KeyboardRectangle { get; set; }
|
public KeyboardRectangle KeyboardRectangle { get; set; }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||||
{
|
{
|
||||||
Color.Red,
|
Color.Red,
|
||||||
Color.OrangeRed,
|
Color.OrangeRed,
|
||||||
Color.Yellow,
|
Color.Yellow,
|
||||||
Color.Green,
|
Color.Green,
|
||||||
Color.Blue,
|
Color.Blue,
|
||||||
Color.Purple,
|
Color.Purple,
|
||||||
Color.DeepPink
|
Color.DeepPink
|
||||||
}, LinearGradientMode.Horizontal);
|
}, LinearGradientMode.Horizontal);
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
KeyboardRectangle.Height = Settings.Height;
|
KeyboardRectangle.Height = Settings.Height;
|
||||||
KeyboardRectangle.Width = Settings.Width;
|
KeyboardRectangle.Width = Settings.Width;
|
||||||
KeyboardRectangle.GradientMode = Settings.Type;
|
KeyboardRectangle.GradientMode = Settings.Type;
|
||||||
KeyboardRectangle.Rotate = Settings.Rotate;
|
KeyboardRectangle.Rotate = Settings.Rotate;
|
||||||
KeyboardRectangle.Scale = Settings.Scale;
|
KeyboardRectangle.Scale = Settings.Scale;
|
||||||
Scale = Settings.Scale;
|
Scale = Settings.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = new Bitmap(21*Scale, 6*Scale);
|
var bitmap = new Bitmap(21*Scale, 6*Scale);
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
KeyboardRectangle.Draw(g);
|
KeyboardRectangle.Draw(g);
|
||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,37 +1,37 @@
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.Debug
|
namespace Artemis.Modules.Effects.Debug
|
||||||
{
|
{
|
||||||
internal class DebugEffectSettings : EffectSettings
|
internal class DebugEffectSettings : EffectSettings
|
||||||
{
|
{
|
||||||
public DebugEffectSettings()
|
public DebugEffectSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
public bool Rotate { get; set; }
|
public bool Rotate { get; set; }
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
public LinearGradientMode Type { get; set; }
|
public LinearGradientMode Type { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
ToDefault();
|
ToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Width = 84;
|
Width = 84;
|
||||||
Height = 24;
|
Height = 24;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
Type = LinearGradientMode.Horizontal;
|
Type = LinearGradientMode.Horizontal;
|
||||||
Rotate = true;
|
Rotate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.Debug
|
namespace Artemis.Modules.Effects.Debug
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for DebugEffectView.xaml
|
/// Interaction logic for DebugEffectView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class DebugEffectView : UserControl
|
public partial class DebugEffectView : UserControl
|
||||||
{
|
{
|
||||||
public DebugEffectView()
|
public DebugEffectView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,85 +1,85 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.Debug
|
namespace Artemis.Modules.Effects.Debug
|
||||||
{
|
{
|
||||||
internal class DebugEffectViewModel : EffectViewModel, IHandle<ChangeBitmap>, IHandle<ActiveEffectChanged>
|
internal class DebugEffectViewModel : EffectViewModel, IHandle<ChangeBitmap>, IHandle<ActiveEffectChanged>
|
||||||
{
|
{
|
||||||
private ImageSource _imageSource;
|
private ImageSource _imageSource;
|
||||||
private string _selectedRectangleType;
|
private string _selectedRectangleType;
|
||||||
|
|
||||||
public DebugEffectViewModel(MainManager mainManager)
|
public DebugEffectViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
// Subscribe to main model
|
// Subscribe to main model
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
MainManager.Events.Subscribe(this);
|
MainManager.Events.Subscribe(this);
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
EffectSettings = new DebugEffectSettings();
|
EffectSettings = new DebugEffectSettings();
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings);
|
EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string Name => "Debug Effect";
|
public static string Name => "Debug Effect";
|
||||||
|
|
||||||
public BindableCollection<string> RectangleTypes
|
public BindableCollection<string> RectangleTypes
|
||||||
=> new BindableCollection<string>(Enum.GetNames(typeof (LinearGradientMode)));
|
=> new BindableCollection<string>(Enum.GetNames(typeof (LinearGradientMode)));
|
||||||
|
|
||||||
public string SelectedRectangleType
|
public string SelectedRectangleType
|
||||||
{
|
{
|
||||||
get { return _selectedRectangleType; }
|
get { return _selectedRectangleType; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _selectedRectangleType) return;
|
if (value == _selectedRectangleType) return;
|
||||||
_selectedRectangleType = value;
|
_selectedRectangleType = value;
|
||||||
NotifyOfPropertyChange(() => SelectedRectangleType);
|
NotifyOfPropertyChange(() => SelectedRectangleType);
|
||||||
|
|
||||||
((DebugEffectSettings) EffectSettings).Type =
|
((DebugEffectSettings) EffectSettings).Type =
|
||||||
(LinearGradientMode) Enum.Parse(typeof (LinearGradientMode), value);
|
(LinearGradientMode) Enum.Parse(typeof (LinearGradientMode), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageSource ImageSource
|
public ImageSource ImageSource
|
||||||
{
|
{
|
||||||
get { return _imageSource; }
|
get { return _imageSource; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_imageSource = value;
|
_imageSource = value;
|
||||||
NotifyOfPropertyChange(() => ImageSource);
|
NotifyOfPropertyChange(() => ImageSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(ActiveEffectChanged message)
|
public void Handle(ActiveEffectChanged message)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => EffectEnabled);
|
NotifyOfPropertyChange(() => EffectEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(ChangeBitmap message)
|
public void Handle(ChangeBitmap message)
|
||||||
{
|
{
|
||||||
using (var memory = new MemoryStream())
|
using (var memory = new MemoryStream())
|
||||||
{
|
{
|
||||||
message.Bitmap.Save(memory, ImageFormat.Png);
|
message.Bitmap.Save(memory, ImageFormat.Png);
|
||||||
memory.Position = 0;
|
memory.Position = 0;
|
||||||
|
|
||||||
var bitmapImage = new BitmapImage();
|
var bitmapImage = new BitmapImage();
|
||||||
bitmapImage.BeginInit();
|
bitmapImage.BeginInit();
|
||||||
bitmapImage.StreamSource = memory;
|
bitmapImage.StreamSource = memory;
|
||||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
bitmapImage.EndInit();
|
bitmapImage.EndInit();
|
||||||
|
|
||||||
ImageSource = bitmapImage;
|
ImageSource = bitmapImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,40 +1,40 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeHole
|
namespace Artemis.Modules.Effects.TypeHole
|
||||||
{
|
{
|
||||||
public class TypeHoleModel : EffectModel
|
public class TypeHoleModel : EffectModel
|
||||||
{
|
{
|
||||||
public TypeHoleModel(MainManager mainManager) : base(mainManager)
|
public TypeHoleModel(MainManager mainManager) : base(mainManager)
|
||||||
{
|
{
|
||||||
Name = "TypeHole";
|
Name = "TypeHole";
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
// Disable logic
|
// Disable logic
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
// Enable logic
|
// Enable logic
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeHole
|
namespace Artemis.Modules.Effects.TypeHole
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for TypeHoleView.xaml
|
/// Interaction logic for TypeHoleView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class TypeHoleView : UserControl
|
public partial class TypeHoleView : UserControl
|
||||||
{
|
{
|
||||||
public TypeHoleView()
|
public TypeHoleView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,28 +1,28 @@
|
|||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeHole
|
namespace Artemis.Modules.Effects.TypeHole
|
||||||
{
|
{
|
||||||
public class TypeHoleViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
public class TypeHoleViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||||
{
|
{
|
||||||
public TypeHoleViewModel(MainManager mainManager)
|
public TypeHoleViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
// Subscribe to main model
|
// Subscribe to main model
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
MainManager.Events.Subscribe(this);
|
MainManager.Events.Subscribe(this);
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
EffectModel = new TypeHoleModel(mainManager);
|
EffectModel = new TypeHoleModel(mainManager);
|
||||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Name => "Type Holes (NYI)";
|
public static string Name => "Type Holes (NYI)";
|
||||||
|
|
||||||
public void Handle(ActiveEffectChanged message)
|
public void Handle(ActiveEffectChanged message)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => EffectEnabled);
|
NotifyOfPropertyChange(() => EffectEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,98 +1,98 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.42000
|
// Runtime Version:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Artemis.Settings {
|
namespace Artemis.Settings {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||||
internal sealed partial class TypeWave : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class TypeWave : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static TypeWave defaultInstance = ((TypeWave)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new TypeWave())));
|
private static TypeWave defaultInstance = ((TypeWave)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new TypeWave())));
|
||||||
|
|
||||||
public static TypeWave Default {
|
public static TypeWave Default {
|
||||||
get {
|
get {
|
||||||
return defaultInstance;
|
return defaultInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
public bool IsRandomColors {
|
public bool IsRandomColors {
|
||||||
get {
|
get {
|
||||||
return ((bool)(this["IsRandomColors"]));
|
return ((bool)(this["IsRandomColors"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["IsRandomColors"] = value;
|
this["IsRandomColors"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
|
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
|
||||||
public global::System.Windows.Media.Color WaveColor {
|
public global::System.Windows.Media.Color WaveColor {
|
||||||
get {
|
get {
|
||||||
return ((global::System.Windows.Media.Color)(this["WaveColor"]));
|
return ((global::System.Windows.Media.Color)(this["WaveColor"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["WaveColor"] = value;
|
this["WaveColor"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||||
public bool IsShiftColors {
|
public bool IsShiftColors {
|
||||||
get {
|
get {
|
||||||
return ((bool)(this["IsShiftColors"]));
|
return ((bool)(this["IsShiftColors"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["IsShiftColors"] = value;
|
this["IsShiftColors"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("20")]
|
[global::System.Configuration.DefaultSettingValueAttribute("20")]
|
||||||
public int ShiftColorSpeed {
|
public int ShiftColorSpeed {
|
||||||
get {
|
get {
|
||||||
return ((int)(this["ShiftColorSpeed"]));
|
return ((int)(this["ShiftColorSpeed"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["ShiftColorSpeed"] = value;
|
this["ShiftColorSpeed"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("500")]
|
[global::System.Configuration.DefaultSettingValueAttribute("500")]
|
||||||
public int TimeToLive {
|
public int TimeToLive {
|
||||||
get {
|
get {
|
||||||
return ((int)(this["TimeToLive"]));
|
return ((int)(this["TimeToLive"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["TimeToLive"] = value;
|
this["TimeToLive"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("4")]
|
[global::System.Configuration.DefaultSettingValueAttribute("4")]
|
||||||
public int SpreadSpeed {
|
public int SpreadSpeed {
|
||||||
get {
|
get {
|
||||||
return ((int)(this["SpreadSpeed"]));
|
return ((int)(this["SpreadSpeed"]));
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
this["SpreadSpeed"] = value;
|
this["SpreadSpeed"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,152 +1,152 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.KeyboardProviders.Corsair;
|
using Artemis.KeyboardProviders.Corsair;
|
||||||
using Artemis.KeyboardProviders.Logitech.Utilities;
|
using Artemis.KeyboardProviders.Logitech.Utilities;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeWave
|
namespace Artemis.Modules.Effects.TypeWave
|
||||||
{
|
{
|
||||||
public class TypeWaveModel : EffectModel
|
public class TypeWaveModel : EffectModel
|
||||||
{
|
{
|
||||||
private readonly List<Wave> _waves;
|
private readonly List<Wave> _waves;
|
||||||
private Color _randomColor;
|
private Color _randomColor;
|
||||||
|
|
||||||
public TypeWaveModel(MainManager mainManager, TypeWaveSettings settings) : base(mainManager)
|
public TypeWaveModel(MainManager mainManager, TypeWaveSettings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Name = "TypeWave";
|
Name = "TypeWave";
|
||||||
_waves = new List<Wave>();
|
_waves = new List<Wave>();
|
||||||
_randomColor = Color.Red;
|
_randomColor = Color.Red;
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public TypeWaveSettings Settings { get; set; }
|
public TypeWaveSettings Settings { get; set; }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
MainManager.KeyboardHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback;
|
MainManager.KeyboardHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void KeyboardHookOnKeyDownCallback(KeyEventArgs e)
|
private void KeyboardHookOnKeyDownCallback(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
// More than 25 waves is pointless
|
// More than 25 waves is pointless
|
||||||
if (_waves.Count >= 25)
|
if (_waves.Count >= 25)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode);
|
var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode);
|
||||||
if (keyMatch == null)
|
if (keyMatch == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_waves.Add(Settings.IsRandomColors
|
_waves.Add(Settings.IsRandomColors
|
||||||
? new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0, _randomColor)
|
? new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0, _randomColor)
|
||||||
: new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0,
|
: new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0,
|
||||||
ColorHelpers.ToDrawingColor(Settings.WaveColor)));
|
ColorHelpers.ToDrawingColor(Settings.WaveColor)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
// Listener won't start unless the effect is active
|
// Listener won't start unless the effect is active
|
||||||
MainManager.KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
|
MainManager.KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (Settings.IsRandomColors)
|
if (Settings.IsRandomColors)
|
||||||
_randomColor = ColorHelpers.ShiftColor(_randomColor, 25);
|
_randomColor = ColorHelpers.ShiftColor(_randomColor, 25);
|
||||||
|
|
||||||
for (var i = 0; i < _waves.Count; i++)
|
for (var i = 0; i < _waves.Count; i++)
|
||||||
{
|
{
|
||||||
// TODO: Get from settings
|
// TODO: Get from settings
|
||||||
var fps = 25;
|
var fps = 25;
|
||||||
|
|
||||||
_waves[i].Size += Settings.SpreadSpeed * Scale;
|
_waves[i].Size += Settings.SpreadSpeed * Scale;
|
||||||
|
|
||||||
if (Settings.IsShiftColors)
|
if (Settings.IsShiftColors)
|
||||||
_waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed);
|
_waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed);
|
||||||
|
|
||||||
var decreaseAmount = 255/(Settings.TimeToLive/fps);
|
var decreaseAmount = 255/(Settings.TimeToLive/fps);
|
||||||
_waves[i].Color = Color.FromArgb(
|
_waves[i].Color = Color.FromArgb(
|
||||||
_waves[i].Color.A - decreaseAmount, _waves[i].Color.R,
|
_waves[i].Color.A - decreaseAmount, _waves[i].Color.R,
|
||||||
_waves[i].Color.G,
|
_waves[i].Color.G,
|
||||||
_waves[i].Color.B);
|
_waves[i].Color.B);
|
||||||
|
|
||||||
if (_waves[i].Color.A >= decreaseAmount)
|
if (_waves[i].Color.A >= decreaseAmount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_waves.RemoveAt(i);
|
_waves.RemoveAt(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
if (_waves.Count == 0)
|
if (_waves.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||||
|
|
||||||
// Don't want a for-each, collection is changed in different thread
|
// Don't want a for-each, collection is changed in different thread
|
||||||
// ReSharper disable once ForCanBeConvertedToForeach
|
// ReSharper disable once ForCanBeConvertedToForeach
|
||||||
for (var i = 0; i < _waves.Count; i++)
|
for (var i = 0; i < _waves.Count; i++)
|
||||||
{
|
{
|
||||||
if (_waves[i].Size == 0)
|
if (_waves[i].Size == 0)
|
||||||
continue;
|
continue;
|
||||||
var path = new GraphicsPath();
|
var path = new GraphicsPath();
|
||||||
path.AddEllipse(_waves[i].Point.X - _waves[i].Size/2, _waves[i].Point.Y - _waves[i].Size/2,
|
path.AddEllipse(_waves[i].Point.X - _waves[i].Size/2, _waves[i].Point.Y - _waves[i].Size/2,
|
||||||
_waves[i].Size, _waves[i].Size);
|
_waves[i].Size, _waves[i].Size);
|
||||||
|
|
||||||
Color fillColor;
|
Color fillColor;
|
||||||
if (MainManager.KeyboardManager.ActiveKeyboard is CorsairRGB)
|
if (MainManager.KeyboardManager.ActiveKeyboard is CorsairRGB)
|
||||||
fillColor = Color.Black;
|
fillColor = Color.Black;
|
||||||
else
|
else
|
||||||
fillColor = Color.Transparent;
|
fillColor = Color.Transparent;
|
||||||
|
|
||||||
var pthGrBrush = new PathGradientBrush(path)
|
var pthGrBrush = new PathGradientBrush(path)
|
||||||
{
|
{
|
||||||
SurroundColors = new[] {_waves[i].Color},
|
SurroundColors = new[] {_waves[i].Color},
|
||||||
CenterColor = fillColor
|
CenterColor = fillColor
|
||||||
};
|
};
|
||||||
|
|
||||||
g.FillPath(pthGrBrush, path);
|
g.FillPath(pthGrBrush, path);
|
||||||
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
|
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
|
||||||
|
|
||||||
g.FillPath(pthGrBrush, path);
|
g.FillPath(pthGrBrush, path);
|
||||||
g.DrawEllipse(new Pen(pthGrBrush, 1), _waves[i].Point.X - _waves[i].Size/2,
|
g.DrawEllipse(new Pen(pthGrBrush, 1), _waves[i].Point.X - _waves[i].Size/2,
|
||||||
_waves[i].Point.Y - _waves[i].Size/2, _waves[i].Size, _waves[i].Size);
|
_waves[i].Point.Y - _waves[i].Size/2, _waves[i].Size, _waves[i].Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Wave
|
public class Wave
|
||||||
{
|
{
|
||||||
public Wave(Point point, int size, Color color)
|
public Wave(Point point, int size, Color color)
|
||||||
{
|
{
|
||||||
Point = point;
|
Point = point;
|
||||||
Size = size;
|
Size = size;
|
||||||
Color = color;
|
Color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point Point { get; set; }
|
public Point Point { get; set; }
|
||||||
public int Size { get; set; }
|
public int Size { get; set; }
|
||||||
public Color Color { get; set; }
|
public Color Color { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,52 +1,52 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeWave
|
namespace Artemis.Modules.Effects.TypeWave
|
||||||
{
|
{
|
||||||
public class TypeWaveSettings : EffectSettings
|
public class TypeWaveSettings : EffectSettings
|
||||||
{
|
{
|
||||||
public TypeWaveSettings()
|
public TypeWaveSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsRandomColors { get; set; }
|
public bool IsRandomColors { get; set; }
|
||||||
public Color WaveColor { get; set; }
|
public Color WaveColor { get; set; }
|
||||||
public bool IsShiftColors { get; set; }
|
public bool IsShiftColors { get; set; }
|
||||||
public int ShiftColorSpeed { get; set; }
|
public int ShiftColorSpeed { get; set; }
|
||||||
public int TimeToLive { get; set; }
|
public int TimeToLive { get; set; }
|
||||||
public int SpreadSpeed { get; set; }
|
public int SpreadSpeed { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
IsRandomColors = Settings.TypeWave.Default.IsRandomColors;
|
IsRandomColors = Settings.TypeWave.Default.IsRandomColors;
|
||||||
WaveColor = Settings.TypeWave.Default.WaveColor;
|
WaveColor = Settings.TypeWave.Default.WaveColor;
|
||||||
IsShiftColors = Settings.TypeWave.Default.IsShiftColors;
|
IsShiftColors = Settings.TypeWave.Default.IsShiftColors;
|
||||||
ShiftColorSpeed = Settings.TypeWave.Default.ShiftColorSpeed;
|
ShiftColorSpeed = Settings.TypeWave.Default.ShiftColorSpeed;
|
||||||
TimeToLive = Settings.TypeWave.Default.TimeToLive;
|
TimeToLive = Settings.TypeWave.Default.TimeToLive;
|
||||||
SpreadSpeed = Settings.TypeWave.Default.SpreadSpeed;
|
SpreadSpeed = Settings.TypeWave.Default.SpreadSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
Settings.TypeWave.Default.IsRandomColors = IsRandomColors;
|
Settings.TypeWave.Default.IsRandomColors = IsRandomColors;
|
||||||
Settings.TypeWave.Default.WaveColor = WaveColor;
|
Settings.TypeWave.Default.WaveColor = WaveColor;
|
||||||
Settings.TypeWave.Default.IsShiftColors = IsShiftColors;
|
Settings.TypeWave.Default.IsShiftColors = IsShiftColors;
|
||||||
Settings.TypeWave.Default.ShiftColorSpeed = ShiftColorSpeed;
|
Settings.TypeWave.Default.ShiftColorSpeed = ShiftColorSpeed;
|
||||||
Settings.TypeWave.Default.TimeToLive = TimeToLive;
|
Settings.TypeWave.Default.TimeToLive = TimeToLive;
|
||||||
Settings.TypeWave.Default.SpreadSpeed = SpreadSpeed;
|
Settings.TypeWave.Default.SpreadSpeed = SpreadSpeed;
|
||||||
|
|
||||||
Settings.TypeWave.Default.Save();
|
Settings.TypeWave.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
IsRandomColors = true;
|
IsRandomColors = true;
|
||||||
WaveColor = Color.FromArgb(255, 255, 0, 0);
|
WaveColor = Color.FromArgb(255, 255, 0, 0);
|
||||||
IsShiftColors = true;
|
IsShiftColors = true;
|
||||||
ShiftColorSpeed = 20;
|
ShiftColorSpeed = 20;
|
||||||
TimeToLive = 500;
|
TimeToLive = 500;
|
||||||
SpreadSpeed = 4;
|
SpreadSpeed = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeWave
|
namespace Artemis.Modules.Effects.TypeWave
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for TypeWaveView.xaml
|
/// Interaction logic for TypeWaveView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class TypeWaveView : UserControl
|
public partial class TypeWaveView : UserControl
|
||||||
{
|
{
|
||||||
public TypeWaveView()
|
public TypeWaveView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,31 +1,31 @@
|
|||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeWave
|
namespace Artemis.Modules.Effects.TypeWave
|
||||||
{
|
{
|
||||||
public class TypeWaveViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
public class TypeWaveViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||||
{
|
{
|
||||||
public TypeWaveViewModel(MainManager mainManager)
|
public TypeWaveViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
// Subscribe to main model
|
// Subscribe to main model
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
MainManager.Events.Subscribe(this);
|
MainManager.Events.Subscribe(this);
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
EffectSettings = new TypeWaveSettings();
|
EffectSettings = new TypeWaveSettings();
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings);
|
EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Name => "Type Waves";
|
public static string Name => "Type Waves";
|
||||||
|
|
||||||
public void Handle(ActiveEffectChanged message)
|
public void Handle(ActiveEffectChanged message)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => EffectEnabled);
|
NotifyOfPropertyChange(() => EffectEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
|
{
|
||||||
|
public class CounterStrikeDataModel : IGameDataModel
|
||||||
|
{
|
||||||
|
public Provider provider { get; set; }
|
||||||
|
public Map map { get; set; }
|
||||||
|
public Round round { get; set; }
|
||||||
|
public Player player { get; set; }
|
||||||
|
public Previously previously { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Provider
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public int appid { get; set; }
|
||||||
|
public int version { get; set; }
|
||||||
|
public string steamid { get; set; }
|
||||||
|
public int timestamp { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TeamCt
|
||||||
|
{
|
||||||
|
public int score { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TeamT
|
||||||
|
{
|
||||||
|
public int score { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Map
|
||||||
|
{
|
||||||
|
public string mode { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string phase { get; set; }
|
||||||
|
public int round { get; set; }
|
||||||
|
public TeamCt team_ct { get; set; }
|
||||||
|
public TeamT team_t { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Round
|
||||||
|
{
|
||||||
|
public string phase { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class State
|
||||||
|
{
|
||||||
|
public int health { get; set; }
|
||||||
|
public int armor { get; set; }
|
||||||
|
public bool helmet { get; set; }
|
||||||
|
public int flashed { get; set; }
|
||||||
|
public int smoked { get; set; }
|
||||||
|
public int burning { get; set; }
|
||||||
|
public int money { get; set; }
|
||||||
|
public int round_kills { get; set; }
|
||||||
|
public int round_killhs { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Weapon0
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public string paintkit { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
public string state { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Weapon1
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public string paintkit { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
public int ammo_clip { get; set; }
|
||||||
|
public int ammo_clip_max { get; set; }
|
||||||
|
public int ammo_reserve { get; set; }
|
||||||
|
public string state { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Weapon2
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public string paintkit { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
public string state { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Weapons
|
||||||
|
{
|
||||||
|
public Weapon0 weapon_0 { get; set; }
|
||||||
|
public Weapon1 weapon_1 { get; set; }
|
||||||
|
public Weapon2 weapon_2 { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MatchStats
|
||||||
|
{
|
||||||
|
public int kills { get; set; }
|
||||||
|
public int assists { get; set; }
|
||||||
|
public int deaths { get; set; }
|
||||||
|
public int mvps { get; set; }
|
||||||
|
public int score { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Player
|
||||||
|
{
|
||||||
|
public string steamid { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string team { get; set; }
|
||||||
|
public string activity { get; set; }
|
||||||
|
public State state { get; set; }
|
||||||
|
public Weapons weapons { get; set; }
|
||||||
|
public MatchStats match_stats { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Round2
|
||||||
|
{
|
||||||
|
public string phase { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Previously
|
||||||
|
{
|
||||||
|
public Round2 round { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,209 +1,72 @@
|
|||||||
using System;
|
using System.Diagnostics;
|
||||||
using System.Collections.Generic;
|
using System.Drawing;
|
||||||
using System.Drawing;
|
using Artemis.Managers;
|
||||||
using System.Drawing.Drawing2D;
|
using Artemis.Models;
|
||||||
using System.Linq;
|
using Artemis.Utilities.GameState;
|
||||||
using Artemis.KeyboardProviders;
|
using Newtonsoft.Json;
|
||||||
using Artemis.Managers;
|
|
||||||
using Artemis.Models;
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
using Artemis.Utilities;
|
{
|
||||||
using Artemis.Utilities.GameState;
|
public class CounterStrikeModel : GameModel
|
||||||
using Artemis.Utilities.Keyboard;
|
{
|
||||||
using Newtonsoft.Json;
|
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings) : base(mainManager)
|
||||||
using Newtonsoft.Json.Linq;
|
{
|
||||||
|
Settings = settings;
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
Name = "CounterStrike";
|
||||||
{
|
ProcessName = "csgo";
|
||||||
public class CounterStrikeModel : GameModel
|
Scale = 4;
|
||||||
{
|
Enabled = Settings.Enabled;
|
||||||
private KeyboardRegion _topRow;
|
Initialized = false;
|
||||||
|
}
|
||||||
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings) : base(mainManager)
|
|
||||||
{
|
public CounterStrikeSettings Settings { get; set; }
|
||||||
Settings = settings;
|
|
||||||
Name = "CounterStrike";
|
public int Scale { get; set; }
|
||||||
ProcessName = "csgo";
|
|
||||||
Scale = 4;
|
public override void Dispose()
|
||||||
Enabled = Settings.Enabled;
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
}
|
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
|
||||||
|
}
|
||||||
public CounterStrikeSettings Settings { get; set; }
|
|
||||||
|
public override void Enable()
|
||||||
public KeyboardRectangle EventRect { get; set; }
|
{
|
||||||
public KeyboardRectangle TeamRect { get; set; }
|
Initialized = false;
|
||||||
public KeyboardRectangle AmmoRect { get; set; }
|
|
||||||
public JObject CsJson { get; set; }
|
GameDataModel = new CounterStrikeDataModel();
|
||||||
|
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
||||||
public bool DrawingSmoke { get; set; }
|
|
||||||
public bool DrawingFlash { get; set; }
|
Initialized = true;
|
||||||
|
}
|
||||||
public int Scale { get; set; }
|
|
||||||
|
public override void Update()
|
||||||
public override void Dispose()
|
{
|
||||||
{
|
if (Profile == null || GameDataModel == null)
|
||||||
Initialized = false;
|
return;
|
||||||
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
|
|
||||||
}
|
foreach (var layerModel in Profile.Layers)
|
||||||
|
layerModel.Update<CounterStrikeDataModel>(GameDataModel);
|
||||||
public override void Enable()
|
}
|
||||||
{
|
|
||||||
Initialized = false;
|
public override Bitmap GenerateBitmap()
|
||||||
|
{
|
||||||
// Some keyboards have a different baseline, Corsair F-keys start at row 1
|
if (Profile == null || GameDataModel == null)
|
||||||
_topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
|
return null;
|
||||||
AmmoRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X,
|
|
||||||
new List<Color>(),
|
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
LinearGradientMode.Horizontal) {Height = Scale, ContainedBrush = false};
|
return Profile.GenerateBitmap<CounterStrikeDataModel>(keyboardRect, GameDataModel);
|
||||||
TeamRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X + 1,
|
}
|
||||||
new List<Color>(),
|
|
||||||
LinearGradientMode.Horizontal)
|
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
||||||
{
|
{
|
||||||
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
var jsonString = e.Json.ToString();
|
||||||
};
|
|
||||||
EventRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X + 1,
|
// Ensure it's CS:GO JSON
|
||||||
new List<Color>(),
|
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
||||||
LinearGradientMode.Horizontal)
|
return;
|
||||||
{
|
|
||||||
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
|
// Parse the JSON
|
||||||
};
|
GameDataModel = JsonConvert.DeserializeObject<CounterStrikeDataModel>(jsonString);
|
||||||
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
|
}
|
||||||
|
}
|
||||||
Initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Update()
|
|
||||||
{
|
|
||||||
if (CsJson == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Settings.AmmoEnabled)
|
|
||||||
UpdateAmmo();
|
|
||||||
if (Settings.TeamColorEnabled)
|
|
||||||
UpdateTeam();
|
|
||||||
if (Settings.LowHpEnabled)
|
|
||||||
UpdateHealth();
|
|
||||||
if (Settings.FlashEnabled)
|
|
||||||
UpdateFlash();
|
|
||||||
if (Settings.SmokeEnabled)
|
|
||||||
UpdateSmoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateHealth()
|
|
||||||
{
|
|
||||||
if (CsJson["player"]?["state"]?["health"] == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var health = CsJson["player"]["state"]["health"].Value<int>();
|
|
||||||
if (health > 25 || health < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TeamRect.Colors = new List<Color> {Color.Red, Color.OrangeRed, Color.Red, Color.OrangeRed};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateSmoke()
|
|
||||||
{
|
|
||||||
if (CsJson["player"]?["state"]?["smoked"] == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var smoked = CsJson["player"]["state"]["smoked"].Value<int>();
|
|
||||||
if (smoked == 0 && !DrawingSmoke)
|
|
||||||
return;
|
|
||||||
|
|
||||||
EventRect.Colors = new List<Color> {Color.FromArgb(smoked, 255, 255, 255)};
|
|
||||||
DrawingSmoke = smoked != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateFlash()
|
|
||||||
{
|
|
||||||
if (CsJson["player"]?["state"]?["flashed"] == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var flashed = CsJson["player"]["state"]["flashed"].Value<int>();
|
|
||||||
if (flashed == 0 && !DrawingFlash)
|
|
||||||
return;
|
|
||||||
|
|
||||||
EventRect.Colors = new List<Color> {Color.FromArgb(flashed, 255, 255, 255)};
|
|
||||||
DrawingFlash = flashed != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateTeam()
|
|
||||||
{
|
|
||||||
var currentTeam = CsJson["player"]?["team"];
|
|
||||||
if (currentTeam == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var t1 = Color.FromArgb(255, 255, 129, 0);
|
|
||||||
var t2 = Color.FromArgb(255, 255, 170, 125);
|
|
||||||
|
|
||||||
var ct1 = Color.FromArgb(255, 203, 238, 255);
|
|
||||||
var ct2 = Color.FromArgb(255, 0, 173, 255);
|
|
||||||
|
|
||||||
TeamRect.Colors = currentTeam.Value<string>() == "T"
|
|
||||||
? new List<Color> {t1, t2, t1, t2}
|
|
||||||
: new List<Color> {ct1, ct2, ct1, ct2};
|
|
||||||
TeamRect.Rotate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateAmmo()
|
|
||||||
{
|
|
||||||
if (CsJson["player"]["weapons"] == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var activeWeapon =
|
|
||||||
CsJson["player"]["weapons"].Children()
|
|
||||||
.Select(c => c.First)
|
|
||||||
.FirstOrDefault(w => w["state"]?.Value<string>() == "active");
|
|
||||||
|
|
||||||
// Update the ammo display
|
|
||||||
if (activeWeapon?["ammo_clip_max"] == null || activeWeapon["ammo_clip"] == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var maxAmmo = activeWeapon["ammo_clip_max"].Value<int>();
|
|
||||||
var ammo = activeWeapon["ammo_clip"].Value<int>();
|
|
||||||
|
|
||||||
if (maxAmmo < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
|
|
||||||
AmmoRect.Width = (int) Math.Floor(_topRow.BottomRight.Y/100.00*ammoPercentage)*Scale;
|
|
||||||
AmmoRect.Colors = new List<Color>
|
|
||||||
{
|
|
||||||
ColorHelpers.ToDrawingColor(Settings.AmmoMainColor),
|
|
||||||
ColorHelpers.ToDrawingColor(Settings.AmmoSecondaryColor)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Low ammo indicator
|
|
||||||
if (ammoPercentage < 37)
|
|
||||||
AmmoRect.StartBlink(1000);
|
|
||||||
else
|
|
||||||
AmmoRect.StopBlink();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
|
||||||
{
|
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
|
||||||
{
|
|
||||||
g.Clear(Color.Transparent);
|
|
||||||
AmmoRect.Draw(g);
|
|
||||||
TeamRect.Draw(g);
|
|
||||||
EventRect.Draw(g);
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
|
||||||
{
|
|
||||||
var jsonString = e.Json.ToString();
|
|
||||||
|
|
||||||
// Ensure it's CS:GO JSON
|
|
||||||
if (!jsonString.Contains("Counter-Strike: Global Offensive"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Parse the JSON
|
|
||||||
CsJson = JsonConvert.DeserializeObject<JObject>(jsonString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,71 +1,71 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
{
|
{
|
||||||
public class CounterStrikeSettings : GameSettings
|
public class CounterStrikeSettings : GameSettings
|
||||||
{
|
{
|
||||||
public CounterStrikeSettings()
|
public CounterStrikeSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GameDirectory { get; set; }
|
public string GameDirectory { get; set; }
|
||||||
|
|
||||||
public bool AmmoEnabled { get; set; }
|
public bool AmmoEnabled { get; set; }
|
||||||
public Color AmmoMainColor { get; set; }
|
public Color AmmoMainColor { get; set; }
|
||||||
public Color AmmoSecondaryColor { get; set; }
|
public Color AmmoSecondaryColor { get; set; }
|
||||||
|
|
||||||
public bool TeamColorEnabled { get; set; }
|
public bool TeamColorEnabled { get; set; }
|
||||||
public bool FlashEnabled { get; set; }
|
public bool FlashEnabled { get; set; }
|
||||||
public bool SmokeEnabled { get; set; }
|
public bool SmokeEnabled { get; set; }
|
||||||
public bool LowHpEnabled { get; set; }
|
public bool LowHpEnabled { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
Enabled = CounterStrike.Default.Enabled;
|
Enabled = CounterStrike.Default.Enabled;
|
||||||
GameDirectory = CounterStrike.Default.GameDirectory;
|
GameDirectory = CounterStrike.Default.GameDirectory;
|
||||||
|
|
||||||
AmmoEnabled = CounterStrike.Default.AmmoEnabled;
|
AmmoEnabled = CounterStrike.Default.AmmoEnabled;
|
||||||
AmmoMainColor = CounterStrike.Default.AmmoMainColor;
|
AmmoMainColor = CounterStrike.Default.AmmoMainColor;
|
||||||
AmmoSecondaryColor = CounterStrike.Default.AmmoSecondaryColor;
|
AmmoSecondaryColor = CounterStrike.Default.AmmoSecondaryColor;
|
||||||
|
|
||||||
TeamColorEnabled = CounterStrike.Default.TeamColorEnabled;
|
TeamColorEnabled = CounterStrike.Default.TeamColorEnabled;
|
||||||
FlashEnabled = CounterStrike.Default.FlashEnabled;
|
FlashEnabled = CounterStrike.Default.FlashEnabled;
|
||||||
SmokeEnabled = CounterStrike.Default.SmokeEnabled;
|
SmokeEnabled = CounterStrike.Default.SmokeEnabled;
|
||||||
LowHpEnabled = CounterStrike.Default.LowHpEnabled;
|
LowHpEnabled = CounterStrike.Default.LowHpEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
CounterStrike.Default.Enabled = Enabled;
|
CounterStrike.Default.Enabled = Enabled;
|
||||||
CounterStrike.Default.GameDirectory = GameDirectory;
|
CounterStrike.Default.GameDirectory = GameDirectory;
|
||||||
|
|
||||||
CounterStrike.Default.AmmoEnabled = AmmoEnabled;
|
CounterStrike.Default.AmmoEnabled = AmmoEnabled;
|
||||||
CounterStrike.Default.AmmoMainColor = AmmoMainColor;
|
CounterStrike.Default.AmmoMainColor = AmmoMainColor;
|
||||||
CounterStrike.Default.AmmoSecondaryColor = AmmoSecondaryColor;
|
CounterStrike.Default.AmmoSecondaryColor = AmmoSecondaryColor;
|
||||||
|
|
||||||
CounterStrike.Default.TeamColorEnabled = TeamColorEnabled;
|
CounterStrike.Default.TeamColorEnabled = TeamColorEnabled;
|
||||||
CounterStrike.Default.FlashEnabled = FlashEnabled;
|
CounterStrike.Default.FlashEnabled = FlashEnabled;
|
||||||
CounterStrike.Default.SmokeEnabled = SmokeEnabled;
|
CounterStrike.Default.SmokeEnabled = SmokeEnabled;
|
||||||
CounterStrike.Default.LowHpEnabled = LowHpEnabled;
|
CounterStrike.Default.LowHpEnabled = LowHpEnabled;
|
||||||
|
|
||||||
CounterStrike.Default.Save();
|
CounterStrike.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
GameDirectory = string.Empty;
|
GameDirectory = string.Empty;
|
||||||
|
|
||||||
AmmoEnabled = true;
|
AmmoEnabled = true;
|
||||||
AmmoMainColor = Color.FromArgb(255, 38, 246, 0);
|
AmmoMainColor = Color.FromArgb(255, 38, 246, 0);
|
||||||
AmmoSecondaryColor = Color.FromArgb(255, 255, 41, 0);
|
AmmoSecondaryColor = Color.FromArgb(255, 255, 41, 0);
|
||||||
|
|
||||||
TeamColorEnabled = true;
|
TeamColorEnabled = true;
|
||||||
FlashEnabled = true;
|
FlashEnabled = true;
|
||||||
SmokeEnabled = true;
|
SmokeEnabled = true;
|
||||||
LowHpEnabled = true;
|
LowHpEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,11 +19,6 @@
|
|||||||
<RowDefinition Height="80" />
|
<RowDefinition Height="80" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
@ -58,73 +53,11 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Ammo display -->
|
<!-- Profile editor -->
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" Width="130" VerticalAlignment="Center"
|
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||||
Height="16" Margin="0,10,0,9">
|
|
||||||
Display ammo on F-keys
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.AmmoEnabled, Mode=TwoWay}"
|
|
||||||
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Ammo main color -->
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" Width="94" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Main ammo color
|
|
||||||
</TextBlock>
|
|
||||||
<xctk:ColorPicker x:Name="MainColor"
|
|
||||||
SelectedColor="{Binding Path=GameSettings.AmmoMainColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="3" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
|
||||||
|
|
||||||
<!-- Ammo secondary color -->
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" Width="122" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Secondary ammo color
|
|
||||||
</TextBlock>
|
|
||||||
<xctk:ColorPicker x:Name="SecondaryColor"
|
|
||||||
SelectedColor="{Binding Path=GameSettings.AmmoSecondaryColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="4" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
|
||||||
|
|
||||||
<!-- Smoke effect -->
|
|
||||||
<TextBlock Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" Width="116" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,9,0,10">
|
|
||||||
Display smoked effect
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.SmokeEnabled, Mode=TwoWay}"
|
|
||||||
Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Flash effect -->
|
|
||||||
<TextBlock Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Width="113" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,10,0,9">
|
|
||||||
Display flashed effect
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.FlashEnabled, Mode=TwoWay}"
|
|
||||||
Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Team color -->
|
|
||||||
<TextBlock Grid.Row="7" Grid.Column="0" HorizontalAlignment="Left" Width="181" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,9,0,10">
|
|
||||||
Color keyboard according to team
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.TeamColorEnabled, Mode=TwoWay}"
|
|
||||||
Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Team color -->
|
|
||||||
<TextBlock Grid.Row="8" Grid.Column="0" HorizontalAlignment="Left" Width="160" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,10,0,9">
|
|
||||||
Color keyboard red on low HP
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.LowHpEnabled, Mode=TwoWay}"
|
|
||||||
Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||||
Style="{DynamicResource SquareButtonStyle}" />
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for CounterStrikeView.xaml
|
/// Interaction logic for CounterStrikeView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class CounterStrikeView : UserControl
|
public partial class CounterStrikeView : UserControl
|
||||||
{
|
{
|
||||||
public CounterStrikeView()
|
public CounterStrikeView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,64 +1,78 @@
|
|||||||
using System.IO;
|
using System.ComponentModel;
|
||||||
using System.Windows.Forms;
|
using System.IO;
|
||||||
using Artemis.Managers;
|
using System.Windows.Forms;
|
||||||
using Artemis.Properties;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.Properties;
|
||||||
|
using Artemis.ViewModels;
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
using Artemis.ViewModels.Abstract;
|
||||||
{
|
|
||||||
public class CounterStrikeViewModel : GameViewModel
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
{
|
{
|
||||||
public CounterStrikeViewModel(MainManager mainManager)
|
public class CounterStrikeViewModel : GameViewModel
|
||||||
{
|
{
|
||||||
MainManager = mainManager;
|
public CounterStrikeViewModel(MainManager mainManager)
|
||||||
|
{
|
||||||
// Settings are loaded from file by class
|
MainManager = mainManager;
|
||||||
GameSettings = new CounterStrikeSettings();
|
|
||||||
|
// Settings are loaded from file by class
|
||||||
// Create effect model and add it to MainManager
|
GameSettings = new CounterStrikeSettings();
|
||||||
GameModel = new CounterStrikeModel(mainManager, (CounterStrikeSettings) GameSettings);
|
|
||||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
// Create effect model and add it to MainManager
|
||||||
PlaceConfigFile();
|
GameModel = new CounterStrikeModel(mainManager, (CounterStrikeSettings) GameSettings);
|
||||||
}
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
|
PlaceConfigFile();
|
||||||
public static string Name => "CS:GO";
|
|
||||||
public string Content => "Counter-Strike: GO Content";
|
ProfileEditor = new ProfileEditorViewModel<CounterStrikeDataModel>(MainManager, GameModel);
|
||||||
|
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||||
public void BrowseDirectory()
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
{
|
}
|
||||||
var dialog = new FolderBrowserDialog {SelectedPath = ((CounterStrikeSettings) GameSettings).GameDirectory};
|
|
||||||
var result = dialog.ShowDialog();
|
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||||
if (result != DialogResult.OK)
|
{
|
||||||
return;
|
if (e.PropertyName == "SelectedProfile")
|
||||||
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
((CounterStrikeSettings) GameSettings).GameDirectory = dialog.SelectedPath;
|
}
|
||||||
NotifyOfPropertyChange(() => GameSettings);
|
|
||||||
|
public ProfileEditorViewModel<CounterStrikeDataModel> ProfileEditor { get; set; }
|
||||||
GameSettings.Save();
|
|
||||||
PlaceConfigFile();
|
public static string Name => "CS:GO";
|
||||||
}
|
public string Content => "Counter-Strike: GO Content";
|
||||||
|
|
||||||
public void PlaceConfigFile()
|
public void BrowseDirectory()
|
||||||
{
|
{
|
||||||
if (((CounterStrikeSettings) GameSettings).GameDirectory == string.Empty)
|
var dialog = new FolderBrowserDialog {SelectedPath = ((CounterStrikeSettings) GameSettings).GameDirectory};
|
||||||
return;
|
var result = dialog.ShowDialog();
|
||||||
if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
|
if (result != DialogResult.OK)
|
||||||
{
|
return;
|
||||||
var cfgFile = Resources.csgoGamestateConfiguration.Replace("{{port}}",
|
|
||||||
MainManager.GameStateWebServer.Port.ToString());
|
((CounterStrikeSettings) GameSettings).GameDirectory = dialog.SelectedPath;
|
||||||
File.WriteAllText(
|
NotifyOfPropertyChange(() => GameSettings);
|
||||||
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
|
||||||
cfgFile);
|
GameSettings.Save();
|
||||||
|
PlaceConfigFile();
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
public void PlaceConfigFile()
|
||||||
MainManager.DialogService.ShowErrorMessageBox("Please select a valid CS:GO directory\n\n" +
|
{
|
||||||
@"By default CS:GO is in \SteamApps\common\Counter-Strike Global Offensive");
|
if (((CounterStrikeSettings) GameSettings).GameDirectory == string.Empty)
|
||||||
((CounterStrikeSettings) GameSettings).GameDirectory = string.Empty;
|
return;
|
||||||
NotifyOfPropertyChange(() => GameSettings);
|
if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
|
||||||
|
{
|
||||||
GameSettings.Save();
|
var cfgFile = Resources.csgoGamestateConfiguration.Replace("{{port}}",
|
||||||
}
|
MainManager.GameStateWebServer.Port.ToString());
|
||||||
}
|
File.WriteAllText(
|
||||||
|
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
||||||
|
cfgFile);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainManager.DialogService.ShowErrorMessageBox("Please select a valid CS:GO directory\n\n" +
|
||||||
|
@"By default CS:GO is in \SteamApps\common\Counter-Strike Global Offensive");
|
||||||
|
((CounterStrikeSettings) GameSettings).GameDirectory = string.Empty;
|
||||||
|
NotifyOfPropertyChange(() => GameSettings);
|
||||||
|
|
||||||
|
GameSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Dota2
|
namespace Artemis.Modules.Games.Dota2
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for Dota2View.xaml
|
/// Interaction logic for Dota2View.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Dota2View : UserControl
|
public partial class Dota2View : UserControl
|
||||||
{
|
{
|
||||||
public Dota2View()
|
public Dota2View()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.Modules.Games.RocketLeague
|
||||||
|
{
|
||||||
|
public class RocketLeagueDataModel : IGameDataModel
|
||||||
|
{
|
||||||
|
public int Boost { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,15 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
|
||||||
using Artemis.Utilities.Memory;
|
using Artemis.Utilities.Memory;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
@ -17,13 +12,8 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
{
|
{
|
||||||
public class RocketLeagueModel : GameModel
|
public class RocketLeagueModel : GameModel
|
||||||
{
|
{
|
||||||
private int _boostAmount;
|
|
||||||
private bool _boostGrowing;
|
|
||||||
private KeyboardRectangle _boostRect;
|
|
||||||
private bool _contextualColor;
|
|
||||||
private Memory _memory;
|
private Memory _memory;
|
||||||
private GamePointersCollection _pointer;
|
private GamePointersCollection _pointer;
|
||||||
private int _previousBoost;
|
|
||||||
|
|
||||||
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager)
|
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
@ -49,105 +39,44 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
_contextualColor = Settings.ContextualColor;
|
|
||||||
|
|
||||||
_boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
|
||||||
{
|
|
||||||
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
|
||||||
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
|
||||||
}, LinearGradientMode.Horizontal);
|
|
||||||
|
|
||||||
Updater.GetPointers();
|
Updater.GetPointers();
|
||||||
_pointer = JsonConvert.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague);
|
_pointer = JsonConvert.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague);
|
||||||
|
|
||||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||||
_memory = new Memory(tempProcess);
|
_memory = new Memory(tempProcess);
|
||||||
|
GameDataModel = new RocketLeagueDataModel();
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (_boostGrowing)
|
if (Profile == null || GameDataModel == null || _memory == null)
|
||||||
return;
|
|
||||||
if (_memory == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
||||||
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
||||||
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
|
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
|
||||||
|
|
||||||
_previousBoost = _boostAmount;
|
((RocketLeagueDataModel) GameDataModel).Boost = (int) Math.Ceiling(boostFloat);
|
||||||
_boostAmount = (int) Math.Ceiling(boostFloat);
|
|
||||||
|
|
||||||
// Take care of any reading errors resulting in an OutOfMemory on draw
|
// Take care of any reading errors resulting in an OutOfMemory on draw
|
||||||
if (_boostAmount < 0)
|
if (((RocketLeagueDataModel) GameDataModel).Boost < 0)
|
||||||
_boostAmount = 0;
|
((RocketLeagueDataModel) GameDataModel).Boost = 0;
|
||||||
if (_boostAmount > 100)
|
if (((RocketLeagueDataModel) GameDataModel).Boost > 100)
|
||||||
_boostAmount = 100;
|
((RocketLeagueDataModel) GameDataModel).Boost = 100;
|
||||||
|
|
||||||
_boostRect.Width =
|
foreach (var layerModel in Profile.Layers)
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
layerModel.Update<RocketLeagueDataModel>(GameDataModel);
|
||||||
|
|
||||||
if (_contextualColor)
|
|
||||||
{
|
|
||||||
if (_boostAmount < 33)
|
|
||||||
_boostRect.Colors = new List<Color> {Color.Red};
|
|
||||||
else if (_boostAmount >= 33 && _boostAmount < 66)
|
|
||||||
_boostRect.Colors = new List<Color> {Color.Yellow};
|
|
||||||
else if (_boostAmount >= 66)
|
|
||||||
_boostRect.Colors = new List<Color> {Color.Lime};
|
|
||||||
}
|
|
||||||
|
|
||||||
Task.Run(() => GrowIfHigher());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GrowIfHigher()
|
|
||||||
{
|
|
||||||
if (_boostAmount <= _previousBoost || _boostGrowing)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_boostGrowing = true;
|
|
||||||
const int amountOfSteps = 6;
|
|
||||||
|
|
||||||
var difference = _boostAmount - _previousBoost;
|
|
||||||
var differenceStep = difference/amountOfSteps;
|
|
||||||
var differenceStepRest = difference%amountOfSteps;
|
|
||||||
_boostAmount = _previousBoost;
|
|
||||||
_boostRect.Width =
|
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
|
||||||
|
|
||||||
for (var i = 0; i < amountOfSteps; i++)
|
|
||||||
{
|
|
||||||
if (differenceStepRest > 0)
|
|
||||||
{
|
|
||||||
differenceStepRest -= 1;
|
|
||||||
_boostAmount += 1;
|
|
||||||
_boostRect.Width =
|
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
|
||||||
}
|
|
||||||
_boostAmount += differenceStep;
|
|
||||||
_boostRect.Width =
|
|
||||||
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
|
|
||||||
|
|
||||||
Thread.Sleep(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
_boostGrowing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
if (Profile == null || GameDataModel == null)
|
||||||
if (_boostRect == null)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
{
|
return Profile.GenerateBitmap<RocketLeagueDataModel>(keyboardRect, GameDataModel);
|
||||||
g.Clear(Color.Transparent);
|
|
||||||
_boostRect.Draw(g);
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,43 +1,43 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.RocketLeague
|
namespace Artemis.Modules.Games.RocketLeague
|
||||||
{
|
{
|
||||||
public class RocketLeagueSettings : GameSettings
|
public class RocketLeagueSettings : GameSettings
|
||||||
{
|
{
|
||||||
public RocketLeagueSettings()
|
public RocketLeagueSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color MainColor { get; set; }
|
public Color MainColor { get; set; }
|
||||||
public Color SecondaryColor { get; set; }
|
public Color SecondaryColor { get; set; }
|
||||||
public bool ContextualColor { get; set; }
|
public bool ContextualColor { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
Enabled = RocketLeague.Default.Enabled;
|
Enabled = RocketLeague.Default.Enabled;
|
||||||
MainColor = RocketLeague.Default.MainColor;
|
MainColor = RocketLeague.Default.MainColor;
|
||||||
SecondaryColor = RocketLeague.Default.SecondaryColor;
|
SecondaryColor = RocketLeague.Default.SecondaryColor;
|
||||||
ContextualColor = RocketLeague.Default.ContextualColor;
|
ContextualColor = RocketLeague.Default.ContextualColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
RocketLeague.Default.Enabled = Enabled;
|
RocketLeague.Default.Enabled = Enabled;
|
||||||
RocketLeague.Default.MainColor = MainColor;
|
RocketLeague.Default.MainColor = MainColor;
|
||||||
RocketLeague.Default.SecondaryColor = SecondaryColor;
|
RocketLeague.Default.SecondaryColor = SecondaryColor;
|
||||||
RocketLeague.Default.ContextualColor = ContextualColor;
|
RocketLeague.Default.ContextualColor = ContextualColor;
|
||||||
|
|
||||||
RocketLeague.Default.Save();
|
RocketLeague.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
MainColor = Color.FromArgb(255, 255, 80, 0);
|
MainColor = Color.FromArgb(255, 255, 80, 0);
|
||||||
SecondaryColor = Color.FromArgb(255, 255, 0, 0);
|
SecondaryColor = Color.FromArgb(255, 255, 0, 0);
|
||||||
ContextualColor = false;
|
ContextualColor = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,46 +40,8 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Main color -->
|
<!-- Profile editor -->
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Main boost display color
|
|
||||||
</TextBlock>
|
|
||||||
<xctk:ColorPicker x:Name="MainColor"
|
|
||||||
SelectedColor="{Binding Path=GameSettings.MainColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
|
||||||
|
|
||||||
<!-- Secondary color -->
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Secondary boost display color
|
|
||||||
</TextBlock>
|
|
||||||
<xctk:ColorPicker x:Name="SecondaryColor"
|
|
||||||
SelectedColor="{Binding Path=GameSettings.SecondaryColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
|
|
||||||
|
|
||||||
<!-- Secondary color -->
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
|
||||||
Height="16" Margin="0,8">
|
|
||||||
Color bar according to boost amount
|
|
||||||
</TextBlock>
|
|
||||||
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ContextualColor, Mode=TwoWay}"
|
|
||||||
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
|
|
||||||
Margin="0,0,-5,0" Width="114" />
|
|
||||||
|
|
||||||
<!-- Info text -->
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
|
|
||||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
|
||||||
MaxWidth="510" TextAlignment="Justify">
|
|
||||||
Tip: To find a color combination you like, start an exhibition match, pickup 100 boost and play around with the colors.
|
|
||||||
They'll appear on your keyboard immediately! Once you're satisfied don't forget to click save changes.
|
|
||||||
</TextBlock>
|
|
||||||
<TextBlock x:Name="VersionText" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
|
||||||
Margin="0,8"
|
|
||||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
|
||||||
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify" />
|
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.RocketLeague
|
namespace Artemis.Modules.Games.RocketLeague
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for RocketLeagueView.xaml
|
/// Interaction logic for RocketLeagueView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class RocketLeagueView : UserControl
|
public partial class RocketLeagueView : UserControl
|
||||||
{
|
{
|
||||||
public RocketLeagueView()
|
public RocketLeagueView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,60 +1,73 @@
|
|||||||
using Artemis.Managers;
|
using System.ComponentModel;
|
||||||
using Artemis.Settings;
|
using Artemis.Managers;
|
||||||
using Artemis.Utilities;
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities.Memory;
|
using Artemis.Utilities;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.Utilities.Memory;
|
||||||
using Newtonsoft.Json;
|
using Artemis.ViewModels;
|
||||||
|
using Artemis.ViewModels.Abstract;
|
||||||
namespace Artemis.Modules.Games.RocketLeague
|
using Newtonsoft.Json;
|
||||||
{
|
|
||||||
public class RocketLeagueViewModel : GameViewModel
|
namespace Artemis.Modules.Games.RocketLeague
|
||||||
{
|
{
|
||||||
private string _versionText;
|
public class RocketLeagueViewModel : GameViewModel
|
||||||
|
{
|
||||||
public RocketLeagueViewModel(MainManager mainManager)
|
private string _versionText;
|
||||||
{
|
|
||||||
MainManager = mainManager;
|
public RocketLeagueViewModel(MainManager mainManager)
|
||||||
|
{
|
||||||
// Settings are loaded from file by class
|
MainManager = mainManager;
|
||||||
GameSettings = new RocketLeagueSettings();
|
|
||||||
|
// Settings are loaded from file by class
|
||||||
// Create effect model and add it to MainManager
|
GameSettings = new RocketLeagueSettings();
|
||||||
GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
|
|
||||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
// Create effect model and add it to MainManager
|
||||||
|
GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
|
||||||
SetVersionText();
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
}
|
SetVersionText();
|
||||||
|
|
||||||
public static string Name => "Rocket League";
|
ProfileEditor = new ProfileEditorViewModel<RocketLeagueDataModel>(MainManager, GameModel);
|
||||||
|
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||||
public string VersionText
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
{
|
}
|
||||||
get { return _versionText; }
|
|
||||||
set
|
public ProfileEditorViewModel<RocketLeagueDataModel> ProfileEditor { get; set; }
|
||||||
{
|
|
||||||
if (value == _versionText) return;
|
public static string Name => "Rocket League";
|
||||||
_versionText = value;
|
|
||||||
NotifyOfPropertyChange(() => VersionText);
|
public string VersionText
|
||||||
}
|
{
|
||||||
}
|
get { return _versionText; }
|
||||||
|
set
|
||||||
public RocketLeagueModel RocketLeagueModel { get; set; }
|
{
|
||||||
|
if (value == _versionText) return;
|
||||||
private void SetVersionText()
|
_versionText = value;
|
||||||
{
|
NotifyOfPropertyChange(() => VersionText);
|
||||||
if (!General.Default.EnablePointersUpdate)
|
}
|
||||||
{
|
}
|
||||||
VersionText = "Note: You disabled pointer updates, this could result in the " +
|
|
||||||
"Rocket League effect not working after a game update.";
|
public RocketLeagueModel RocketLeagueModel { get; set; }
|
||||||
return;
|
|
||||||
}
|
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
Updater.GetPointers();
|
if (e.PropertyName == "SelectedProfile")
|
||||||
var version = JsonConvert
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague)
|
}
|
||||||
.GameVersion;
|
|
||||||
VersionText = $"Note: Requires patch {version}. When a new patch is released Artemis downloads " +
|
private void SetVersionText()
|
||||||
"new pointers for the latest version (unless disabled in settings).";
|
{
|
||||||
}
|
if (!General.Default.EnablePointersUpdate)
|
||||||
}
|
{
|
||||||
|
VersionText = "Note: You disabled pointer updates, this could result in the " +
|
||||||
|
"Rocket League effect not working after a game update.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Updater.GetPointers();
|
||||||
|
var version = JsonConvert
|
||||||
|
.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague)
|
||||||
|
.GameVersion;
|
||||||
|
VersionText = $"Note: Requires patch {version}. When a new patch is released Artemis downloads " +
|
||||||
|
"new pointers for the latest version (unless disabled in settings).";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,29 +1,31 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.TheDivision
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
{
|
{
|
||||||
public class TheDivisionDataModel
|
public class TheDivisionDataModel : IGameDataModel
|
||||||
{
|
{
|
||||||
public List<DivisionPlayer> DivisionPlayers { get; set; }
|
|
||||||
public GrenadeState GrenadeState { get; set; }
|
|
||||||
public bool LowAmmo { get; set; }
|
|
||||||
public bool LowHp { get; set; }
|
|
||||||
|
|
||||||
public TheDivisionDataModel()
|
public TheDivisionDataModel()
|
||||||
{
|
{
|
||||||
DivisionPlayers = new List<DivisionPlayer>();
|
TestyTest = new TestTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerState PartyMember1 { get; set; }
|
||||||
|
public PlayerState PartyMember2 { get; set; }
|
||||||
|
public PlayerState PartyMember3 { get; set; }
|
||||||
|
|
||||||
|
public bool LowAmmo { get; set; }
|
||||||
|
public bool LowHp { get; set; }
|
||||||
|
public GrenadeState GrenadeState { get; set; }
|
||||||
|
|
||||||
|
public TestTest TestyTest { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DivisionPlayer
|
|
||||||
|
public class TestTest
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public string TestS { get; set; }
|
||||||
public PlayerState PlayerState { get; set; }
|
public int TestI { get; set; }
|
||||||
|
|
||||||
public DivisionPlayer(int id)
|
|
||||||
{
|
|
||||||
Id = id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GrenadeState
|
public enum GrenadeState
|
||||||
|
|||||||
@ -1,257 +1,246 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
using Artemis.Managers;
|
||||||
using Artemis.Managers;
|
using Artemis.Models;
|
||||||
using Artemis.Models;
|
using Artemis.Modules.Effects.TypeWave;
|
||||||
using Artemis.Modules.Effects.TypeWave;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.LogitechDll;
|
||||||
using Artemis.Utilities.LogitechDll;
|
|
||||||
using CUE.NET;
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
|
{
|
||||||
namespace Artemis.Modules.Games.TheDivision
|
public class TheDivisionModel : GameModel
|
||||||
{
|
{
|
||||||
public class TheDivisionModel : GameModel
|
private Wave _ammoWave;
|
||||||
{
|
private TheDivisionDataModel _dataModel;
|
||||||
private Wave _ammoWave;
|
private KeyboardRectangle _hpRect;
|
||||||
private TheDivisionDataModel _dataModel;
|
private KeyboardRectangle _p2;
|
||||||
private KeyboardRectangle _hpRect;
|
private KeyboardRectangle _p3;
|
||||||
private KeyboardRectangle _p2;
|
private KeyboardRectangle _p4;
|
||||||
private KeyboardRectangle _p3;
|
private StickyValue<bool> _stickyAmmo;
|
||||||
private KeyboardRectangle _p4;
|
private StickyValue<bool> _stickyHp;
|
||||||
private StickyValue<bool> _stickyAmmo;
|
private int _trans;
|
||||||
private StickyValue<bool> _stickyHp;
|
|
||||||
private int _trans;
|
public TheDivisionModel(MainManager mainManager, TheDivisionSettings settings) : base(mainManager)
|
||||||
|
{
|
||||||
public TheDivisionModel(MainManager mainManager, TheDivisionSettings settings) : base(mainManager)
|
Settings = settings;
|
||||||
{
|
Name = "TheDivision";
|
||||||
Settings = settings;
|
ProcessName = "TheDivision";
|
||||||
Name = "TheDivision";
|
Scale = 4;
|
||||||
ProcessName = "TheDivision";
|
Enabled = Settings.Enabled;
|
||||||
Scale = 4;
|
Initialized = false;
|
||||||
Enabled = Settings.Enabled;
|
}
|
||||||
Initialized = false;
|
|
||||||
}
|
public TheDivisionSettings Settings { get; set; }
|
||||||
|
|
||||||
public TheDivisionSettings Settings { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public override void Dispose()
|
||||||
|
{
|
||||||
public override void Dispose()
|
Initialized = false;
|
||||||
{
|
DllManager.RestoreDll();
|
||||||
Initialized = false;
|
|
||||||
DllManager.RestoreDll();
|
_stickyAmmo.Dispose();
|
||||||
|
_stickyHp.Dispose();
|
||||||
_stickyAmmo.Dispose();
|
}
|
||||||
_stickyHp.Dispose();
|
|
||||||
}
|
public override void Enable()
|
||||||
|
{
|
||||||
public override void Enable()
|
Initialized = false;
|
||||||
{
|
|
||||||
Initialized = false;
|
_ammoWave = new Wave(new Point(30, 14), 0, Color.Transparent);
|
||||||
|
_hpRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 3*Scale, 0*Scale,
|
||||||
_ammoWave = new Wave(new Point(30, 14), 0, Color.Transparent);
|
new List<Color>(),
|
||||||
_hpRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 3*Scale, 0*Scale,
|
LinearGradientMode.Horizontal)
|
||||||
new List<Color>(),
|
{
|
||||||
LinearGradientMode.Horizontal)
|
Height = 7*Scale,
|
||||||
{
|
Width = 21*Scale,
|
||||||
Height = 7*Scale,
|
Rotate = true,
|
||||||
Width = 21*Scale,
|
ContainedBrush = false
|
||||||
Rotate = true,
|
};
|
||||||
ContainedBrush = false
|
|
||||||
};
|
_p2 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 1*Scale,
|
||||||
|
new List<Color>(),
|
||||||
_p2 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 1*Scale,
|
LinearGradientMode.Horizontal)
|
||||||
new List<Color>(),
|
{
|
||||||
LinearGradientMode.Horizontal)
|
Height = 2*Scale,
|
||||||
{
|
Width = 3*Scale,
|
||||||
Height = 2*Scale,
|
Rotate = true,
|
||||||
Width = 3*Scale,
|
ContainedBrush = false
|
||||||
Rotate = true,
|
};
|
||||||
ContainedBrush = false
|
_p3 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 3*Scale,
|
||||||
};
|
new List<Color>(),
|
||||||
_p3 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 3*Scale,
|
LinearGradientMode.Horizontal)
|
||||||
new List<Color>(),
|
{
|
||||||
LinearGradientMode.Horizontal)
|
Height = 2*Scale,
|
||||||
{
|
Width = 3*Scale,
|
||||||
Height = 2*Scale,
|
Rotate = true,
|
||||||
Width = 3*Scale,
|
ContainedBrush = false
|
||||||
Rotate = true,
|
};
|
||||||
ContainedBrush = false
|
_p4 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 5*Scale,
|
||||||
};
|
new List<Color>(),
|
||||||
_p4 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 5*Scale,
|
LinearGradientMode.Horizontal)
|
||||||
new List<Color>(),
|
{
|
||||||
LinearGradientMode.Horizontal)
|
Height = 2*Scale,
|
||||||
{
|
Width = 3*Scale,
|
||||||
Height = 2*Scale,
|
Rotate = true,
|
||||||
Width = 3*Scale,
|
ContainedBrush = false
|
||||||
Rotate = true,
|
};
|
||||||
ContainedBrush = false
|
|
||||||
};
|
_stickyAmmo = new StickyValue<bool>(200);
|
||||||
|
_stickyHp = new StickyValue<bool>(200);
|
||||||
_stickyAmmo = new StickyValue<bool>(200);
|
|
||||||
_stickyHp = new StickyValue<bool>(200);
|
DllManager.PlaceDll();
|
||||||
|
_dataModel = new TheDivisionDataModel();
|
||||||
DllManager.PlaceDll();
|
|
||||||
_dataModel = new TheDivisionDataModel();
|
MainManager.PipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||||
for (var i = 1; i < 5; i++)
|
Initialized = true;
|
||||||
_dataModel.DivisionPlayers.Add(new DivisionPlayer(i));
|
}
|
||||||
|
|
||||||
MainManager.PipeServer.PipeMessage += PipeServerOnPipeMessage;
|
private void PipeServerOnPipeMessage(string reply)
|
||||||
Initialized = true;
|
{
|
||||||
}
|
if (!Initialized)
|
||||||
|
return;
|
||||||
private void PipeServerOnPipeMessage(string reply)
|
|
||||||
{
|
// Convert the given string to a list of ints
|
||||||
if (!Initialized)
|
var stringParts = reply.Split(' ');
|
||||||
return;
|
var parts = new int[stringParts.Length];
|
||||||
|
for (var i = 0; i < stringParts.Length; i++)
|
||||||
// Convert the given string to a list of ints
|
parts[i] = int.Parse(stringParts[i]);
|
||||||
var stringParts = reply.Split(' ');
|
|
||||||
var parts = new int[stringParts.Length];
|
if (parts[0] == 1)
|
||||||
for (var i = 0; i < stringParts.Length; i++)
|
InterpertrateDivisionKey(parts);
|
||||||
parts[i] = int.Parse(stringParts[i]);
|
}
|
||||||
|
|
||||||
if (parts[0] == 1)
|
// Parses Division key data to game data
|
||||||
InterpertrateDivisionKey(parts);
|
private void InterpertrateDivisionKey(IReadOnlyList<int> parts)
|
||||||
}
|
{
|
||||||
|
var keyCode = parts[1];
|
||||||
// Parses Division key data to game data
|
var rPer = parts[2];
|
||||||
private void InterpertrateDivisionKey(int[] parts)
|
var gPer = parts[3];
|
||||||
{
|
var bPer = parts[4];
|
||||||
var keyCode = parts[1];
|
|
||||||
var rPer = parts[2];
|
// F1 to F4 indicate the player and his party. Blinks red on damage taken
|
||||||
var gPer = parts[3];
|
if (keyCode >= 59 && keyCode <= 62)
|
||||||
var bPer = parts[4];
|
{
|
||||||
|
var playerId = keyCode - 58;
|
||||||
// F1 to F4 indicate the player and his party. Blinks red on damage taken
|
|
||||||
if (keyCode >= 59 && keyCode <= 62)
|
PlayerState newState;
|
||||||
{
|
if (gPer > 10)
|
||||||
var playerId = keyCode - 58;
|
newState = PlayerState.Online;
|
||||||
var playerDataModel = _dataModel.DivisionPlayers.FirstOrDefault(p => p.Id == playerId);
|
else if (rPer > 10)
|
||||||
if (playerDataModel == null)
|
newState = PlayerState.Hit;
|
||||||
return;
|
else
|
||||||
|
newState = PlayerState.Offline;
|
||||||
if (gPer > 10)
|
|
||||||
playerDataModel.PlayerState = PlayerState.Online;
|
if (playerId == 1)
|
||||||
else if (rPer > 10)
|
_dataModel.PartyMember1 = newState;
|
||||||
playerDataModel.PlayerState = PlayerState.Hit;
|
else if (playerId == 2)
|
||||||
else
|
_dataModel.PartyMember2 = newState;
|
||||||
playerDataModel.PlayerState = PlayerState.Offline;
|
else if (playerId == 3)
|
||||||
}
|
_dataModel.PartyMember3 = newState;
|
||||||
// R blinks white when low on ammo
|
}
|
||||||
else if (keyCode == 19)
|
// R blinks white when low on ammo
|
||||||
{
|
else if (keyCode == 19)
|
||||||
_stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
{
|
||||||
_dataModel.LowAmmo = _stickyAmmo.Value;
|
_stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||||
}
|
_dataModel.LowAmmo = _stickyAmmo.Value;
|
||||||
// G turns white when holding a grenade, turns off when out of grenades
|
}
|
||||||
else if (keyCode == 34)
|
// G turns white when holding a grenade, turns off when out of grenades
|
||||||
{
|
else if (keyCode == 34)
|
||||||
if (rPer == 100 && gPer < 10 && bPer < 10)
|
{
|
||||||
_dataModel.GrenadeState = GrenadeState.HasGrenade;
|
if (rPer == 100 && gPer < 10 && bPer < 10)
|
||||||
else if (rPer == 100 && gPer > 10 && bPer > 10)
|
_dataModel.GrenadeState = GrenadeState.HasGrenade;
|
||||||
_dataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
else if (rPer == 100 && gPer > 10 && bPer > 10)
|
||||||
else
|
_dataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
||||||
_dataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
else
|
||||||
}
|
_dataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
||||||
// V blinks on low HP
|
}
|
||||||
else if (keyCode == 47)
|
// V blinks on low HP
|
||||||
{
|
else if (keyCode == 47)
|
||||||
_stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
{
|
||||||
_dataModel.LowHp = _stickyHp.Value;
|
_stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||||
}
|
_dataModel.LowHp = _stickyHp.Value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public override void Update()
|
|
||||||
{
|
public override void Update()
|
||||||
if (_dataModel.LowAmmo)
|
{
|
||||||
{
|
if (_dataModel.LowAmmo)
|
||||||
_ammoWave.Size++;
|
{
|
||||||
if (_ammoWave.Size > 30)
|
_ammoWave.Size++;
|
||||||
{
|
if (_ammoWave.Size > 30)
|
||||||
_ammoWave.Size = 0;
|
{
|
||||||
_trans = 255;
|
_ammoWave.Size = 0;
|
||||||
}
|
_trans = 255;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
_ammoWave.Size = 0;
|
else
|
||||||
|
_ammoWave.Size = 0;
|
||||||
_hpRect.Colors = _dataModel.LowHp
|
|
||||||
? new List<Color> {Color.Red, Color.Orange}
|
_hpRect.Colors = _dataModel.LowHp
|
||||||
: new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45) };
|
? new List<Color> {Color.Red, Color.Orange}
|
||||||
|
: new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||||
if (_dataModel.DivisionPlayers[1].PlayerState == PlayerState.Offline)
|
|
||||||
_p2.Colors = new List<Color> {Color.Gray, Color.White};
|
if (_dataModel.PartyMember1 == PlayerState.Offline)
|
||||||
else if (_dataModel.DivisionPlayers[1].PlayerState == PlayerState.Online)
|
_p2.Colors = new List<Color> {Color.Gray, Color.White};
|
||||||
_p2.Colors = new List<Color> { Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45) };
|
else if (_dataModel.PartyMember1 == PlayerState.Online)
|
||||||
else
|
_p2.Colors = new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||||
_p2.Colors = new List<Color> {Color.Red, Color.Orange};
|
else
|
||||||
|
_p2.Colors = new List<Color> {Color.Red, Color.Orange};
|
||||||
if (_dataModel.DivisionPlayers[2].PlayerState == PlayerState.Offline)
|
|
||||||
_p3.Colors = new List<Color> {Color.Gray, Color.White};
|
if (_dataModel.PartyMember2 == PlayerState.Offline)
|
||||||
else if (_dataModel.DivisionPlayers[2].PlayerState == PlayerState.Online)
|
_p3.Colors = new List<Color> {Color.Gray, Color.White};
|
||||||
_p3.Colors = new List<Color> { Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45) };
|
else if (_dataModel.PartyMember2 == PlayerState.Online)
|
||||||
else
|
_p3.Colors = new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||||
_p3.Colors = new List<Color> {Color.Red, Color.Orange};
|
else
|
||||||
|
_p3.Colors = new List<Color> {Color.Red, Color.Orange};
|
||||||
if (_dataModel.DivisionPlayers[3].PlayerState == PlayerState.Offline)
|
|
||||||
_p4.Colors = new List<Color> {Color.Gray, Color.White};
|
if (_dataModel.PartyMember3 == PlayerState.Offline)
|
||||||
else if (_dataModel.DivisionPlayers[3].PlayerState == PlayerState.Online)
|
_p4.Colors = new List<Color> {Color.Gray, Color.White};
|
||||||
_p4.Colors = new List<Color> { Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45) };
|
else if (_dataModel.PartyMember3 == PlayerState.Online)
|
||||||
else
|
_p4.Colors = new List<Color> {Color.FromArgb(10, 255, 0), Color.FromArgb(80, 255, 45)};
|
||||||
_p4.Colors = new List<Color> {Color.Red, Color.Orange};
|
else
|
||||||
|
_p4.Colors = new List<Color> {Color.Red, Color.Orange};
|
||||||
if (!_dataModel.LowAmmo)
|
}
|
||||||
{
|
|
||||||
foreach (var corsairLed in CueSDK.MouseSDK.Leds)
|
public override Bitmap GenerateBitmap()
|
||||||
corsairLed.Color = Color.Green;
|
{
|
||||||
}
|
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
else
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
foreach (var corsairLed in CueSDK.MouseSDK.Leds)
|
g.Clear(Color.Transparent);
|
||||||
corsairLed.Color = Color.Red;
|
_hpRect.Draw(g);
|
||||||
}
|
_p2.Draw(g);
|
||||||
CueSDK.MouseSDK.Update();
|
_p3.Draw(g);
|
||||||
}
|
_p4.Draw(g);
|
||||||
|
// Very, very PH
|
||||||
public override Bitmap GenerateBitmap()
|
if (_ammoWave.Size != 0)
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var path = new GraphicsPath();
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
path.AddEllipse(_ammoWave.Point.X - _ammoWave.Size/2, _ammoWave.Point.Y - _ammoWave.Size/2,
|
||||||
{
|
_ammoWave.Size, _ammoWave.Size);
|
||||||
g.Clear(Color.Transparent);
|
|
||||||
_hpRect.Draw(g);
|
if (_ammoWave.Size > 15)
|
||||||
_p2.Draw(g);
|
_trans = _trans - 16;
|
||||||
_p3.Draw(g);
|
if (_trans < 1)
|
||||||
_p4.Draw(g);
|
_trans = 255;
|
||||||
// Very, very PH
|
var pthGrBrush = new PathGradientBrush(path)
|
||||||
if (_ammoWave.Size != 0)
|
{
|
||||||
{
|
SurroundColors = new[] {_ammoWave.Color},
|
||||||
var path = new GraphicsPath();
|
CenterColor = Color.FromArgb(_trans, 255, 0, 0)
|
||||||
path.AddEllipse(_ammoWave.Point.X - _ammoWave.Size/2, _ammoWave.Point.Y - _ammoWave.Size/2,
|
};
|
||||||
_ammoWave.Size, _ammoWave.Size);
|
|
||||||
|
g.FillPath(pthGrBrush, path);
|
||||||
if (_ammoWave.Size > 15)
|
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
|
||||||
_trans = _trans - 16;
|
|
||||||
if (_trans < 1)
|
g.FillPath(pthGrBrush, path);
|
||||||
_trans = 255;
|
g.DrawEllipse(new Pen(pthGrBrush, 1), _ammoWave.Point.X - _ammoWave.Size/2,
|
||||||
var pthGrBrush = new PathGradientBrush(path)
|
_ammoWave.Point.Y - _ammoWave.Size/2, _ammoWave.Size, _ammoWave.Size);
|
||||||
{
|
}
|
||||||
SurroundColors = new[] {_ammoWave.Color},
|
}
|
||||||
CenterColor = Color.FromArgb(_trans, 255, 0, 0)
|
return bitmap;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
g.FillPath(pthGrBrush, path);
|
|
||||||
pthGrBrush.FocusScales = new PointF(0.3f, 0.8f);
|
|
||||||
|
|
||||||
g.FillPath(pthGrBrush, path);
|
|
||||||
g.DrawEllipse(new Pen(pthGrBrush, 1), _ammoWave.Point.X - _ammoWave.Size/2,
|
|
||||||
_ammoWave.Point.Y - _ammoWave.Size/2, _ammoWave.Size, _ammoWave.Size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,29 +1,29 @@
|
|||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.TheDivision
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
{
|
{
|
||||||
public class TheDivisionSettings : GameSettings
|
public class TheDivisionSettings : GameSettings
|
||||||
{
|
{
|
||||||
public TheDivisionSettings()
|
public TheDivisionSettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
Enabled = TheDivision.Default.Enabled;
|
Enabled = TheDivision.Default.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
TheDivision.Default.Enabled = Enabled;
|
TheDivision.Default.Enabled = Enabled;
|
||||||
|
|
||||||
TheDivision.Default.Save();
|
TheDivision.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,48 +7,52 @@
|
|||||||
xmlns:cal="http://www.caliburnproject.org"
|
xmlns:cal="http://www.caliburnproject.org"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="416.495" d:DesignWidth="553.608">
|
d:DesignHeight="416.495" d:DesignWidth="553.608">
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||||
<Grid Margin="15, 5, 15, 5">
|
<Grid Margin="15, 5, 15, 5">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
<RowDefinition Height="*" />
|
||||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
</Grid.RowDefinitions>
|
||||||
<Label FontSize="20" HorizontalAlignment="Left">
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
<Label.Content>
|
<Label FontSize="20" HorizontalAlignment="Left">
|
||||||
<AccessText TextWrapping="Wrap"
|
<Label.Content>
|
||||||
Text="Shows lots of things, I should change this." />
|
<AccessText TextWrapping="Wrap"
|
||||||
</Label.Content>
|
Text="Shows lots of things, I should change this." />
|
||||||
</Label>
|
</Label.Content>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
</Label>
|
||||||
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||||
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
|
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
||||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
|
||||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||||
</StackPanel>
|
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
|
|
||||||
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
|
||||||
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify">
|
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
|
||||||
Note: For this game to work with Artemis, please open up your Division settings, navigate to 3rd Party and set LED keyboard support to Yes. (This only works if you have Artemis running before starting the game)
|
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify">
|
||||||
</TextBlock>
|
Note: For this game to work with Artemis, please open up your Division settings, navigate to 3rd Party and set LED keyboard support to Yes. (This only works if you have Artemis running before starting the game)
|
||||||
|
</TextBlock>
|
||||||
<!-- Buttons -->
|
|
||||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
<!-- Profile editor -->
|
||||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||||
Style="{DynamicResource SquareButtonStyle}" />
|
|
||||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
<!-- Buttons -->
|
||||||
Margin="10,0,0,0"
|
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||||
Style="{DynamicResource SquareButtonStyle}" />
|
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||||
</StackPanel>
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
</Grid>
|
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@ -1,22 +1,27 @@
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels;
|
||||||
|
using Artemis.ViewModels.Abstract;
|
||||||
namespace Artemis.Modules.Games.TheDivision
|
|
||||||
{
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
public class TheDivisionViewModel : GameViewModel
|
{
|
||||||
{
|
public class TheDivisionViewModel : GameViewModel
|
||||||
public TheDivisionViewModel(MainManager mainManager)
|
{
|
||||||
{
|
public TheDivisionViewModel(MainManager mainManager)
|
||||||
MainManager = mainManager;
|
{
|
||||||
|
MainManager = mainManager;
|
||||||
// Settings are loaded from file by class
|
|
||||||
GameSettings = new TheDivisionSettings();
|
// Settings are loaded from file by class
|
||||||
|
GameSettings = new TheDivisionSettings();
|
||||||
// Create effect model and add it to MainManager
|
|
||||||
GameModel = new TheDivisionModel(mainManager, (TheDivisionSettings) GameSettings);
|
// Create effect model and add it to MainManager
|
||||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
GameModel = new TheDivisionModel(mainManager, (TheDivisionSettings) GameSettings);
|
||||||
}
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
|
|
||||||
public static string Name => "The Division";
|
ProfileEditor = new ProfileEditorViewModel<TheDivisionDataModel>(MainManager, GameModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProfileEditorViewModel<TheDivisionDataModel> ProfileEditor { get; set; }
|
||||||
|
|
||||||
|
public static string Name => "The Division";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,121 +1,121 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Witcher3
|
namespace Artemis.Modules.Games.Witcher3
|
||||||
{
|
{
|
||||||
public class Witcher3Model : GameModel
|
public class Witcher3Model : GameModel
|
||||||
{
|
{
|
||||||
private readonly Regex _signRegex;
|
private readonly Regex _signRegex;
|
||||||
private readonly Stopwatch _updateSw;
|
private readonly Stopwatch _updateSw;
|
||||||
private KeyboardRectangle _signRect;
|
private KeyboardRectangle _signRect;
|
||||||
private string _witcherSettings;
|
private string _witcherSettings;
|
||||||
|
|
||||||
public Witcher3Model(MainManager mainManager, Witcher3Settings settings) : base(mainManager)
|
public Witcher3Model(MainManager mainManager, Witcher3Settings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Name = "Witcher3";
|
Name = "Witcher3";
|
||||||
ProcessName = "witcher3";
|
ProcessName = "witcher3";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
Enabled = Settings.Enabled;
|
Enabled = Settings.Enabled;
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
_updateSw = new Stopwatch();
|
_updateSw = new Stopwatch();
|
||||||
_signRegex = new Regex("ActiveSign=(.*)", RegexOptions.Compiled);
|
_signRegex = new Regex("ActiveSign=(.*)", RegexOptions.Compiled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Witcher3Settings Settings { get; set; }
|
public Witcher3Settings Settings { get; set; }
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
_witcherSettings = null;
|
_witcherSettings = null;
|
||||||
|
|
||||||
_updateSw.Reset();
|
_updateSw.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
_signRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
_signRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
Rotate = true,
|
Rotate = true,
|
||||||
LoopSpeed = 0.5
|
LoopSpeed = 0.5
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ensure the config file is found
|
// Ensure the config file is found
|
||||||
var witcherSettings = Environment.GetFolderPath(Environment.SpecialFolder.Personal) +
|
var witcherSettings = Environment.GetFolderPath(Environment.SpecialFolder.Personal) +
|
||||||
@"\The Witcher 3\user.settings";
|
@"\The Witcher 3\user.settings";
|
||||||
if (File.Exists(witcherSettings))
|
if (File.Exists(witcherSettings))
|
||||||
_witcherSettings = witcherSettings;
|
_witcherSettings = witcherSettings;
|
||||||
|
|
||||||
_updateSw.Start();
|
_updateSw.Start();
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
// Witcher effect is very static and reads from disk, don't want to update too often.
|
// Witcher effect is very static and reads from disk, don't want to update too often.
|
||||||
if (_updateSw.ElapsedMilliseconds < 500)
|
if (_updateSw.ElapsedMilliseconds < 500)
|
||||||
return;
|
return;
|
||||||
_updateSw.Restart();
|
_updateSw.Restart();
|
||||||
|
|
||||||
if (_witcherSettings == null)
|
if (_witcherSettings == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var reader = new StreamReader(File.Open(_witcherSettings,
|
var reader = new StreamReader(File.Open(_witcherSettings,
|
||||||
FileMode.Open,
|
FileMode.Open,
|
||||||
FileAccess.Read,
|
FileAccess.Read,
|
||||||
FileShare.ReadWrite));
|
FileShare.ReadWrite));
|
||||||
var configContent = reader.ReadToEnd();
|
var configContent = reader.ReadToEnd();
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|
||||||
var signRes = _signRegex.Match(configContent);
|
var signRes = _signRegex.Match(configContent);
|
||||||
if (signRes.Groups.Count < 2)
|
if (signRes.Groups.Count < 2)
|
||||||
return;
|
return;
|
||||||
var sign = signRes.Groups[1].Value;
|
var sign = signRes.Groups[1].Value;
|
||||||
|
|
||||||
switch (sign)
|
switch (sign)
|
||||||
{
|
{
|
||||||
case "ST_Aard\r":
|
case "ST_Aard\r":
|
||||||
_signRect.Colors = new List<Color> {Color.DeepSkyBlue, Color.Blue};
|
_signRect.Colors = new List<Color> {Color.DeepSkyBlue, Color.Blue};
|
||||||
break;
|
break;
|
||||||
case "ST_Yrden\r":
|
case "ST_Yrden\r":
|
||||||
_signRect.Colors = new List<Color> {Color.Purple, Color.DeepPink};
|
_signRect.Colors = new List<Color> {Color.Purple, Color.DeepPink};
|
||||||
break;
|
break;
|
||||||
case "ST_Igni\r":
|
case "ST_Igni\r":
|
||||||
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.Red};
|
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.Red};
|
||||||
break;
|
break;
|
||||||
case "ST_Quen\r":
|
case "ST_Quen\r":
|
||||||
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.FromArgb(232, 193, 0)};
|
_signRect.Colors = new List<Color> {Color.DarkOrange, Color.FromArgb(232, 193, 0)};
|
||||||
break;
|
break;
|
||||||
case "ST_Axii\r":
|
case "ST_Axii\r":
|
||||||
_signRect.Colors = new List<Color> {Color.LawnGreen, Color.DarkGreen};
|
_signRect.Colors = new List<Color> {Color.LawnGreen, Color.DarkGreen};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
_signRect.Draw(g);
|
_signRect.Draw(g);
|
||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,29 +1,29 @@
|
|||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Witcher3
|
namespace Artemis.Modules.Games.Witcher3
|
||||||
{
|
{
|
||||||
public class Witcher3Settings : GameSettings
|
public class Witcher3Settings : GameSettings
|
||||||
{
|
{
|
||||||
public Witcher3Settings()
|
public Witcher3Settings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
Enabled = Witcher3.Default.Enabled;
|
Enabled = Witcher3.Default.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
Witcher3.Default.Enabled = Enabled;
|
Witcher3.Default.Enabled = Enabled;
|
||||||
|
|
||||||
Witcher3.Default.Save();
|
Witcher3.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Witcher3
|
namespace Artemis.Modules.Games.Witcher3
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for Witcher3View.xaml
|
/// Interaction logic for Witcher3View.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Witcher3View : UserControl
|
public partial class Witcher3View : UserControl
|
||||||
{
|
{
|
||||||
public Witcher3View()
|
public Witcher3View()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,112 +1,112 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Witcher3
|
namespace Artemis.Modules.Games.Witcher3
|
||||||
{
|
{
|
||||||
public class Witcher3ViewModel : GameViewModel
|
public class Witcher3ViewModel : GameViewModel
|
||||||
{
|
{
|
||||||
public Witcher3ViewModel(MainManager mainManager)
|
public Witcher3ViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
GameSettings = new Witcher3Settings();
|
GameSettings = new Witcher3Settings();
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
GameModel = new Witcher3Model(mainManager, (Witcher3Settings) GameSettings);
|
GameModel = new Witcher3Model(mainManager, (Witcher3Settings) GameSettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Name => "The Witcher 3";
|
public static string Name => "The Witcher 3";
|
||||||
|
|
||||||
public async void AutoInstall()
|
public async void AutoInstall()
|
||||||
{
|
{
|
||||||
// Request The Witcher 3 folder
|
// Request The Witcher 3 folder
|
||||||
var dialog = new FolderBrowserDialog
|
var dialog = new FolderBrowserDialog
|
||||||
{
|
{
|
||||||
Description = "Please select your Witcher 3 install path (root directory)."
|
Description = "Please select your Witcher 3 install path (root directory)."
|
||||||
};
|
};
|
||||||
var result = dialog.ShowDialog();
|
var result = dialog.ShowDialog();
|
||||||
if (result != DialogResult.OK)
|
if (result != DialogResult.OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If the subfolder doesn't contain witcher3.exe, it's the wrong folder.
|
// If the subfolder doesn't contain witcher3.exe, it's the wrong folder.
|
||||||
if (!File.Exists(dialog.SelectedPath + @"\bin\x64\witcher3.exe"))
|
if (!File.Exists(dialog.SelectedPath + @"\bin\x64\witcher3.exe"))
|
||||||
{
|
{
|
||||||
var retry = await
|
var retry = await
|
||||||
MainManager.DialogService.ShowQuestionMessageBox("Installation error",
|
MainManager.DialogService.ShowQuestionMessageBox("Installation error",
|
||||||
"That's not a valid Witcher 3 directory\n\n" +
|
"That's not a valid Witcher 3 directory\n\n" +
|
||||||
"Default directories:\n" +
|
"Default directories:\n" +
|
||||||
"Steam: \\SteamApps\\common\\The Witcher 3\n" +
|
"Steam: \\SteamApps\\common\\The Witcher 3\n" +
|
||||||
"GOG: C:\\GOG Games\\The Witcher 3 Wild Hunt\n\n" +
|
"GOG: C:\\GOG Games\\The Witcher 3 Wild Hunt\n\n" +
|
||||||
"Retry?");
|
"Retry?");
|
||||||
if (retry.Value)
|
if (retry.Value)
|
||||||
AutoInstall();
|
AutoInstall();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for any conflicting mods
|
// Look for any conflicting mods
|
||||||
if (Directory.Exists(dialog.SelectedPath + @"\mods"))
|
if (Directory.Exists(dialog.SelectedPath + @"\mods"))
|
||||||
{
|
{
|
||||||
var file =
|
var file =
|
||||||
Directory.GetFiles(dialog.SelectedPath + @"\mods", "playerWitcher.ws", SearchOption.AllDirectories)
|
Directory.GetFiles(dialog.SelectedPath + @"\mods", "playerWitcher.ws", SearchOption.AllDirectories)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
// Don't trip over our own mod
|
// Don't trip over our own mod
|
||||||
if (!file.Contains("modArtemis"))
|
if (!file.Contains("modArtemis"))
|
||||||
{
|
{
|
||||||
var viewHelp = await
|
var viewHelp = await
|
||||||
MainManager.DialogService.ShowQuestionMessageBox("Conflicting mod found",
|
MainManager.DialogService.ShowQuestionMessageBox("Conflicting mod found",
|
||||||
"Oh no, you have a conflicting mod!\n\n" +
|
"Oh no, you have a conflicting mod!\n\n" +
|
||||||
"Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) +
|
"Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) +
|
||||||
"\n\nWould you like to view instructions on how to manually install the mod?");
|
"\n\nWould you like to view instructions on how to manually install the mod?");
|
||||||
if (!viewHelp.Value)
|
if (!viewHelp.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Put the mod in the documents folder instead
|
// Put the mod in the documents folder instead
|
||||||
// Create the directory structure
|
// Create the directory structure
|
||||||
var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis";
|
var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis";
|
||||||
if (
|
if (
|
||||||
!Directory.Exists(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player"))
|
!Directory.Exists(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player"))
|
||||||
Directory.CreateDirectory(folder +
|
Directory.CreateDirectory(folder +
|
||||||
@"\Witcher3\mods\modArtemis\content\scripts\game\player");
|
@"\Witcher3\mods\modArtemis\content\scripts\game\player");
|
||||||
if (
|
if (
|
||||||
!Directory.Exists(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc"))
|
!Directory.Exists(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc"))
|
||||||
Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc");
|
Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc");
|
||||||
|
|
||||||
// Install the mod files
|
// Install the mod files
|
||||||
File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",
|
File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",
|
||||||
Resources.artemisXml);
|
Resources.artemisXml);
|
||||||
File.WriteAllText(
|
File.WriteAllText(
|
||||||
folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
|
folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
|
||||||
Resources.playerWitcherWs);
|
Resources.playerWitcherWs);
|
||||||
|
|
||||||
Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
|
Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the directory structure
|
// Create the directory structure
|
||||||
if (!Directory.Exists(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player"))
|
if (!Directory.Exists(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player"))
|
||||||
Directory.CreateDirectory(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player");
|
Directory.CreateDirectory(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player");
|
||||||
if (!Directory.Exists(dialog.SelectedPath + @"\bin\config\r4game\user_config_matrix\pc"))
|
if (!Directory.Exists(dialog.SelectedPath + @"\bin\config\r4game\user_config_matrix\pc"))
|
||||||
Directory.CreateDirectory(dialog.SelectedPath + @"\bin\config\r4game\user_config_matrix\pc");
|
Directory.CreateDirectory(dialog.SelectedPath + @"\bin\config\r4game\user_config_matrix\pc");
|
||||||
|
|
||||||
// Install the mod files
|
// Install the mod files
|
||||||
File.WriteAllText(dialog.SelectedPath + @"\bin\config\r4game\user_config_matrix\pc\artemis.xml",
|
File.WriteAllText(dialog.SelectedPath + @"\bin\config\r4game\user_config_matrix\pc\artemis.xml",
|
||||||
Resources.artemisXml);
|
Resources.artemisXml);
|
||||||
File.WriteAllText(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
|
File.WriteAllText(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
|
||||||
Resources.playerWitcherWs);
|
Resources.playerWitcherWs);
|
||||||
|
|
||||||
MainManager.DialogService.ShowMessageBox("Success", "The mod was successfully installed!");
|
MainManager.DialogService.ShowMessageBox("Success", "The mod was successfully installed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,46 +1,46 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
public class VolumeBar
|
public class VolumeBar
|
||||||
{
|
{
|
||||||
public VolumeBar(MainManager mainManager, VolumeDisplaySettings settings)
|
public VolumeBar(MainManager mainManager, VolumeDisplaySettings settings)
|
||||||
{
|
{
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Transparancy = 255;
|
Transparancy = 255;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainManager MainManager { get; set; }
|
public MainManager MainManager { get; set; }
|
||||||
|
|
||||||
public VolumeDisplaySettings Settings { get; set; }
|
public VolumeDisplaySettings Settings { get; set; }
|
||||||
|
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
|
|
||||||
public int Ttl { get; set; }
|
public int Ttl { get; set; }
|
||||||
public byte Transparancy { get; set; }
|
public byte Transparancy { get; set; }
|
||||||
public int Volume { get; set; }
|
public int Volume { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public void Draw(Graphics g)
|
public void Draw(Graphics g)
|
||||||
{
|
{
|
||||||
var volumeRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
var volumeRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||||
{
|
{
|
||||||
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
||||||
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
||||||
},
|
},
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
Width = (int) (MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*Volume),
|
Width = (int) (MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*Volume),
|
||||||
ContainedBrush = false
|
ContainedBrush = false
|
||||||
};
|
};
|
||||||
volumeRect.Draw(g);
|
volumeRect.Draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,91 +1,91 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using NAudio.CoreAudioApi;
|
using NAudio.CoreAudioApi;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
public class VolumeDisplayModel : OverlayModel
|
public class VolumeDisplayModel : OverlayModel
|
||||||
{
|
{
|
||||||
public VolumeDisplayModel(MainManager mainManager, VolumeDisplaySettings settings) : base(mainManager)
|
public VolumeDisplayModel(MainManager mainManager, VolumeDisplaySettings settings) : base(mainManager)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Name = "VolumeDisplay";
|
Name = "VolumeDisplay";
|
||||||
Enabled = Settings.Enabled;
|
Enabled = Settings.Enabled;
|
||||||
|
|
||||||
VolumeDisplay = new VolumeBar(mainManager, settings);
|
VolumeDisplay = new VolumeBar(mainManager, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeBar VolumeDisplay { get; set; }
|
public VolumeBar VolumeDisplay { get; set; }
|
||||||
|
|
||||||
public VolumeDisplaySettings Settings { get; set; }
|
public VolumeDisplaySettings Settings { get; set; }
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
MainManager.KeyboardHook.KeyDownCallback -= KeyPressTask;
|
MainManager.KeyboardHook.KeyDownCallback -= KeyPressTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
// Listener won't start unless the effect is active
|
// Listener won't start unless the effect is active
|
||||||
MainManager.KeyboardHook.KeyDownCallback += KeyPressTask;
|
MainManager.KeyboardHook.KeyDownCallback += KeyPressTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
// TODO: Get from settings
|
// TODO: Get from settings
|
||||||
var fps = 25;
|
var fps = 25;
|
||||||
|
|
||||||
if (VolumeDisplay == null)
|
if (VolumeDisplay == null)
|
||||||
return;
|
return;
|
||||||
if (VolumeDisplay.Ttl < 1)
|
if (VolumeDisplay.Ttl < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var decreaseAmount = 500/fps;
|
var decreaseAmount = 500/fps;
|
||||||
VolumeDisplay.Ttl = VolumeDisplay.Ttl - decreaseAmount;
|
VolumeDisplay.Ttl = VolumeDisplay.Ttl - decreaseAmount;
|
||||||
if (VolumeDisplay.Ttl < 128)
|
if (VolumeDisplay.Ttl < 128)
|
||||||
VolumeDisplay.Transparancy = (byte) (VolumeDisplay.Transparancy - 20);
|
VolumeDisplay.Transparancy = (byte) (VolumeDisplay.Transparancy - 20);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var enumerator = new MMDeviceEnumerator();
|
var enumerator = new MMDeviceEnumerator();
|
||||||
var volumeFloat =
|
var volumeFloat =
|
||||||
enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console)
|
enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console)
|
||||||
.AudioEndpointVolume.MasterVolumeLevelScalar;
|
.AudioEndpointVolume.MasterVolumeLevelScalar;
|
||||||
VolumeDisplay.Volume = (int) (volumeFloat*100);
|
VolumeDisplay.Volume = (int) (volumeFloat*100);
|
||||||
}
|
}
|
||||||
catch (COMException)
|
catch (COMException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
return GenerateBitmap(MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(4));
|
return GenerateBitmap(MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap(Bitmap bitmap)
|
public override Bitmap GenerateBitmap(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
if (VolumeDisplay == null)
|
if (VolumeDisplay == null)
|
||||||
return bitmap;
|
return bitmap;
|
||||||
if (VolumeDisplay.Ttl < 1)
|
if (VolumeDisplay.Ttl < 1)
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
VolumeDisplay.Draw(g);
|
VolumeDisplay.Draw(g);
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void KeyPressTask(KeyEventArgs e)
|
private void KeyPressTask(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown)
|
if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VolumeDisplay.Ttl = 1000;
|
VolumeDisplay.Ttl = 1000;
|
||||||
VolumeDisplay.Transparancy = 255;
|
VolumeDisplay.Transparancy = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,40 +1,40 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
public class VolumeDisplaySettings : EffectSettings
|
public class VolumeDisplaySettings : EffectSettings
|
||||||
{
|
{
|
||||||
public VolumeDisplaySettings()
|
public VolumeDisplaySettings()
|
||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public Color MainColor { get; set; }
|
public Color MainColor { get; set; }
|
||||||
public Color SecondaryColor { get; set; }
|
public Color SecondaryColor { get; set; }
|
||||||
|
|
||||||
public sealed override void Load()
|
public sealed override void Load()
|
||||||
{
|
{
|
||||||
Enabled = VolumeDisplay.Default.Enabled;
|
Enabled = VolumeDisplay.Default.Enabled;
|
||||||
MainColor = VolumeDisplay.Default.MainColor;
|
MainColor = VolumeDisplay.Default.MainColor;
|
||||||
SecondaryColor = VolumeDisplay.Default.SecondaryColor;
|
SecondaryColor = VolumeDisplay.Default.SecondaryColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void Save()
|
public sealed override void Save()
|
||||||
{
|
{
|
||||||
VolumeDisplay.Default.Enabled = Enabled;
|
VolumeDisplay.Default.Enabled = Enabled;
|
||||||
VolumeDisplay.Default.MainColor = MainColor;
|
VolumeDisplay.Default.MainColor = MainColor;
|
||||||
VolumeDisplay.Default.SecondaryColor = SecondaryColor;
|
VolumeDisplay.Default.SecondaryColor = SecondaryColor;
|
||||||
|
|
||||||
VolumeDisplay.Default.Save();
|
VolumeDisplay.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override void ToDefault()
|
public sealed override void ToDefault()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
MainColor = Color.FromArgb(255, 38, 246, 0);
|
MainColor = Color.FromArgb(255, 38, 246, 0);
|
||||||
SecondaryColor = Color.FromArgb(255, 255, 41, 0);
|
SecondaryColor = Color.FromArgb(255, 255, 41, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,15 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MediaKeysDisplayView.xaml
|
/// Interaction logic for MediaKeysDisplayView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class VolumeDisplayView : UserControl
|
public partial class VolumeDisplayView : UserControl
|
||||||
{
|
{
|
||||||
public VolumeDisplayView()
|
public VolumeDisplayView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,60 +1,60 @@
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
public class VolumeDisplayViewModel : Screen
|
public class VolumeDisplayViewModel : Screen
|
||||||
{
|
{
|
||||||
private VolumeDisplaySettings _volumeDisplaySettings;
|
private VolumeDisplaySettings _volumeDisplaySettings;
|
||||||
|
|
||||||
public VolumeDisplayViewModel(MainManager mainManager)
|
public VolumeDisplayViewModel(MainManager mainManager)
|
||||||
{
|
{
|
||||||
MainManager = mainManager;
|
MainManager = mainManager;
|
||||||
|
|
||||||
// Settings are loaded from file by class
|
// Settings are loaded from file by class
|
||||||
VolumeDisplaySettings = new VolumeDisplaySettings();
|
VolumeDisplaySettings = new VolumeDisplaySettings();
|
||||||
|
|
||||||
// Create effect model and add it to MainManager
|
// Create effect model and add it to MainManager
|
||||||
VolumeDisplayModel = new VolumeDisplayModel(mainManager, VolumeDisplaySettings);
|
VolumeDisplayModel = new VolumeDisplayModel(mainManager, VolumeDisplaySettings);
|
||||||
MainManager.EffectManager.EffectModels.Add(VolumeDisplayModel);
|
MainManager.EffectManager.EffectModels.Add(VolumeDisplayModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Name => "Volume Display";
|
public static string Name => "Volume Display";
|
||||||
|
|
||||||
public MainManager MainManager { get; set; }
|
public MainManager MainManager { get; set; }
|
||||||
public VolumeDisplayModel VolumeDisplayModel { get; set; }
|
public VolumeDisplayModel VolumeDisplayModel { get; set; }
|
||||||
|
|
||||||
public VolumeDisplaySettings VolumeDisplaySettings
|
public VolumeDisplaySettings VolumeDisplaySettings
|
||||||
{
|
{
|
||||||
get { return _volumeDisplaySettings; }
|
get { return _volumeDisplaySettings; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Equals(value, _volumeDisplaySettings)) return;
|
if (Equals(value, _volumeDisplaySettings)) return;
|
||||||
_volumeDisplaySettings = value;
|
_volumeDisplaySettings = value;
|
||||||
NotifyOfPropertyChange(() => VolumeDisplaySettings);
|
NotifyOfPropertyChange(() => VolumeDisplaySettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleEffect()
|
public void ToggleEffect()
|
||||||
{
|
{
|
||||||
VolumeDisplayModel.Enabled = _volumeDisplaySettings.Enabled;
|
VolumeDisplayModel.Enabled = _volumeDisplaySettings.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSettings()
|
public void SaveSettings()
|
||||||
{
|
{
|
||||||
if (VolumeDisplayModel == null)
|
if (VolumeDisplayModel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VolumeDisplaySettings.Save();
|
VolumeDisplaySettings.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetSettings()
|
public void ResetSettings()
|
||||||
{
|
{
|
||||||
// TODO: Confirmation dialog (Generic MVVM approach)
|
// TODO: Confirmation dialog (Generic MVVM approach)
|
||||||
VolumeDisplaySettings.ToDefault();
|
VolumeDisplaySettings.ToDefault();
|
||||||
NotifyOfPropertyChange(() => VolumeDisplaySettings);
|
NotifyOfPropertyChange(() => VolumeDisplaySettings);
|
||||||
|
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,56 +1,56 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
|
|
||||||
[assembly: AssemblyTitle("Artemis")]
|
[assembly: AssemblyTitle("Artemis")]
|
||||||
[assembly: AssemblyDescription("Adds third-party support for RGB keyboards to games")]
|
[assembly: AssemblyDescription("Adds third-party support for RGB keyboards to games")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Artemis developers")]
|
[assembly: AssemblyCompany("Artemis developers")]
|
||||||
[assembly: AssemblyProduct("Artemis")]
|
[assembly: AssemblyProduct("Artemis")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// 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
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
//In order to begin building localizable applications, set
|
//In order to begin building localizable applications, set
|
||||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
//inside a <PropertyGroup>. For example, if you are using US english
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
//the line below to match the UICulture setting in the project file.
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
[assembly: ThemeInfo(
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// or application resource dictionaries)
|
// or application resource dictionaries)
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// app, or any theme specific resource dictionaries)
|
// app, or any theme specific resource dictionaries)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
67
Artemis/Artemis/Properties/Resources.Designer.cs
generated
67
Artemis/Artemis/Properties/Resources.Designer.cs
generated
@ -91,10 +91,7 @@ namespace Artemis.Properties {
|
|||||||
/// Looks up a localized string similar to "Artemis"
|
/// Looks up a localized string similar to "Artemis"
|
||||||
///{
|
///{
|
||||||
/// "uri" "http://localhost:{{port}}/csgo_game_event"
|
/// "uri" "http://localhost:{{port}}/csgo_game_event"
|
||||||
/// "timeout" "5.0"
|
/// "timeout" "0.1"
|
||||||
/// "buffer" "0.1"
|
|
||||||
/// "throttle" "0.1"
|
|
||||||
/// "heartbeat" "30.0"
|
|
||||||
/// "data"
|
/// "data"
|
||||||
/// {
|
/// {
|
||||||
/// "provider" "1"
|
/// "provider" "1"
|
||||||
@ -116,7 +113,7 @@ namespace Artemis.Properties {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to "Artemis"
|
/// Looks up a localized string similar to "Artemis"
|
||||||
///{
|
///{
|
||||||
/// "uri" "http://localhost:4000/"
|
/// "uri" "http://localhost:{{port}}/"
|
||||||
/// "timeout" "5.0"
|
/// "timeout" "5.0"
|
||||||
/// "buffer" "0.1"
|
/// "buffer" "0.1"
|
||||||
/// "throttle" "0.1"
|
/// "throttle" "0.1"
|
||||||
@ -138,6 +135,56 @@ namespace Artemis.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap folder {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("folder", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap g910 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("g910", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap k65 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("k65", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap k70 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("k70", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap k95 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("k95", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Byte[].
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -191,5 +238,15 @@ namespace Artemis.Properties {
|
|||||||
return ResourceManager.GetString("playerWitcherWs", resourceCulture);
|
return ResourceManager.GetString("playerWitcherWs", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap strafe {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("strafe", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,4 +142,22 @@
|
|||||||
<data name="playerWitcherWs" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="playerWitcherWs" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
|
<value>..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="k65" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\keyboards\k65.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="k70" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\keyboards\k70.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="k95" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\keyboards\k95.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="strafe" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\resources\keyboards\strafe.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="g910" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Keyboards\g910.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -1,18 +1,15 @@
|
|||||||
"Artemis"
|
"Artemis"
|
||||||
{
|
{
|
||||||
"uri" "http://localhost:{{port}}/csgo_game_event"
|
"uri" "http://localhost:{{port}}/csgo_game_event"
|
||||||
"timeout" "5.0"
|
"timeout" "0.1"
|
||||||
"buffer" "0.1"
|
"data"
|
||||||
"throttle" "0.1"
|
{
|
||||||
"heartbeat" "30.0"
|
"provider" "1"
|
||||||
"data"
|
"map" "1"
|
||||||
{
|
"round" "1"
|
||||||
"provider" "1"
|
"player_id" "1"
|
||||||
"map" "1"
|
"player_state" "1"
|
||||||
"round" "1"
|
"player_weapons" "1"
|
||||||
"player_id" "1"
|
"player_match_stats" "1"
|
||||||
"player_state" "1"
|
}
|
||||||
"player_weapons" "1"
|
|
||||||
"player_match_stats" "1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,3 +1,3 @@
|
|||||||
Entypo (http://www.entypo.com/) is created by Daniel Bruce and released under the Creative Commons, Share Alike/Attribution license.
|
Entypo (http://www.entypo.com/) is created by Daniel Bruce and released under the Creative Commons, Share Alike/Attribution license.
|
||||||
|
|
||||||
http://creativecommons.org/licenses/by-sa/3.0/
|
http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
File diff suppressed because one or more lines are too long
BIN
Artemis/Artemis/Resources/Keyboards/g910.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/g910.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 292 KiB |
BIN
Artemis/Artemis/Resources/Keyboards/k65.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/k65.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 229 KiB |
BIN
Artemis/Artemis/Resources/Keyboards/k70.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/k70.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 284 KiB |
BIN
Artemis/Artemis/Resources/Keyboards/k95.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/k95.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 308 KiB |
BIN
Artemis/Artemis/Resources/Keyboards/strafe.png
Normal file
BIN
Artemis/Artemis/Resources/Keyboards/strafe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 230 KiB |
Binary file not shown.
@ -1,62 +1,62 @@
|
|||||||
# License
|
# License
|
||||||
|
|
||||||
Please carefully understand the license and download the latest icons at ModernUIIcons.com.
|
Please carefully understand the license and download the latest icons at ModernUIIcons.com.
|
||||||
|
|
||||||
## Understand Your Rights
|
## Understand Your Rights
|
||||||
No Attribution and No Derived Works
|
No Attribution and No Derived Works
|
||||||
http://creativecommons.org/licenses/by-nd/3.0/ *
|
http://creativecommons.org/licenses/by-nd/3.0/ *
|
||||||
|
|
||||||
- If your project is open source include this license file in the source.
|
- If your project is open source include this license file in the source.
|
||||||
- Nothing is needed in the front facing project (UNLESS you
|
- Nothing is needed in the front facing project (UNLESS you
|
||||||
are using any of the icons listed below in the attribution section).
|
are using any of the icons listed below in the attribution section).
|
||||||
- Commercial use is not only allowed but encouraged. If it is an icon
|
- Commercial use is not only allowed but encouraged. If it is an icon
|
||||||
in the attribution list below, you still need to attribute those!
|
in the attribution list below, you still need to attribute those!
|
||||||
- Do not distribute the entire package (I've allowed this dozens of
|
- Do not distribute the entire package (I've allowed this dozens of
|
||||||
times for open source projects, but email me first).
|
times for open source projects, but email me first).
|
||||||
|
|
||||||
## Creator
|
## Creator
|
||||||
- Austin Andrews (@templarian)
|
- Austin Andrews (@templarian)
|
||||||
|
|
||||||
## Contributor**
|
## Contributor**
|
||||||
- Jay Zawrotny (@JayZawrotny)
|
- Jay Zawrotny (@JayZawrotny)
|
||||||
- A Bunch
|
- A Bunch
|
||||||
- Oren Nachman
|
- Oren Nachman
|
||||||
- appbar.chevron.down
|
- appbar.chevron.down
|
||||||
- appbar.chevron.up
|
- appbar.chevron.up
|
||||||
- appbar.chevron.left
|
- appbar.chevron.left
|
||||||
- appbar.chevron.right
|
- appbar.chevron.right
|
||||||
|
|
||||||
## Derived Works
|
## Derived Works
|
||||||
- Alex Peattie
|
- Alex Peattie
|
||||||
- Social: http://www.alexpeattie.com/projects/justvector_icons/
|
- Social: http://www.alexpeattie.com/projects/justvector_icons/
|
||||||
|
|
||||||
## Attribution***
|
## Attribution***
|
||||||
- Kris Vandermotten (@kvandermotten)
|
- Kris Vandermotten (@kvandermotten)
|
||||||
- appbar.medical.pulse
|
- appbar.medical.pulse
|
||||||
- Constantin Kichinsky (@kichinsky)
|
- Constantin Kichinsky (@kichinsky)
|
||||||
- appbar.currency.rubles
|
- appbar.currency.rubles
|
||||||
- appbar.currency.grivna
|
- appbar.currency.grivna
|
||||||
- Massimo Savazzi (@msavazzi)
|
- Massimo Savazzi (@msavazzi)
|
||||||
- List of missing exported icons
|
- List of missing exported icons
|
||||||
- Proletkult Graphik, from The Noun Project
|
- Proletkult Graphik, from The Noun Project
|
||||||
- appbar.draw.pen (inspired)
|
- appbar.draw.pen (inspired)
|
||||||
- Olivier Guin, from The Noun Project
|
- Olivier Guin, from The Noun Project
|
||||||
- appbar.draw.marker
|
- appbar.draw.marker
|
||||||
- Gibran Bisio, from The Noun Project
|
- Gibran Bisio, from The Noun Project
|
||||||
- appbar.draw.bucket
|
- appbar.draw.bucket
|
||||||
Andrew Forrester, from The Noun Project
|
Andrew Forrester, from The Noun Project
|
||||||
- appbar.fingerprint
|
- appbar.fingerprint
|
||||||
|
|
||||||
* The license is for attribution, but this is not required.
|
* The license is for attribution, but this is not required.
|
||||||
** Developers and designers that emailed Templarian the source .design icons to be added into the package. PNGs also accepted, but may take longer to be added.
|
** Developers and designers that emailed Templarian the source .design icons to be added into the package. PNGs also accepted, but may take longer to be added.
|
||||||
*** Icons I've copied so closely you want to attribute them and are also under the CC license.
|
*** Icons I've copied so closely you want to attribute them and are also under the CC license.
|
||||||
|
|
||||||
Contact
|
Contact
|
||||||
- http://templarian.com/
|
- http://templarian.com/
|
||||||
- admin[@]templarian[.]com
|
- admin[@]templarian[.]com
|
||||||
|
|
||||||
* Does not apply to copyrighted logos
|
* Does not apply to copyrighted logos
|
||||||
- Skype
|
- Skype
|
||||||
- Facebook
|
- Facebook
|
||||||
- Twitter
|
- Twitter
|
||||||
- etc...
|
- etc...
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-16"?>
|
<?xml version="1.0" encoding="UTF-16"?>
|
||||||
<!-- Used by Artemis to get the active Sign -->
|
<!-- Used by Artemis to get the active Sign -->
|
||||||
<UserConfig>
|
<UserConfig>
|
||||||
<Group id="Artemis" displayName="Artemis">
|
<Group id="Artemis" displayName="Artemis">
|
||||||
<VisibleVars>
|
<VisibleVars>
|
||||||
<Var id="ActiveSign" displayName="ActiveSign" displayType="SLIDER:0:1:1000000"/>
|
<Var id="ActiveSign" displayName="ActiveSign" displayType="SLIDER:0:1:1000000"/>
|
||||||
</VisibleVars>
|
</VisibleVars>
|
||||||
</Group>
|
</Group>
|
||||||
</UserConfig>
|
</UserConfig>
|
||||||
BIN
Artemis/Artemis/Resources/folder.png
Normal file
BIN
Artemis/Artemis/Resources/folder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user