1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

Merge branch 'development'

This commit is contained in:
SpoinkyNL 2016-03-02 01:30:12 +01:00
commit edeffeda21
83 changed files with 2904 additions and 8213 deletions

View File

@ -1,93 +1,61 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}"
EndProject
Project("{6141683F-8A12-4E36-9623-2EB02B2C2303}") = "ArtemisSetup", "ArtemisSetup\ArtemisSetup.isproj", "{9E76B2E0-12AE-431D-8FA5-2233D6853F29}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CD_ROM|Any CPU = CD_ROM|Any CPU
CD_ROM|x64 = CD_ROM|x64
CD_ROM|x86 = CD_ROM|x86
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
DVD-5|Any CPU = DVD-5|Any CPU
DVD-5|x64 = DVD-5|x64
DVD-5|x86 = DVD-5|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
SingleImage|Any CPU = SingleImage|Any CPU
SingleImage|x64 = SingleImage|x64
SingleImage|x86 = SingleImage|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.ActiveCfg = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.Build.0 = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.ActiveCfg = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.Build.0 = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.ActiveCfg = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.Build.0 = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.ActiveCfg = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.Build.0 = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.ActiveCfg = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.Build.0 = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.ActiveCfg = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.Build.0 = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.Build.0 = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.ActiveCfg = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.Build.0 = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.ActiveCfg = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.Build.0 = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.Build.0 = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.ActiveCfg = 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.Build.0 = Release|x86
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|Any CPU.ActiveCfg = CD_ROM
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|Any CPU.Build.0 = CD_ROM
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x64.ActiveCfg = CD_ROM
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x64.Build.0 = CD_ROM
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x86.ActiveCfg = CD_ROM
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.CD_ROM|x86.Build.0 = CD_ROM
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|Any CPU.ActiveCfg = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|Any CPU.Build.0 = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x64.ActiveCfg = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x64.Build.0 = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x86.ActiveCfg = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Debug|x86.Build.0 = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|Any CPU.ActiveCfg = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|Any CPU.Build.0 = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x64.ActiveCfg = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x64.Build.0 = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x86.ActiveCfg = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.DVD-5|x86.Build.0 = DVD-5
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|Any CPU.ActiveCfg = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|Any CPU.Build.0 = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x64.ActiveCfg = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x64.Build.0 = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x86.ActiveCfg = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.Release|x86.Build.0 = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|Any CPU.ActiveCfg = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|Any CPU.Build.0 = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x64.ActiveCfg = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x64.Build.0 = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x86.ActiveCfg = SingleImage
{9E76B2E0-12AE-431D-8FA5-2233D6853F29}.SingleImage|x86.Build.0 = SingleImage
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CD_ROM|Any CPU = CD_ROM|Any CPU
CD_ROM|x64 = CD_ROM|x64
CD_ROM|x86 = CD_ROM|x86
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
DVD-5|Any CPU = DVD-5|Any CPU
DVD-5|x64 = DVD-5|x64
DVD-5|x86 = DVD-5|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
SingleImage|Any CPU = SingleImage|Any CPU
SingleImage|x64 = SingleImage|x64
SingleImage|x86 = SingleImage|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|Any CPU.Build.0 = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.ActiveCfg = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x64.Build.0 = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.ActiveCfg = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.CD_ROM|x86.Build.0 = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.ActiveCfg = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x64.Build.0 = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.ActiveCfg = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|x86.Build.0 = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|Any CPU.Build.0 = Debug|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.ActiveCfg = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x64.Build.0 = Debug|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.ActiveCfg = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.DVD-5|x86.Build.0 = Debug|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.Build.0 = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.ActiveCfg = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x64.Build.0 = Release|x64
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.ActiveCfg = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|x86.Build.0 = Release|x86
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|Any CPU.Build.0 = Release|Any CPU
{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.SingleImage|x64.ActiveCfg = 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.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -2,44 +2,19 @@
<configuration>
<configSections>
<sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.Offsets"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.Witcher3.Witcher3"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.CounterStrike"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.VolumeDisplay"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.AudioVisualization"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.RocketLeague"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.TypeWave"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.General"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.RocketLeague.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.Offsets" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.Witcher3.Witcher3" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Effects.AudioVisualizer.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Modules.Games.CounterStrike.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.CounterStrike" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.AudioVisualization" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.RocketLeague" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.TypeWave" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Artemis.Settings.General" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings />
@ -47,6 +22,17 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<userSettings>
<Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
<setting name="Enabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="MainColor" serializeAs="String">
<value>#FFFF2900</value>
</setting>
<setting name="SecondaryColor" serializeAs="String">
<value>#FF26F600</value>
</setting>
</Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay>
<Artemis.Modules.Games.RocketLeague.RocketLeague>
<setting name="Enabled" serializeAs="String">
<value>True</value>
@ -57,6 +43,9 @@
<setting name="SecondaryColor" serializeAs="String">
<value>#FFFF0000</value>
</setting>
<setting name="ContextualColor" serializeAs="String">
<value>False</value>
</setting>
</Artemis.Modules.Games.RocketLeague.RocketLeague>
<Artemis.Settings.Offsets>
<setting name="RocketLeague" serializeAs="String">
@ -95,6 +84,9 @@
</setting>
</Artemis.Modules.Effects.AudioVisualizer.AudioVisualization>
<Artemis.Modules.Games.CounterStrike.CounterStrike>
<setting name="Enabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="GameDirectory" serializeAs="String">
<value />
</setting>
@ -119,9 +111,6 @@
<setting name="LowHpEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="Enabled" serializeAs="String">
<value>True</value>
</setting>
</Artemis.Modules.Games.CounterStrike.CounterStrike>
<Artemis.Settings.CounterStrike>
<setting name="GameDirectory" serializeAs="String">
@ -149,17 +138,6 @@
<value>True</value>
</setting>
</Artemis.Settings.CounterStrike>
<Artemis.Settings.VolumeDisplay>
<setting name="MainColor" serializeAs="String">
<value>#FFFF2900</value>
</setting>
<setting name="SecondaryColor" serializeAs="String">
<value>#FF26F600</value>
</setting>
<setting name="Enabled" serializeAs="String">
<value>True</value>
</setting>
</Artemis.Settings.VolumeDisplay>
<Artemis.Settings.AudioVisualization>
<setting name="Sensitivity" serializeAs="String">
<value>4</value>
@ -221,7 +199,7 @@
<value>TypeWave</value>
</setting>
<setting name="LastKeyboard" serializeAs="String">
<value>Logitech G910 RGB</value>
<value />
</setting>
<setting name="EnablePointersUpdate" serializeAs="String">
<value>True</value>
@ -230,11 +208,17 @@
<value>51364</value>
</setting>
<setting name="Autorun" serializeAs="String">
<value>True</value>
<value>False</value>
</setting>
<setting name="Suspended" serializeAs="String">
<value>False</value>
</setting>
<setting name="ShowOnStartup" serializeAs="String">
<value>True</value>
</setting>
<setting name="CheckForUpdates" serializeAs="String">
<value>True</value>
</setting>
</Artemis.Settings.General>
</userSettings>
<runtime>

View File

@ -1,14 +1,14 @@
<Application x:Class="Artemis.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Artemis"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:artemis="clr-namespace:Artemis"
DispatcherUnhandledException="Application_DispatcherUnhandledException"
ShutdownMode="OnExplicitShutdown">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:ArtemisBootstrapper x:Key="ArtemisBootstrapper" />
<artemis:ArtemisBootstrapper x:Key="ArtemisBootstrapper" />
</ResourceDictionary>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />

View File

@ -25,7 +25,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>C:\Users\spoin\Desktop\Artemis builds\</PublishUrl>
<PublishUrl>C:\Users\Robert\Desktop\Artemis builds\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
@ -35,9 +35,13 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<SupportUrl>https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-%28FAQ%29</SupportUrl>
<ProductName>Artemis</ProductName>
<PublisherName>Artemis</PublisherName>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.0</ApplicationVersion>
<ApplicationVersion>1.0.2.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@ -74,7 +78,7 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon>
<ApplicationIcon>Resources\logo.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
@ -135,12 +139,8 @@
<HintPath>..\packages\Colore.4.0.0\lib\net35\Corale.Colore.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CUE.NET, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CUE.NET.1.0.2\lib\net45\CUE.NET.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Gma.System.MouseKeyHook, Version=5.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MouseKeyHook.5.4.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
<Reference Include="CUE.NET, Version=1.0.2.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CUE.NET.1.0.2.1\lib\net45\CUE.NET.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
@ -172,10 +172,7 @@
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.2.4.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
@ -189,6 +186,10 @@
<HintPath>..\packages\WpfExceptionViewer.1.0.0.0\lib\VioletTape.WpfExceptionViewer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="VirtualInput, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VirtualInput.1.0.1\lib\net20\VirtualInput.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@ -228,7 +229,7 @@
</Compile>
<Compile Include="ArtemisBootstrapper.cs" />
<Compile Include="Events\ToggleEnabled.cs" />
<Compile Include="Events\ChangeActiveEffect.cs" />
<Compile Include="Events\ActiveEffectChanged.cs" />
<Compile Include="Events\ChangeBitmap.cs" />
<Compile Include="KeyboardProviders\Corsair\CorsairRGB.cs" />
<Compile Include="KeyboardProviders\KeyboardProvider.cs" />
@ -241,8 +242,12 @@
<Compile Include="KeyboardProviders\ProviderHelper.cs" />
<Compile Include="KeyboardProviders\Razer\BlackWidow.cs" />
<Compile Include="KeyboardProviders\Razer\Utilities\RazerUtilities.cs" />
<Compile Include="Managers\EffectManager.cs" />
<Compile Include="Managers\KeyboardManager.cs" />
<Compile Include="Managers\MainManager.cs" />
<Compile Include="Models\EffectModel.cs" />
<Compile Include="Models\GamePointersCollectionModel.cs" />
<Compile Include="Models\EffectSettings.cs" />
<Compile Include="Models\GameSettings.cs" />
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.Designer.cs">
<DependentUpon>AudioVisualization.settings</DependentUpon>
<AutoGen>True</AutoGen>
@ -271,25 +276,23 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
<Compile Include="Modules\Games\Witcher3\RocketLeagueSettings.cs" />
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Witcher3.settings</DependentUpon>
</Compile>
<Compile Include="Modules\Games\Witcher3\Witcher3Model.cs" />
<Compile Include="Models\MainModel.cs" />
<Compile Include="Models\OverlayModel.cs" />
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.cs" />
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.Designer.cs">
<DependentUpon>VolumeDisplay.settings</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>VolumeDisplay.settings</DependentUpon>
</Compile>
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayModel.cs" />
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerSettings.cs" />
<Compile Include="Modules\Effects\Debug\DebugEffectSettings.cs" />
<Compile Include="Models\EffectSettings.cs" />
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplaySettings.cs" />
<Compile Include="Modules\Games\RocketLeague\RocketLeagueSettings.cs" />
<Compile Include="Modules\Effects\TypeWave\TypeWaveSettings.cs" />
@ -299,6 +302,8 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Services\DialogService.cs" />
<Compile Include="Services\MetroDialogService.cs" />
<Compile Include="Settings\General.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
@ -317,12 +322,16 @@
<Compile Include="Utilities\GameState\GameStateWebServer.cs" />
<Compile Include="Utilities\ImageUtilities.cs" />
<Compile Include="Utilities\Keyboard\KeyboardHook.cs" />
<Compile Include="Utilities\Memory\GamePointer.cs" />
<Compile Include="Utilities\Memory\Memory.cs" />
<Compile Include="Utilities\Memory\MemoryHelpers.cs" />
<Compile Include="Utilities\Memory\Win32.cs" />
<Compile Include="Utilities\Keyboard\Key.cs" />
<Compile Include="Utilities\Keyboard\KeyboardRectangle.cs" />
<Compile Include="Utilities\ShellLink.cs" />
<Compile Include="Utilities\Updater.cs" />
<Compile Include="ViewModels\Abstract\EffectViewModel.cs" />
<Compile Include="ViewModels\Abstract\GameViewModel.cs" />
<Compile Include="ViewModels\EffectsViewModel.cs" />
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerViewModel.cs" />
<Compile Include="Modules\Effects\Debug\DebugEffectViewModel.cs" />
@ -426,9 +435,13 @@
<Resource Include="Resources\bow.png" />
<Resource Include="Resources\WindowsIcons-license.txt" />
<Resource Include="Resources\Entypo-license.txt" />
<Content Include="logo.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\logo.ico" />
<Resource Include="Resources\logo-disabled.ico" />
<Content Include="Resources\Witcher3\playerWitcher.txt" />
<Content Include="Resources\Witcher3\artemis.txt" />
<Resource Include="logo-disabled.ico" />
<Resource Include="Resources\Entypo.ttf" />
<None Include="Settings\Offsets.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -519,9 +532,6 @@
<Content Include="RzChromaSDK64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="logo.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Content Include="Resources\CounterStrike\gamestateConfiguration.txt" />
</ItemGroup>
<ItemGroup>
@ -537,12 +547,12 @@
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\CUE.NET.1.0.2\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.0.2\build\net45\CUE.NET.targets')" />
<Import Project="..\packages\CUE.NET.1.0.2.1\build\net45\CUE.NET.targets" Condition="Exists('..\packages\CUE.NET.1.0.2.1\build\net45\CUE.NET.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\CUE.NET.1.0.2\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.0.2\build\net45\CUE.NET.targets'))" />
<Error Condition="!Exists('..\packages\CUE.NET.1.0.2.1\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CUE.NET.1.0.2.1\build\net45\CUE.NET.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,8 +1,8 @@
namespace Artemis.Events
{
public class ChangeActiveEffect
public class ActiveEffectChanged
{
public ChangeActiveEffect(string activeEffect)
public ActiveEffectChanged(string activeEffect)
{
ActiveEffect = activeEffect;
}

View File

@ -16,8 +16,8 @@ namespace Artemis.KeyboardProviders.Corsair
public CorsairRGB()
{
Name = "Corsair RGB Keyboards";
CantEnableText = "Couldn't connect to your Corsair keyboard.\n " +
"Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " +
CantEnableText = "Couldn't connect to your Corsair keyboard.\n" +
"Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n" +
"If needed, you can select a different keyboard in Artemis under settings.";
KeyboardRegions = new List<KeyboardRegion>();
}

View File

@ -4,15 +4,15 @@ namespace Artemis.KeyboardProviders
{
public class KeyboardRegion
{
public string RegionName { get; set; }
public Point TopLeft { get; set; }
public Point BottomRight { get; set; }
public KeyboardRegion(string regionName, Point topLeft, Point bottomRight)
{
RegionName = regionName;
TopLeft = topLeft;
BottomRight = bottomRight;
}
public string RegionName { get; set; }
public Point TopLeft { get; set; }
public Point BottomRight { get; set; }
}
}

View File

@ -1,52 +1,62 @@
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using Artemis.KeyboardProviders.Logitech.Utilities;
namespace Artemis.KeyboardProviders.Logitech
{
internal class Orion : KeyboardProvider
{
public Orion()
{
Name = "Logitech G910 RGB";
CantEnableText = "Couldn't connect to your Logitech G910.\n " +
"Please check your cables and updating the Logitech Gaming Software.\n\n " +
"If needed, you can select a different keyboard in Artemis under settings.";
Height = 6;
Width = 21;
KeyboardRegions = new List<KeyboardRegion> {new KeyboardRegion("TopRow", new Point(0, 0), new Point(0, 16))};
}
public override bool CanEnable()
{
// TODO
return true;
}
public override void Enable()
{
// Initialize the SDK
LogitechGSDK.LogiLedInit();
Thread.Sleep(200);
LogitechGSDK.LogiLedSaveCurrentLighting();
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
// Disable keys we can't color
LogitechGSDK.LogiLedSetLighting(0, 0, 0);
}
public override void Disable()
{
// Shutdown the SDK
LogitechGSDK.LogiLedRestoreLighting();
LogitechGSDK.LogiLedShutdown();
}
public override void DrawBitmap(Bitmap bitmap)
{
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
}
}
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using Artemis.KeyboardProviders.Logitech.Utilities;
namespace Artemis.KeyboardProviders.Logitech
{
internal class Orion : KeyboardProvider
{
public Orion()
{
Name = "Logitech G910 RGB";
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).\n\n " +
"If needed, you can select a different keyboard in Artemis under settings.";
Height = 6;
Width = 21;
KeyboardRegions = new List<KeyboardRegion> {new KeyboardRegion("TopRow", new Point(0, 0), new Point(0, 16))};
}
public override bool CanEnable()
{
int majorNum = 0, minorNum = 0, buildNum = 0;
LogitechGSDK.LogiLedInit();
LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(KeyboardNames.A, 100, 100, 100);
LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
LogitechGSDK.LogiLedRestoreLighting();
LogitechGSDK.LogiLedShutdown();
// Turn it into one long number...
var version = int.Parse($"{majorNum}{minorNum}{buildNum}");
return version >= 88115;
}
public override void Enable()
{
// Initialize the SDK
LogitechGSDK.LogiLedInit();
Thread.Sleep(200);
LogitechGSDK.LogiLedSaveCurrentLighting();
LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
// Disable keys we can't color
LogitechGSDK.LogiLedSetLighting(0, 0, 0);
}
public override void Disable()
{
// Shutdown the SDK
LogitechGSDK.LogiLedRestoreLighting();
LogitechGSDK.LogiLedShutdown();
}
public override void DrawBitmap(Bitmap bitmap)
{
LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
}
}
}

View File

@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Events;
using Artemis.Models;
using Artemis.Settings;
using Caliburn.Micro;
namespace Artemis.Managers
{
public class EffectManager
{
private readonly IEventAggregator _events;
private readonly MainManager _mainManager;
private bool _clearing;
private EffectModel _pauseEffect;
public EffectManager(MainManager mainManager, IEventAggregator events)
{
_mainManager = mainManager;
_events = events;
EffectModels = new List<EffectModel>();
}
public List<EffectModel> EffectModels { get; set; }
public EffectModel ActiveEffect { get; private set; }
public IEnumerable<OverlayModel> EnabledOverlays
{
get { return EffectModels.OfType<OverlayModel>().Where(o => o.Enabled); }
}
public IEnumerable<GameModel> EnabledGames
{
get { return EffectModels.OfType<GameModel>().Where(g => g.Enabled); }
}
/// <summary>
/// Loads the last active effect from settings and enables it.
/// </summary>
/// <returns>Whether enabling was successful or not.</returns>
public EffectModel GetLastEffect()
{
if (General.Default.LastEffect == null)
return null;
var effect = EffectModels.FirstOrDefault(e => e.Name == General.Default.LastEffect);
// Fall back to the first effect found, in case settings are messed up
return effect ?? EffectModels.First();
}
/// <summary>
/// Disables the current effect and changes it to the provided effect.
/// </summary>
/// <param name="effectModel"></param>
/// <param name="force">Changes the effect, even if it's already running (effectively restarting it)</param>
public void ChangeEffect(EffectModel effectModel, bool force = false)
{
if (effectModel is OverlayModel)
throw new ArgumentException("Can't set an Overlay effect as the active effect");
// Game models are only used if they are enabled
var gameModel = effectModel as GameModel;
if (gameModel != null)
if (!gameModel.Enabled)
return;
if (ActiveEffect != null)
if (effectModel.Name == ActiveEffect.Name && !force)
return;
// If the main manager is running, pause it and safely change the effect
if (_mainManager.Running)
{
ChangeEffectWithPause(effectModel);
return;
}
// If it's not running start it, and let the next recursion handle changing the effect
_mainManager.Start(effectModel);
}
private void ChangeEffectWithPause(EffectModel effectModel)
{
if (_pauseEffect != null)
return;
_pauseEffect = effectModel;
_mainManager.Pause();
_mainManager.PauseCallback += ChangeEffectPauseCallback;
}
private void ChangeEffectPauseCallback()
{
// Change effect logic
ActiveEffect?.Dispose();
ActiveEffect = _pauseEffect;
ActiveEffect.Enable();
// Let the ViewModels know
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
_mainManager.Unpause();
_pauseEffect = null;
if (ActiveEffect is GameModel)
return;
// Non-game effects are stored as the new LastEffect.
General.Default.LastEffect = ActiveEffect.Name;
General.Default.Save();
}
/// <summary>
/// Clears the current effect
/// </summary>
public void ClearEffect()
{
if (_clearing)
return;
// Don't mess with the ActiveEffect if in the process of changing the effect.
if (_pauseEffect != null)
return;
if (ActiveEffect == null)
return;
_clearing = true;
_mainManager.Pause();
_mainManager.PauseCallback += ClearEffectPauseCallback;
}
private void ClearEffectPauseCallback()
{
ActiveEffect.Dispose();
ActiveEffect = null;
General.Default.LastEffect = null;
General.Default.Save();
_events.PublishOnUIThread(new ActiveEffectChanged(""));
_clearing = false;
_mainManager.Unpause();
}
/// <summary>
/// Disables the given game
/// </summary>
/// <param name="activeEffect"></param>
public void DisableGame(EffectModel activeEffect)
{
if (GetLastEffect() == null)
ClearEffect();
else
ChangeEffect(GetLastEffect());
}
/// <summary>
/// Disables the current ActiveEffect if it's a game that is disabled.
/// </summary>
public void DisableInactiveGame()
{
if (!(ActiveEffect is GameModel))
return;
if (EnabledGames.Contains(ActiveEffect))
return;
DisableGame(ActiveEffect);
}
}
}

View File

@ -0,0 +1,92 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Artemis.KeyboardProviders;
using Artemis.Settings;
namespace Artemis.Managers
{
public class KeyboardManager
{
private readonly MainManager _mainManager;
public KeyboardManager(MainManager mainManager)
{
_mainManager = mainManager;
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
}
public List<KeyboardProvider> KeyboardProviders { get; set; }
public KeyboardProvider ActiveKeyboard { get; set; }
/// <summary>
/// Enables the last keyboard according to the settings file
/// </summary>
public void EnableLastKeyboard()
{
if (General.Default.LastKeyboard == null)
return;
if (General.Default.LastKeyboard == "")
return;
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
EnableKeyboard(keyboard);
}
/// <summary>
/// Enables the given keyboard
/// </summary>
/// <param name="keyboardProvider"></param>
public void EnableKeyboard(KeyboardProvider keyboardProvider)
{
ReleaseActiveKeyboard();
if (keyboardProvider == null)
return;
if (ActiveKeyboard != null)
if (keyboardProvider.Name == ActiveKeyboard.Name)
return;
// Disable everything if there's no active keyboard found
if (!keyboardProvider.CanEnable())
{
_mainManager.DialogService.ShowErrorMessageBox(keyboardProvider.CantEnableText);
return;
}
ActiveKeyboard = keyboardProvider;
ActiveKeyboard.Enable();
General.Default.LastKeyboard = ActiveKeyboard.Name;
General.Default.Save();
}
/// <summary>
/// Releases the active keyboard
/// </summary>
public void ReleaseActiveKeyboard()
{
if (ActiveKeyboard == null)
return;
ActiveKeyboard.Disable();
ActiveKeyboard = null;
}
/// <summary>
/// Changes the active keyboard
/// </summary>
/// <param name="keyboardProvider"></param>
public void ChangeKeyboard(KeyboardProvider keyboardProvider)
{
if (keyboardProvider == ActiveKeyboard)
return;
General.Default.LastKeyboard = keyboardProvider?.Name;
General.Default.Save();
_mainManager.Restart();
}
}
}

View File

@ -0,0 +1,298 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Artemis.Events;
using Artemis.Models;
using Artemis.Services;
using Artemis.Utilities.GameState;
using Artemis.Utilities.Keyboard;
using Caliburn.Micro;
namespace Artemis.Managers
{
public class MainManager
{
public delegate void PauseCallbackHandler();
private readonly int _fps;
private bool _paused;
private bool _restarting;
public MainManager(IEventAggregator events, MetroDialogService dialogService)
{
Events = events;
DialogService = dialogService;
KeyboardManager = new KeyboardManager(this);
EffectManager = new EffectManager(this, Events);
KeyboardHook = new KeyboardHook();
_fps = 25;
UpdateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
ProcessWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
UpdateWorker.DoWork += UpdateWorker_DoWork;
UpdateWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher;
ProcessWorker.DoWork += ProcessWorker_DoWork;
ProcessWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher;
// Process worker will always run (and just do nothing when ProgramEnabled is false)
ProcessWorker.RunWorkerAsync();
ProgramEnabled = false;
Running = false;
// Create and start the web server
GameStateWebServer = new GameStateWebServer();
GameStateWebServer.Start();
}
public BackgroundWorker UpdateWorker { get; set; }
public BackgroundWorker ProcessWorker { get; set; }
public KeyboardManager KeyboardManager { get; set; }
public EffectManager EffectManager { get; set; }
public KeyboardHook KeyboardHook { get; set; }
public GameStateWebServer GameStateWebServer { get; set; }
public IEventAggregator Events { get; set; }
public MetroDialogService DialogService { get; set; }
public bool ProgramEnabled { get; private set; }
public bool Suspended { get; set; }
public bool Running { get; private set; }
public event PauseCallbackHandler PauseCallback;
/// <summary>
/// Take control of the keyboard and start sending data to it
/// </summary>
/// <returns>Whether starting was successful or not</returns>
public bool Start(EffectModel effect = null)
{
// Can't take control when not enabled
if (!ProgramEnabled || UpdateWorker.CancellationPending || UpdateWorker.IsBusy || _paused)
return false;
// Do nothing if already running
if (Running)
return true;
// Only continue if a keyboard was loaded
KeyboardManager.EnableLastKeyboard();
if (KeyboardManager.ActiveKeyboard == null)
return false;
Running = true;
if (effect != null)
EffectManager.ChangeEffect(effect);
// Start the update worker
if (!UpdateWorker.IsBusy)
UpdateWorker.RunWorkerAsync();
return Running;
}
/// <summary>
/// Releases control of the keyboard and stop sending data to it
/// </summary>
public void Stop()
{
if (!Running || UpdateWorker.CancellationPending || _paused)
return;
// Stop the update worker
UpdateWorker.CancelAsync();
UpdateWorker.RunWorkerCompleted += FinishStop;
}
private void FinishStop(object sender, RunWorkerCompletedEventArgs e)
{
KeyboardManager.ReleaseActiveKeyboard();
Running = false;
}
public void Pause()
{
if (!Running || UpdateWorker.CancellationPending || _paused)
return;
_paused = true;
}
public void Unpause()
{
if (!_paused)
return;
_paused = false;
PauseCallback = null;
}
public void Shutdown()
{
Stop();
ProcessWorker.CancelAsync();
GameStateWebServer.Stop();
}
public void Restart()
{
if (_restarting)
return;
if (!Running)
{
Start();
return;
}
_restarting = true;
UpdateWorker.RunWorkerCompleted += FinishRestart;
Stop();
}
public void FinishRestart(object sender, RunWorkerCompletedEventArgs e)
{
UpdateWorker.RunWorkerCompleted -= FinishRestart;
if (e.Error != null)
return;
Start();
_restarting = false;
}
/// <summary>
/// Loads the last active effect and starts the program
/// </summary>
public void EnableProgram()
{
ProgramEnabled = true;
Start(EffectManager.GetLastEffect());
Events.PublishOnUIThread(new ToggleEnabled(ProgramEnabled));
}
/// <summary>
/// Stops the program
/// </summary>
public void DisableProgram()
{
Stop();
ProgramEnabled = false;
Events.PublishOnUIThread(new ToggleEnabled(ProgramEnabled));
}
#region Workers
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e)
{
var sw = new Stopwatch();
while (!UpdateWorker.CancellationPending)
{
// Skip frame when paused
if (_paused)
{
PauseCallback?.Invoke();
Thread.Sleep(1000/_fps);
continue;
}
// Stop if no keyboard/effect are present
if (KeyboardManager.ActiveKeyboard == null || EffectManager.ActiveEffect == null)
{
Thread.Sleep(1000/_fps);
Stop();
continue;
}
// Don't stop when the effect is still initialized, just skip this frame
if (!EffectManager.ActiveEffect.Initialized)
{
Thread.Sleep(1000/_fps);
continue;
}
sw.Start();
// Update the current effect
if (EffectManager.ActiveEffect.Initialized)
EffectManager.ActiveEffect.Update();
// Get ActiveEffect's bitmap
var bitmap = EffectManager.ActiveEffect.Initialized
? EffectManager.ActiveEffect.GenerateBitmap()
: null;
// Draw enabled overlays on top
foreach (var overlayModel in EffectManager.EnabledOverlays)
{
overlayModel.Update();
bitmap = bitmap != null ? overlayModel.GenerateBitmap(bitmap) : overlayModel.GenerateBitmap();
}
// If it exists, send bitmap to the device
if (bitmap != null && KeyboardManager.ActiveKeyboard != null)
{
KeyboardManager.ActiveKeyboard.DrawBitmap(bitmap);
// debugging TODO: Disable when window isn't shown
Events.PublishOnUIThread(new ChangeBitmap(bitmap));
}
// Sleep according to time left this frame
var sleep = (int) (1000/_fps - sw.ElapsedMilliseconds);
if (sleep > 0)
Thread.Sleep(sleep);
sw.Reset();
}
}
private void BackgroundWorkerExceptionCatcher(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
throw e.Error;
}
private void ProcessWorker_DoWork(object sender, DoWorkEventArgs e)
{
while (!ProcessWorker.CancellationPending)
{
if (!ProgramEnabled)
{
Thread.Sleep(1000);
continue;
}
var runningProcesses = Process.GetProcesses();
// If the currently active effect is a disabled game, get rid of it.
if (EffectManager.ActiveEffect != null)
EffectManager.DisableInactiveGame();
// If the currently active effect is a no longer running game, get rid of it.
var activeGame = EffectManager.ActiveEffect as GameModel;
if (activeGame != null)
if (runningProcesses.All(p => p.ProcessName != activeGame.ProcessName))
EffectManager.DisableGame(activeGame);
// Look for running games, stopping on the first one that's found.
var newGame = EffectManager.EnabledGames
.FirstOrDefault(g => runningProcesses.Any(p => p.ProcessName == g.ProcessName));
// If it's not already enabled, do so.
if (newGame != null && EffectManager.ActiveEffect != newGame)
EffectManager.ChangeEffect(newGame);
Thread.Sleep(1000);
}
}
#endregion
}
}

View File

@ -1,31 +1,32 @@
using System;
using System.Drawing;
namespace Artemis.Models
{
public abstract class EffectModel : IDisposable
{
public delegate void SettingsUpdateHandler(EffectSettings settings);
public MainModel MainModel;
public string Name;
protected EffectModel(MainModel mainModel)
{
MainModel = mainModel;
}
public abstract void Dispose();
public event SettingsUpdateHandler SettingsUpdateEvent;
// Called on creation
public abstract void Enable();
// Called every iteration
public abstract void Update();
// Called after every update
public abstract Bitmap GenerateBitmap();
}
using System;
using System.Drawing;
using Artemis.Managers;
namespace Artemis.Models
{
public abstract class EffectModel : IDisposable
{
public delegate void SettingsUpdateHandler(EffectSettings settings);
public bool Initialized;
public MainManager MainManager;
public string Name;
protected EffectModel(MainManager mainManager)
{
MainManager = mainManager;
}
public abstract void Dispose();
// Called on creation
public abstract void Enable();
// Called every iteration
public abstract void Update();
// Called after every update
public abstract Bitmap GenerateBitmap();
}
}

View File

@ -1,11 +1,13 @@
namespace Artemis.Models
using Artemis.Managers;
namespace Artemis.Models
{
public abstract class GameModel : EffectModel
{
public bool Enabled;
public string ProcessName;
protected GameModel(MainModel mainModel) : base(mainModel)
protected GameModel(MainManager mainManager) : base(mainManager)
{
}
}

View File

@ -0,0 +1,7 @@
namespace Artemis.Models
{
public abstract class GameSettings : EffectSettings
{
public bool Enabled { get; set; }
}
}

View File

@ -1,314 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using Artemis.Events;
using Artemis.KeyboardProviders;
using Artemis.Settings;
using Artemis.Utilities.GameState;
using Artemis.Utilities.Keyboard;
using Artemis.Utilities.Memory;
using Caliburn.Micro;
namespace Artemis.Models
{
public class MainModel
{
private readonly int _fps;
private readonly BackgroundWorker _processWorker;
private readonly BackgroundWorker _updateWorker;
private EffectModel _activeEffect;
private bool _wasSuspendedBeforeGame;
public MainModel(IEventAggregator events)
{
EffectModels = new List<EffectModel>();
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
GameStateWebServer = new GameStateWebServer();
KeyboardHook = new KeyboardHook();
Suspended = false;
Events = events;
_fps = 25;
_updateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
_processWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
_updateWorker.DoWork += UpdateWorker_DoWork;
_processWorker.DoWork += ProcessWorker_DoWork;
}
public KeyboardHook KeyboardHook { get; set; }
public KeyboardProvider ActiveKeyboard { get; set; }
public List<EffectModel> EffectModels { get; set; }
public List<KeyboardProvider> KeyboardProviders { get; set; }
public GameStateWebServer GameStateWebServer { get; set; }
public IEventAggregator Events { get; set; }
public bool Enabled { get; private set; }
public bool Suspended { get; private set; }
#region Effect methods
public void StartEffects()
{
if (Enabled)
return;
if (_updateWorker.IsBusy || _processWorker.IsBusy)
{
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
return;
}
LoadLastKeyboard();
// If no keyboard was loaded, don't enable effects.
if (ActiveKeyboard == null)
return;
// Start the webserver
GameStateWebServer.Start();
// Load last non-game effect and enable
LoadLastEffect();
// Start the Background Workers
_updateWorker.RunWorkerAsync();
_processWorker.RunWorkerAsync();
Enabled = true;
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
if (General.Default.Suspended && !Suspended)
ToggleSuspension();
}
public void ShutdownEffects()
{
if (!Enabled)
return;
// Stop the Background Worker
_updateWorker.CancelAsync();
_processWorker.CancelAsync();
// Dispose the current active effect
_activeEffect?.Dispose();
_activeEffect = null;
ActiveKeyboard?.Disable();
ActiveKeyboard = null;
Enabled = false;
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
}
private void LoadLastEffect()
{
var effect = EffectModels.FirstOrDefault(e => e.Name == General.Default.LastEffect);
ChangeEffect(effect ?? EffectModels.First(e => e.Name == "TypeWave"));
}
private void ChangeEffect(EffectModel effectModel)
{
if (effectModel is OverlayModel)
throw new ArgumentException("Can't set an Overlay effect as the active effect");
// Game models are only used if they are enabled
var gameModel = effectModel as GameModel;
if (gameModel != null)
if (!gameModel.Enabled)
return;
if (_activeEffect != null && effectModel.Name == _activeEffect.Name)
return;
_activeEffect?.Dispose();
// If needed, unsuspend when loading a new effect
if (Suspended)
{
_wasSuspendedBeforeGame = true;
ToggleSuspension();
}
_activeEffect = effectModel;
_activeEffect.Enable();
if (_activeEffect is GameModel)
return;
// Non-game effects are stored as the new LastEffect.
General.Default.LastEffect = _activeEffect.Name;
General.Default.Save();
// Let the ViewModels know
Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect.Name));
}
public void EnableEffect(EffectModel effectModel)
{
if (effectModel is GameModel || effectModel is OverlayModel)
return;
ChangeEffect(effectModel);
}
public void ToggleSuspension()
{
if (Suspended)
{
LoadLastKeyboard();
Suspended = false;
General.Default.Suspended = false;
General.Default.Save();
Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect?.Name));
return;
}
Suspended = true;
General.Default.Suspended = true;
General.Default.Save();
ActiveKeyboard?.Disable();
ActiveKeyboard = null;
Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect?.Name));
}
public bool IsEnabled(EffectModel effectModel)
{
if (Suspended)
return false;
if (effectModel is GameModel)
return false;
return General.Default.LastEffect == effectModel.Name;
}
#endregion
#region Keyboard methods
private void LoadLastKeyboard()
{
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
ChangeKeyboard(keyboard ?? KeyboardProviders.First());
}
public void ChangeKeyboard(KeyboardProvider keyboardProvider)
{
if (ActiveKeyboard != null && keyboardProvider.Name == ActiveKeyboard.Name)
return;
ActiveKeyboard?.Disable();
// Disable everything if there's no active keyboard found
if (!keyboardProvider.CanEnable())
{
ActiveKeyboard = null;
MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
ShutdownEffects();
return;
}
ActiveKeyboard = keyboardProvider;
ActiveKeyboard.Enable();
General.Default.LastKeyboard = ActiveKeyboard.Name;
General.Default.Save();
}
#endregion
#region Workers
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e)
{
var sw = new Stopwatch();
while (!_updateWorker.CancellationPending)
{
if (ActiveKeyboard == null || Suspended || _activeEffect == null)
{
Thread.Sleep(1000/_fps);
continue;
}
sw.Start();
// Update the current effect
_activeEffect.Update();
// Get ActiveEffect's bitmap
var bitmap = _activeEffect.GenerateBitmap();
// Draw enabled overlays on top
foreach (var overlayModel in EffectModels.OfType<OverlayModel>()
.Where(overlayModel => overlayModel.Enabled))
{
overlayModel.Update();
bitmap = bitmap != null ? overlayModel.GenerateBitmap(bitmap) : overlayModel.GenerateBitmap();
}
// If it exists, send bitmap to the device
if (bitmap != null && ActiveKeyboard != null)
{
ActiveKeyboard.DrawBitmap(bitmap);
// debugging TODO: Disable when window isn't shown
Events.PublishOnUIThread(new ChangeBitmap(bitmap));
}
// Sleep according to time left this frame
var sleep = (int) (1000/_fps - sw.ElapsedMilliseconds);
if (sleep > 0)
Thread.Sleep(sleep);
sw.Reset();
}
}
private void ProcessWorker_DoWork(object sender, DoWorkEventArgs e)
{
while (!_processWorker.CancellationPending)
{
var foundProcess = false;
// ReSharper disable once LoopCanBePartlyConvertedToQuery
foreach (var effectModel in EffectModels.OfType<GameModel>())
{
var process = MemoryHelpers.GetProcessIfRunning(effectModel.ProcessName);
if (process == null)
continue;
if (process.HasExited)
continue;
// If the active effect is a disabled game model, disable it
var model = _activeEffect as GameModel;
if (model != null && !model.Enabled)
LoadLastEffect();
else
{
ChangeEffect(effectModel);
foundProcess = true;
}
}
// If no game process is found, but the active effect still belongs to a game,
// set it to a normal effect, and if needed, suspend again.
if (!foundProcess && _activeEffect is GameModel)
{
LoadLastEffect();
if (_wasSuspendedBeforeGame)
{
ToggleSuspension();
_wasSuspendedBeforeGame = false;
}
}
Thread.Sleep(1000);
}
}
#endregion
}
}

View File

@ -1,4 +1,5 @@
using System.Drawing;
using Artemis.Managers;
namespace Artemis.Models
{
@ -7,11 +8,10 @@ namespace Artemis.Models
private bool _enabled;
public string ProcessName;
protected OverlayModel(MainModel mainModel) : base(mainModel)
protected OverlayModel(MainManager mainManager) : base(mainManager)
{
}
// Overlay Enabled() and Dispose() is called when changing the Enabled value
public bool Enabled
{
get { return _enabled; }

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Utilities;
using Artemis.Utilities.Audio;
@ -16,16 +17,19 @@ namespace Artemis.Modules.Effects.AudioVisualizer
{
private const int FftLength = 2048;
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
private bool _fromBottom;
private bool _generating;
private int _sensitivity;
private IWaveIn _waveIn;
public AudioVisualizerModel(MainModel mainModel, AudioVisualizerSettings settings) : base(mainModel)
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
{
Settings = settings;
Name = "Audiovisualizer";
DeviceIds = new List<string>();
SpectrumData = new List<byte>();
Scale = 4;
Initialized = false;
}
public int Lines { get; set; }
@ -41,6 +45,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
public override void Dispose()
{
Initialized = false;
_sampleAggregator.PerformFFT = false;
_sampleAggregator.FftCalculated -= FftCalculated;
@ -51,18 +56,20 @@ namespace Artemis.Modules.Effects.AudioVisualizer
public override void Enable()
{
Lines = MainModel.ActiveKeyboard.Width;
Initialized = false;
Lines = MainManager.KeyboardManager.ActiveKeyboard.Width;
// TODO: Device selection
SelectedDeviceId = new MMDeviceEnumerator()
.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active)
.FirstOrDefault()?.ID;
// Apply settings
SoundRectangles = new List<KeyboardRectangle>();
for (var i = 0; i < Lines; i++)
{
SoundRectangles.Add(new KeyboardRectangle(
MainModel.ActiveKeyboard,
MainManager.KeyboardManager.ActiveKeyboard,
0, 0, new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.TopColor),
@ -71,13 +78,17 @@ namespace Artemis.Modules.Effects.AudioVisualizer
},
LinearGradientMode.Vertical) {ContainedBrush = false, Height = 0});
}
_sensitivity = Settings.Sensitivity;
_fromBottom = Settings.FromBottom;
_sampleAggregator.FftCalculated += FftCalculated;
_sampleAggregator.PerformFFT = true;
// Start listening for sound data
_waveIn = new WasapiLoopbackCapture();
_waveIn.DataAvailable += OnDataAvailable;
_waveIn.StartRecording();
Initialized = true;
}
public override void Update()
@ -107,8 +118,9 @@ namespace Artemis.Modules.Effects.AudioVisualizer
height = (int) Math.Round(SpectrumData[i]/2.55);
// Apply Sensitivity setting
height = height*Settings.Sensitivity;
var keyboardHeight = (int) Math.Round(MainModel.ActiveKeyboard.Height/100.00*height*Scale);
height = height*_sensitivity;
var keyboardHeight =
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
if (keyboardHeight > SoundRectangles[i].Height)
SoundRectangles[i].Height = keyboardHeight;
else
@ -117,8 +129,9 @@ namespace Artemis.Modules.Effects.AudioVisualizer
SoundRectangles[i].X = i*Scale;
SoundRectangles[i].Width = Scale;
if (Settings.FromBottom)
SoundRectangles[i].Y = MainModel.ActiveKeyboard.Height*Scale - SoundRectangles[i].Height;
if (_fromBottom)
SoundRectangles[i].Y = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale -
SoundRectangles[i].Height;
}
_generating = false;
}
@ -131,7 +144,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
// Lock the _spectrumData array while busy with it
_generating = true;
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
using (var g = Graphics.FromImage(bitmap))
{
foreach (var soundRectangle in SoundRectangles)

View File

@ -37,17 +37,17 @@
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
ToolTip="Note: You can't enable an effect when Artemis is disabled" />
</StackPanel>
</StackPanel>
<!-- Top color -->
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
Height="16" Margin="0,8">
Color used on top
</TextBlock>
<xctk:ColorPicker x:Name="TopColor"
SelectedColor="{Binding Path=AudioVisualizerSettings.TopColor, Mode=TwoWay}"
SelectedColor="{Binding Path=EffectSettings.TopColor, Mode=TwoWay}"
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -57,7 +57,7 @@
Color used in the middle
</TextBlock>
<xctk:ColorPicker x:Name="MiddleColor"
SelectedColor="{Binding Path=AudioVisualizerSettings.MiddleColor, Mode=TwoWay}"
SelectedColor="{Binding Path=EffectSettings.MiddleColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -67,19 +67,18 @@
Color used on the bottom
</TextBlock>
<xctk:ColorPicker x:Name="Bottom"
SelectedColor="{Binding Path=AudioVisualizerSettings.BottomColor, Mode=TwoWay}"
SelectedColor="{Binding Path=EffectSettings.BottomColor, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
<!-- Bar direction -->
<TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
Height="16" Margin="0,9,0,10">
Grow bars bottom (broken, sorry!)
Grow bars bottom
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=AudioVisualizerSettings.FromBottom, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.FromBottom, Mode=TwoWay}"
Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
OffLabel="No"
Margin="0,0,-5,0" Width="114" IsEnabled="False" />
OffLabel="No" Margin="0,0,-5,0" Width="114" />
<!-- Bars amount -->
<TextBlock Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
@ -88,7 +87,7 @@
</TextBlock>
<Slider x:Name="Bars" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
Value="{Binding Path=AudioVisualizerSettings.Bars, Mode=TwoWay}" Minimum="2" Maximum="21"
Value="{Binding Path=EffectSettings.Bars, Mode=TwoWay}" Minimum="2" Maximum="21"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Sensitivity -->
@ -98,7 +97,7 @@
</TextBlock>
<Slider x:Name="Sensitivity" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
Value="{Binding Path=AudioVisualizerSettings.Sensitivity, Mode=TwoWay}" Minimum="1" Maximum="10"
Value="{Binding Path=EffectSettings.Sensitivity, Mode=TwoWay}" Minimum="1" Maximum="10"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Fade speed -->
@ -108,7 +107,7 @@
</TextBlock>
<Slider x:Name="FadeSpeed" Grid.Row="7" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
Value="{Binding Path=AudioVisualizerSettings.FadeSpeed, Mode=TwoWay}" Minimum="1" Maximum="3"
Value="{Binding Path=EffectSettings.FadeSpeed, Mode=TwoWay}" Minimum="1" Maximum="3"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Buttons -->

View File

@ -1,74 +1,31 @@
using Artemis.Events;
using Artemis.Models;
using Artemis.Managers;
using Artemis.ViewModels.Abstract;
using Caliburn.Micro;
namespace Artemis.Modules.Effects.AudioVisualizer
{
public class AudioVisualizerViewModel : Screen, IHandle<ChangeActiveEffect>
public class AudioVisualizerViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
{
private AudioVisualizerSettings _audioVisualizerSettings;
public AudioVisualizerViewModel(MainModel mainModel)
public AudioVisualizerViewModel(MainManager mainManager)
{
// Subscribe to main model
MainModel = mainModel;
MainModel.Events.Subscribe(this);
MainManager = mainManager;
MainManager.Events.Subscribe(this);
// Settings are loaded from file by class
AudioVisualizerSettings = new AudioVisualizerSettings();
EffectSettings = new AudioVisualizerSettings();
// Create effect model and add it to MainModel
AudioVisualizerModel = new AudioVisualizerModel(mainModel, AudioVisualizerSettings);
MainModel.EffectModels.Add(AudioVisualizerModel);
// Create effect model and add it to MainManager
EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add(EffectModel);
}
public MainModel MainModel { get; set; }
public AudioVisualizerModel AudioVisualizerModel { get; set; }
public static string Name => "Audio Visualizer";
public bool EffectEnabled => MainModel.IsEnabled(AudioVisualizerModel);
public AudioVisualizerSettings AudioVisualizerSettings
{
get { return _audioVisualizerSettings; }
set
{
if (Equals(value, _audioVisualizerSettings)) return;
_audioVisualizerSettings = value;
NotifyOfPropertyChange(() => AudioVisualizerSettings);
}
}
public void Handle(ChangeActiveEffect message)
public void Handle(ActiveEffectChanged message)
{
NotifyOfPropertyChange(() => EffectEnabled);
}
public void ToggleEffect()
{
if (EffectEnabled && !MainModel.Suspended)
MainModel.ToggleSuspension();
else if (!EffectEnabled && !MainModel.Suspended)
MainModel.EnableEffect(AudioVisualizerModel);
else
{
MainModel.ToggleSuspension();
MainModel.EnableEffect(AudioVisualizerModel);
}
}
public void SaveSettings()
{
AudioVisualizerSettings?.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
AudioVisualizerSettings.ToDefault();
NotifyOfPropertyChange(() => AudioVisualizerSettings);
SaveSettings();
}
}
}

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Utilities.Keyboard;
@ -8,11 +9,12 @@ namespace Artemis.Modules.Effects.Debug
{
internal class DebugEffectModel : EffectModel
{
public DebugEffectModel(MainModel mainModel, DebugEffectSettings settings) : base(mainModel)
public DebugEffectModel(MainManager mainManager, DebugEffectSettings settings) : base(mainManager)
{
Name = "Debug Effect";
Settings = settings;
Scale = 4;
Initialized = false;
}
public int Scale { get; set; }
@ -23,11 +25,14 @@ namespace Artemis.Modules.Effects.Debug
public override void Dispose()
{
Initialized = false;
}
public override void Enable()
{
KeyboardRectangle = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>
Initialized = false;
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{
Color.Red,
Color.OrangeRed,
@ -37,6 +42,8 @@ namespace Artemis.Modules.Effects.Debug
Color.Purple,
Color.DeepPink
}, LinearGradientMode.Horizontal);
Initialized = true;
}
public override void Update()

View File

@ -35,7 +35,9 @@
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
ToolTip="Note: You can't enable an effect when Artemis is disabled"
ToolTipService.ShowOnDisabled="True" />
</StackPanel>
</StackPanel>
@ -54,7 +56,7 @@
</TextBlock>
<Slider x:Name="Width" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
Value="{Binding Path=DebugEffectSettings.Width, Mode=TwoWay}" Minimum="0" Maximum="84"
Value="{Binding Path=EffectSettings.Width, Mode=TwoWay}" Minimum="0" Maximum="84"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Height -->
@ -64,7 +66,7 @@
</TextBlock>
<Slider x:Name="Height" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
Value="{Binding Path=DebugEffectSettings.Height, Mode=TwoWay}" Minimum="0" Maximum="24"
Value="{Binding Path=EffectSettings.Height, Mode=TwoWay}" Minimum="0" Maximum="24"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Scale -->
@ -74,7 +76,7 @@
</TextBlock>
<Slider x:Name="Scale" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
Value="{Binding Path=DebugEffectSettings.Scale, Mode=TwoWay}" Minimum="1" Maximum="4"
Value="{Binding Path=EffectSettings.Scale, Mode=TwoWay}" Minimum="1" Maximum="4"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Color rotation -->
@ -82,7 +84,7 @@
Height="16" Margin="0,9,0,10">
Rotate colors on debug-rectangle
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=DebugEffectSettings.Rotate, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.Rotate, Mode=TwoWay}"
Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
OffLabel="No"
Margin="0,0,-5,0" Width="114" />

View File

@ -5,49 +5,33 @@ using System.IO;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Artemis.Events;
using Artemis.Models;
using Artemis.Managers;
using Artemis.ViewModels.Abstract;
using Caliburn.Micro;
namespace Artemis.Modules.Effects.Debug
{
internal class DebugEffectViewModel : Screen, IHandle<ChangeBitmap>, IHandle<ChangeActiveEffect>
internal class DebugEffectViewModel : EffectViewModel, IHandle<ChangeBitmap>, IHandle<ActiveEffectChanged>
{
private DebugEffectSettings _debugEffectSettings;
private ImageSource _imageSource;
private string _selectedRectangleType;
public DebugEffectViewModel(MainModel mainModel)
public DebugEffectViewModel(MainManager mainManager)
{
// Subscribe to main model
MainModel = mainModel;
MainModel.Events.Subscribe(this);
MainManager = mainManager;
MainManager.Events.Subscribe(this);
// Settings are loaded from file by class
DebugEffectSettings = new DebugEffectSettings();
EffectSettings = new DebugEffectSettings();
// Create effect model and add it to MainModel
DebugEffectModel = new DebugEffectModel(mainModel, DebugEffectSettings);
MainModel.EffectModels.Add(DebugEffectModel);
// Create effect model and add it to MainManager
EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add(EffectModel);
}
public MainModel MainModel { get; set; }
public DebugEffectModel DebugEffectModel { get; set; }
public static string Name => "Type Waves";
public bool EffectEnabled => MainModel.IsEnabled(DebugEffectModel);
public DebugEffectSettings DebugEffectSettings
{
get { return _debugEffectSettings; }
set
{
if (Equals(value, _debugEffectSettings)) return;
_debugEffectSettings = value;
NotifyOfPropertyChange(() => DebugEffectSettings);
SelectedRectangleType = value.Type.ToString();
}
}
public static string Name => "Debug Effect";
public BindableCollection<string> RectangleTypes
=> new BindableCollection<string>(Enum.GetNames(typeof (LinearGradientMode)));
@ -61,7 +45,8 @@ namespace Artemis.Modules.Effects.Debug
_selectedRectangleType = value;
NotifyOfPropertyChange(() => SelectedRectangleType);
DebugEffectSettings.Type = (LinearGradientMode) Enum.Parse(typeof (LinearGradientMode), value);
((DebugEffectSettings) EffectSettings).Type =
(LinearGradientMode) Enum.Parse(typeof (LinearGradientMode), value);
}
}
@ -75,14 +60,13 @@ namespace Artemis.Modules.Effects.Debug
}
}
public void Handle(ChangeActiveEffect message)
public void Handle(ActiveEffectChanged message)
{
NotifyOfPropertyChange(() => EffectEnabled);
}
public void Handle(ChangeBitmap message)
{
// Doesn't show transparancy
using (var memory = new MemoryStream())
{
message.Bitmap.Save(memory, ImageFormat.Png);
@ -97,25 +81,5 @@ namespace Artemis.Modules.Effects.Debug
ImageSource = bitmapImage;
}
}
public void ToggleEffect()
{
if (EffectEnabled && !MainModel.Suspended)
MainModel.ToggleSuspension();
else if (!EffectEnabled && !MainModel.Suspended)
MainModel.EnableEffect(DebugEffectModel);
else
{
MainModel.ToggleSuspension();
MainModel.EnableEffect(DebugEffectModel);
}
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
DebugEffectSettings.ToDefault();
NotifyOfPropertyChange(() => DebugEffectSettings);
}
}
}

View File

@ -1,21 +1,31 @@
using System.Drawing;
using Artemis.Managers;
using Artemis.Models;
namespace Artemis.Modules.Effects.TypeHole
{
public class TypeHoleModel : EffectModel
{
public TypeHoleModel(MainModel mainModel) : base(mainModel)
public TypeHoleModel(MainManager mainManager) : base(mainManager)
{
Name = "TypeHole";
Initialized = false;
}
public override void Dispose()
{
Initialized = false;
// Disable logic
}
public override void Enable()
{
Initialized = false;
// Enable logic
Initialized = true;
}
public override void Update()

View File

@ -31,9 +31,17 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=EffectEnabled, Mode=OneWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
<Popup PlacementTarget="{Binding ElementName=EffectEnabled}"
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
PopupAnimation="Fade" StaysOpen="False">
<Border Margin="1">
<TextBlock Background="{DynamicResource AccentColorBrush}"
Foreground="{DynamicResource IdealForegroundColorBrush}"
Text="You can't enable an effect when Artemis is disabled" Padding="4" />
</Border>
</Popup>
</StackPanel>
</StackPanel>
</Grid>

View File

@ -1,44 +1,28 @@
using Artemis.Events;
using Artemis.Models;
using Artemis.Managers;
using Artemis.ViewModels.Abstract;
using Caliburn.Micro;
namespace Artemis.Modules.Effects.TypeHole
{
public class TypeHoleViewModel : Screen, IHandle<ChangeActiveEffect>
public class TypeHoleViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
{
public TypeHoleViewModel(MainModel mainModel)
public TypeHoleViewModel(MainManager mainManager)
{
// Subscribe to main model
MainModel = mainModel;
MainModel.Events.Subscribe(this);
MainManager = mainManager;
MainManager.Events.Subscribe(this);
// Create effect model and add it to MainModel
TypeHoleModel = new TypeHoleModel(mainModel);
MainModel.EffectModels.Add(TypeHoleModel);
// Create effect model and add it to MainManager
EffectModel = new TypeHoleModel(mainManager);
MainManager.EffectManager.EffectModels.Add(EffectModel);
}
public MainModel MainModel { get; set; }
public TypeHoleModel TypeHoleModel { get; set; }
public static string Name => "Type Holes (NYI)";
public bool EffectEnabled => MainModel.IsEnabled(TypeHoleModel);
public void Handle(ChangeActiveEffect message)
public void Handle(ActiveEffectChanged message)
{
NotifyOfPropertyChange(() => EffectEnabled);
}
public void ToggleEffect()
{
if (EffectEnabled && !MainModel.Suspended)
MainModel.ToggleSuspension();
else if (!EffectEnabled && !MainModel.Suspended)
MainModel.EnableEffect(TypeHoleModel);
else
{
MainModel.ToggleSuspension();
MainModel.EnableEffect(TypeHoleModel);
}
}
}
}

View File

@ -2,10 +2,10 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Artemis.KeyboardProviders.Corsair;
using Artemis.KeyboardProviders.Logitech.Utilities;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Utilities;
@ -16,25 +16,50 @@ namespace Artemis.Modules.Effects.TypeWave
private readonly List<Wave> _waves;
private Color _randomColor;
public TypeWaveModel(MainModel mainModel, TypeWaveSettings settings) : base(mainModel)
public TypeWaveModel(MainManager mainManager, TypeWaveSettings settings) : base(mainManager)
{
Name = "TypeWave";
_waves = new List<Wave>();
_randomColor = Color.Red;
Settings = settings;
Initialized = false;
Scale = 4;
}
public int Scale { get; set; }
public TypeWaveSettings Settings { get; set; }
public override void Dispose()
{
MainModel.KeyboardHook.Unsubscribe(HandleKeypress);
Initialized = false;
MainManager.KeyboardHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback;
}
private void KeyboardHookOnKeyDownCallback(KeyEventArgs e)
{
// More than 25 waves is pointless
if (_waves.Count >= 25)
return;
var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode);
if (keyMatch == null)
return;
_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,
ColorHelpers.ToDrawingColor(Settings.WaveColor)));
}
public override void Enable()
{
Initialized = false;
// Listener won't start unless the effect is active
MainModel.KeyboardHook.Subscribe(HandleKeypress);
MainManager.KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
Initialized = true;
}
public override void Update()
@ -47,7 +72,7 @@ namespace Artemis.Modules.Effects.TypeWave
// TODO: Get from settings
var fps = 25;
_waves[i].Size += Settings.SpreadSpeed;
_waves[i].Size += Settings.SpreadSpeed * Scale;
if (Settings.IsShiftColors)
_waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed);
@ -71,13 +96,13 @@ namespace Artemis.Modules.Effects.TypeWave
if (_waves.Count == 0)
return null;
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap();
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.HighQuality;
// Don't want a foreach, collection is changed in different thread
// Don't want a for-each, collection is changed in different thread
// ReSharper disable once ForCanBeConvertedToForeach
for (var i = 0; i < _waves.Count; i++)
{
@ -88,7 +113,7 @@ namespace Artemis.Modules.Effects.TypeWave
_waves[i].Size, _waves[i].Size);
Color fillColor;
if (MainModel.ActiveKeyboard is CorsairRGB)
if (MainManager.KeyboardManager.ActiveKeyboard is CorsairRGB)
fillColor = Color.Black;
else
fillColor = Color.Transparent;
@ -109,27 +134,6 @@ namespace Artemis.Modules.Effects.TypeWave
}
return bitmap;
}
private void HandleKeypress(object sender, KeyEventArgs e)
{
Task.Factory.StartNew(() => KeyPressTask(e));
}
private void KeyPressTask(KeyEventArgs e)
{
// More than 25 waves is pointless
if (_waves.Count >= 25)
return;
var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode);
if (keyMatch == null)
return;
_waves.Add(Settings.IsRandomColors
? new Wave(new Point(keyMatch.PosX, keyMatch.PosY), 0, _randomColor)
: new Wave(new Point(keyMatch.PosX, keyMatch.PosY), 0,
ColorHelpers.ToDrawingColor(Settings.WaveColor)));
}
}
public class Wave

View File

@ -22,7 +22,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@ -35,8 +34,17 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
Style="{DynamicResource MetroCircleToggleButtonStyle}" />
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
<Popup PlacementTarget="{Binding ElementName=EffectEnabled}"
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
PopupAnimation="Fade" StaysOpen="False">
<Border Margin="1">
<TextBlock Background="{DynamicResource AccentColorBrush}"
Foreground="{DynamicResource IdealForegroundColorBrush}"
Text="You can't enable an effect when Artemis is disabled" Padding="4" />
</Border>
</Popup>
</StackPanel>
</StackPanel>
@ -46,7 +54,7 @@
Wave color
</TextBlock>
<xctk:ColorPicker x:Name="MiddleColor"
SelectedColor="{Binding Path=TypeWaveSettings.WaveColor, Mode=TwoWay}"
SelectedColor="{Binding Path=EffectSettings.WaveColor, Mode=TwoWay}"
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -55,7 +63,7 @@
Height="16" Margin="0,8">
Use random colors
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=TypeWaveSettings.IsRandomColors, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.IsRandomColors, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
OffLabel="No"
Margin="0,0,-5,0" Width="114" />
@ -65,7 +73,7 @@
Height="16" Margin="0,8">
Shift through colors as the wave grows
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=TypeWaveSettings.IsShiftColors, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.IsShiftColors, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
OffLabel="No"
Margin="0,0,-5,0" Width="114" />
@ -77,7 +85,7 @@
</TextBlock>
<Slider x:Name="ColorShiftSpeed" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
Value="{Binding Path=TypeWaveSettings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
Value="{Binding Path=EffectSettings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
SmallChange="45" IsSnapToTickEnabled="True" />
<!-- TTL -->
@ -87,7 +95,7 @@
</TextBlock>
<Slider x:Name="TimeToLive" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
Value="{Binding Path=TypeWaveSettings.TimeToLive, Mode=TwoWay}" Minimum="100" Maximum="2000"
Value="{Binding Path=EffectSettings.TimeToLive, Mode=TwoWay}" Minimum="100" Maximum="2000"
SmallChange="45" IsSnapToTickEnabled="True" />
<!-- Growth speed -->
@ -97,11 +105,11 @@
</TextBlock>
<Slider x:Name="SpreadSpeed" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1"
Value="{Binding Path=TypeWaveSettings.SpreadSpeed, Mode=TwoWay}" Minimum="1" Maximum="6"
Value="{Binding Path=EffectSettings.SpreadSpeed, Mode=TwoWay}" Minimum="1" Maximum="6"
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="7" Orientation="Horizontal" VerticalAlignment="Bottom">
<StackPanel Grid.Column="0" Grid.Row="8" Orientation="Horizontal" VerticalAlignment="Bottom">
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
Style="{DynamicResource SquareButtonStyle}" />
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"

View File

@ -1,77 +1,31 @@
using Artemis.Events;
using Artemis.Models;
using Artemis.Managers;
using Artemis.ViewModels.Abstract;
using Caliburn.Micro;
namespace Artemis.Modules.Effects.TypeWave
{
public class TypeWaveViewModel : Screen, IHandle<ChangeActiveEffect>
public class TypeWaveViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
{
private TypeWaveSettings _typeWaveSettings;
public TypeWaveViewModel(MainModel mainModel)
public TypeWaveViewModel(MainManager mainManager)
{
// Subscribe to main model
MainModel = mainModel;
MainModel.Events.Subscribe(this);
MainManager = mainManager;
MainManager.Events.Subscribe(this);
// Settings are loaded from file by class
TypeWaveSettings = new TypeWaveSettings();
EffectSettings = new TypeWaveSettings();
// Create effect model and add it to MainModel
TypeWaveModel = new TypeWaveModel(mainModel, TypeWaveSettings);
MainModel.EffectModels.Add(TypeWaveModel);
// Create effect model and add it to MainManager
EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add(EffectModel);
}
public MainModel MainModel { get; set; }
public TypeWaveModel TypeWaveModel { get; set; }
public static string Name => "Type Waves";
public bool EffectEnabled => MainModel.IsEnabled(TypeWaveModel);
public TypeWaveSettings TypeWaveSettings
{
get { return _typeWaveSettings; }
set
{
if (Equals(value, _typeWaveSettings)) return;
_typeWaveSettings = value;
NotifyOfPropertyChange(() => TypeWaveSettings);
}
}
public void Handle(ChangeActiveEffect message)
public void Handle(ActiveEffectChanged message)
{
NotifyOfPropertyChange(() => EffectEnabled);
}
public void ToggleEffect()
{
if (EffectEnabled && !MainModel.Suspended)
MainModel.ToggleSuspension();
else if (!EffectEnabled && !MainModel.Suspended)
MainModel.EnableEffect(TypeWaveModel);
else
{
MainModel.ToggleSuspension();
MainModel.EnableEffect(TypeWaveModel);
}
}
public void SaveSettings()
{
if (TypeWaveModel == null)
return;
TypeWaveSettings.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
TypeWaveSettings.ToDefault();
NotifyOfPropertyChange(() => TypeWaveSettings);
SaveSettings();
}
}
}

View File

@ -1,134 +1,134 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Games.CounterStrike {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class CounterStrike : global::System.Configuration.ApplicationSettingsBase {
private static CounterStrike defaultInstance = ((CounterStrike)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new CounterStrike())));
public static CounterStrike Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string GameDirectory {
get {
return ((string)(this["GameDirectory"]));
}
set {
this["GameDirectory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool AmmoEnabled {
get {
return ((bool)(this["AmmoEnabled"]));
}
set {
this["AmmoEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
public global::System.Windows.Media.Color AmmoMainColor {
get {
return ((global::System.Windows.Media.Color)(this["AmmoMainColor"]));
}
set {
this["AmmoMainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
public global::System.Windows.Media.Color AmmoSecondaryColor {
get {
return ((global::System.Windows.Media.Color)(this["AmmoSecondaryColor"]));
}
set {
this["AmmoSecondaryColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool TeamColorEnabled {
get {
return ((bool)(this["TeamColorEnabled"]));
}
set {
this["TeamColorEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool FlashEnabled {
get {
return ((bool)(this["FlashEnabled"]));
}
set {
this["FlashEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool SmokeEnabled {
get {
return ((bool)(this["SmokeEnabled"]));
}
set {
this["SmokeEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool LowHpEnabled {
get {
return ((bool)(this["LowHpEnabled"]));
}
set {
this["LowHpEnabled"] = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Games.CounterStrike {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class CounterStrike : global::System.Configuration.ApplicationSettingsBase {
private static CounterStrike defaultInstance = ((CounterStrike)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new CounterStrike())));
public static CounterStrike Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string GameDirectory {
get {
return ((string)(this["GameDirectory"]));
}
set {
this["GameDirectory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool AmmoEnabled {
get {
return ((bool)(this["AmmoEnabled"]));
}
set {
this["AmmoEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
public global::System.Windows.Media.Color AmmoMainColor {
get {
return ((global::System.Windows.Media.Color)(this["AmmoMainColor"]));
}
set {
this["AmmoMainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
public global::System.Windows.Media.Color AmmoSecondaryColor {
get {
return ((global::System.Windows.Media.Color)(this["AmmoSecondaryColor"]));
}
set {
this["AmmoSecondaryColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool TeamColorEnabled {
get {
return ((bool)(this["TeamColorEnabled"]));
}
set {
this["TeamColorEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool FlashEnabled {
get {
return ((bool)(this["FlashEnabled"]));
}
set {
this["FlashEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool SmokeEnabled {
get {
return ((bool)(this["SmokeEnabled"]));
}
set {
this["SmokeEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool LowHpEnabled {
get {
return ((bool)(this["LowHpEnabled"]));
}
set {
this["LowHpEnabled"] = value;
}
}
}
}

View File

@ -1,35 +1,35 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GameDirectory" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AmmoEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="AmmoMainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF2900</Value>
</Setting>
<Setting Name="AmmoSecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FF26F600</Value>
</Setting>
<Setting Name="TeamColorEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="FlashEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="SmokeEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LowHpEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GameDirectory" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AmmoEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="AmmoMainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF2900</Value>
</Setting>
<Setting Name="AmmoSecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FF26F600</Value>
</Setting>
<Setting Name="TeamColorEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="FlashEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="SmokeEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="LowHpEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -4,8 +4,7 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using Artemis.KeyboardProviders;
using Artemis.KeyboardProviders.Corsair;
using Artemis.KeyboardProviders.Logitech;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Utilities;
using Artemis.Utilities.GameState;
@ -19,13 +18,14 @@ namespace Artemis.Modules.Games.CounterStrike
{
private KeyboardRegion _topRow;
public CounterStrikeModel(MainModel mainModel, CounterStrikeSettings settings) : base(mainModel)
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings) : base(mainManager)
{
Settings = settings;
Name = "CounterStrike";
ProcessName = "csgo";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
}
public CounterStrikeSettings Settings { get; set; }
@ -42,20 +42,34 @@ namespace Artemis.Modules.Games.CounterStrike
public override void Dispose()
{
MainModel.GameStateWebServer.GameDataReceived -= HandleGameData;
Initialized = false;
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
}
public override void Enable()
{
Initialized = false;
// Some keyboards have a different baseline, Corsair F-keys start at row 1
_topRow = MainModel.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
AmmoRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X, new List<Color>(),
_topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
AmmoRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X,
new List<Color>(),
LinearGradientMode.Horizontal) {Height = Scale, ContainedBrush = false};
TeamRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X + 1, new List<Color>(),
LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale};
EventRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, _topRow.TopLeft.X + 1, new List<Color>(),
LinearGradientMode.Horizontal) {Height = MainModel.ActiveKeyboard.Height*Scale - Scale};
MainModel.GameStateWebServer.GameDataReceived += HandleGameData;
TeamRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X + 1,
new List<Color>(),
LinearGradientMode.Horizontal)
{
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
};
EventRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X + 1,
new List<Color>(),
LinearGradientMode.Horizontal)
{
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
};
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
Initialized = true;
}
public override void Update()
@ -152,7 +166,7 @@ namespace Artemis.Modules.Games.CounterStrike
return;
var ammoPercentage = (int) Math.Ceiling(100.00/maxAmmo)*ammo;
AmmoRect.Width = (int) Math.Floor(_topRow.BottomRight.Y / 100.00*ammoPercentage)*Scale;
AmmoRect.Width = (int) Math.Floor(_topRow.BottomRight.Y/100.00*ammoPercentage)*Scale;
AmmoRect.Colors = new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.AmmoMainColor),
@ -168,7 +182,7 @@ namespace Artemis.Modules.Games.CounterStrike
public override Bitmap GenerateBitmap()
{
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
using (var g = Graphics.FromImage(bitmap))
{

View File

@ -3,14 +3,13 @@ using Artemis.Models;
namespace Artemis.Modules.Games.CounterStrike
{
public class CounterStrikeSettings : EffectSettings
public class CounterStrikeSettings : GameSettings
{
public CounterStrikeSettings()
{
Load();
}
public bool Enabled { get; set; }
public string GameDirectory { get; set; }
public bool AmmoEnabled { get; set; }

View File

@ -37,7 +37,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=CounterStrikeSettings.Enabled, Mode=TwoWay}"
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
@ -50,7 +50,7 @@
Width="130" HorizontalAlignment="Left" />
<Grid>
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
Text="{Binding Path=CounterStrikeSettings.GameDirectory, Mode=TwoWay}"
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
HorizontalAlignment="Right" Width="25"
@ -63,7 +63,7 @@
Height="16" Margin="0,10,0,9">
Display ammo on F-keys
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.AmmoEnabled, Mode=TwoWay}"
<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" />
@ -73,7 +73,7 @@
Main ammo color
</TextBlock>
<xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoMainColor, Mode=TwoWay}"
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" />
@ -83,7 +83,7 @@
Secondary ammo color
</TextBlock>
<xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoSecondaryColor, Mode=TwoWay}"
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" />
@ -92,7 +92,7 @@
Height="16" Margin="0,9,0,10">
Display smoked effect
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.SmokeEnabled, Mode=TwoWay}"
<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" />
@ -101,7 +101,7 @@
Height="16" Margin="0,10,0,9">
Display flashed effect
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.FlashEnabled, Mode=TwoWay}"
<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" />
@ -110,7 +110,7 @@
Height="16" Margin="0,9,0,10">
Color keyboard according to team
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.TeamColorEnabled, Mode=TwoWay}"
<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" />
@ -119,7 +119,7 @@
Height="16" Margin="0,10,0,9">
Color keyboard red on low HP
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.LowHpEnabled, Mode=TwoWay}"
<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" />

View File

@ -1,93 +1,64 @@
using System.IO;
using System.Windows.Forms;
using Artemis.Models;
using Artemis.Managers;
using Artemis.Properties;
using Screen = Caliburn.Micro.Screen;
using Artemis.ViewModels.Abstract;
namespace Artemis.Modules.Games.CounterStrike
{
public class CounterStrikeViewModel : Screen
public class CounterStrikeViewModel : GameViewModel
{
private CounterStrikeSettings _counterStrikeSettings;
public CounterStrikeViewModel(MainModel mainModel)
public CounterStrikeViewModel(MainManager mainManager)
{
MainModel = mainModel;
MainManager = mainManager;
// Settings are loaded from file by class
CounterStrikeSettings = new CounterStrikeSettings();
GameSettings = new CounterStrikeSettings();
// Create effect model and add it to MainModel
CounterStrikeModel = new CounterStrikeModel(mainModel, CounterStrikeSettings);
MainModel.EffectModels.Add(CounterStrikeModel);
// Create effect model and add it to MainManager
GameModel = new CounterStrikeModel(mainManager, (CounterStrikeSettings) GameSettings);
MainManager.EffectManager.EffectModels.Add(GameModel);
PlaceConfigFile();
}
public CounterStrikeSettings CounterStrikeSettings
{
get { return _counterStrikeSettings; }
set
{
if (Equals(value, _counterStrikeSettings)) return;
_counterStrikeSettings = value;
NotifyOfPropertyChange(() => CounterStrikeSettings);
}
}
public CounterStrikeModel CounterStrikeModel { get; set; }
public MainModel MainModel { get; set; }
public static string Name => "CS:GO";
public string Content => "Counter-Strike: GO Content";
public void SaveSettings()
{
CounterStrikeSettings?.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
CounterStrikeSettings.ToDefault();
NotifyOfPropertyChange(() => CounterStrikeSettings);
SaveSettings();
}
public void ToggleEffect()
{
CounterStrikeModel.Enabled = _counterStrikeSettings.Enabled;
}
public void BrowseDirectory()
{
var dialog = new FolderBrowserDialog {SelectedPath = CounterStrikeSettings.GameDirectory};
var dialog = new FolderBrowserDialog {SelectedPath = ((CounterStrikeSettings) GameSettings).GameDirectory};
var result = dialog.ShowDialog();
if (result != DialogResult.OK)
return;
CounterStrikeSettings.GameDirectory = dialog.SelectedPath;
NotifyOfPropertyChange(() => CounterStrikeSettings);
((CounterStrikeSettings) GameSettings).GameDirectory = dialog.SelectedPath;
NotifyOfPropertyChange(() => GameSettings);
GameSettings.Save();
PlaceConfigFile();
}
public void PlaceConfigFile()
{
if (CounterStrikeSettings.GameDirectory == string.Empty)
if (((CounterStrikeSettings) GameSettings).GameDirectory == string.Empty)
return;
if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg"))
if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
{
var cfgFile = Resources.gamestateConfiguration.Replace("{{port}}",
MainModel.GameStateWebServer.Port.ToString());
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
MainManager.GameStateWebServer.Port.ToString());
File.WriteAllText(
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
cfgFile);
return;
}
MessageBox.Show("Please select a valid CS:GO directory");
CounterStrikeSettings.GameDirectory = string.Empty;
NotifyOfPropertyChange(() => CounterStrikeSettings);
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();
}
}
}

View File

@ -1,17 +1,15 @@
using Artemis.Models;
using Caliburn.Micro;
using Artemis.Managers;
using Artemis.ViewModels.Abstract;
namespace Artemis.Modules.Games.Dota2
{
public class Dota2ViewModel : Screen
public class Dota2ViewModel : GameViewModel
{
public Dota2ViewModel(MainModel mainModel)
public Dota2ViewModel(MainManager mainManager)
{
MainModel = mainModel;
MainManager = mainManager;
}
public MainModel MainModel { get; set; }
public static string Name => "Dota 2 (NYI)";
public string Content => "Dota 2 Content";
}

View File

@ -1,62 +1,74 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Games.RocketLeague {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class RocketLeague : global::System.Configuration.ApplicationSettingsBase {
private static RocketLeague defaultInstance = ((RocketLeague)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new RocketLeague())));
public static RocketLeague Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF5000")]
public global::System.Windows.Media.Color MainColor {
get {
return ((global::System.Windows.Media.Color)(this["MainColor"]));
}
set {
this["MainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
public global::System.Windows.Media.Color SecondaryColor {
get {
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
}
set {
this["SecondaryColor"] = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Games.RocketLeague {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class RocketLeague : global::System.Configuration.ApplicationSettingsBase {
private static RocketLeague defaultInstance = ((RocketLeague)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new RocketLeague())));
public static RocketLeague Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF5000")]
public global::System.Windows.Media.Color MainColor {
get {
return ((global::System.Windows.Media.Color)(this["MainColor"]));
}
set {
this["MainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
public global::System.Windows.Media.Color SecondaryColor {
get {
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
}
set {
this["SecondaryColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool ContextualColor {
get {
return ((bool)(this["ContextualColor"]));
}
set {
this["ContextualColor"] = value;
}
}
}
}

View File

@ -1,17 +1,20 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF5000</Value>
</Setting>
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF0000</Value>
</Setting>
</Settings>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF5000</Value>
</Setting>
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF0000</Value>
</Setting>
<Setting Name="ContextualColor" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,149 +1,153 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Artemis.Models;
using Artemis.Settings;
using Artemis.Utilities;
using Artemis.Utilities.Keyboard;
using Artemis.Utilities.Memory;
using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueModel : GameModel
{
private int _boostAmount;
private bool _boostGrowing;
private KeyboardRectangle _boostRect;
private Memory _memory;
private GamePointersCollectionModel _pointer;
private int _previousBoost;
public RocketLeagueModel(MainModel mainModel, RocketLeagueSettings settings) : base(mainModel)
{
Settings = settings;
Name = "RocketLeague";
ProcessName = "RocketLeague";
Scale = 4;
Enabled = Settings.Enabled;
}
public RocketLeagueSettings Settings { get; set; }
public int Scale { get; set; }
public override void Dispose()
{
_memory = null;
}
public override void Enable()
{
_boostRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.MainColor),
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
}, LinearGradientMode.Horizontal);
MemoryHelpers.GetPointers();
_pointer = JsonConvert.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.RocketLeague);
//var test =
// JsonConvert.SerializeObject(new List<GamePointersCollectionModel>
// {
// new GamePointersCollectionModel
// {
// Game = "RocketLeague",
// GameVersion = "1.12",
// GameAddresses = new List<GamePointer> {new GamePointer
// {
// Description = "Boost",
// BasePointer = new IntPtr(0x01581AF4),
// Offsets = new []{0xB4, 0x104, 0x320, 0x708, 0x21C}
// }}
// }
// });
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
_memory = new Memory(tempProcess);
}
public override void Update()
{
if (_boostGrowing)
return;
if (_memory == null)
return;
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
_previousBoost = _boostAmount;
_boostAmount = (int) Math.Ceiling(boostFloat);
// Take care of any reading errors resulting in an OutOfMemory on draw
if (_boostAmount < 0)
_boostAmount = 0;
if (_boostAmount > 100)
_boostAmount = 100;
_boostRect.Width = (int) Math.Ceiling(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
_boostRect.Colors = new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.MainColor),
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
};
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(MainModel.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(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
}
_boostAmount += differenceStep;
_boostRect.Width = (int) Math.Ceiling(MainModel.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
Thread.Sleep(50);
}
_boostGrowing = false;
}
public override Bitmap GenerateBitmap()
{
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
if (_boostRect == null)
return null;
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);
_boostRect.Draw(g);
}
return bitmap;
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Settings;
using Artemis.Utilities;
using Artemis.Utilities.Keyboard;
using Artemis.Utilities.Memory;
using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueModel : GameModel
{
private int _boostAmount;
private bool _boostGrowing;
private KeyboardRectangle _boostRect;
private bool _contextualColor;
private Memory _memory;
private GamePointersCollection _pointer;
private int _previousBoost;
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings) : base(mainManager)
{
Settings = settings;
Name = "RocketLeague";
ProcessName = "RocketLeague";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
}
public RocketLeagueSettings Settings { get; set; }
public int Scale { get; set; }
public override void Dispose()
{
Initialized = false;
_memory = null;
}
public override void Enable()
{
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();
_pointer = JsonConvert.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague);
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
_memory = new Memory(tempProcess);
Initialized = true;
}
public override void Update()
{
if (_boostGrowing)
return;
if (_memory == null)
return;
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;
_previousBoost = _boostAmount;
_boostAmount = (int) Math.Ceiling(boostFloat);
// Take care of any reading errors resulting in an OutOfMemory on draw
if (_boostAmount < 0)
_boostAmount = 0;
if (_boostAmount > 100)
_boostAmount = 100;
_boostRect.Width =
(int) Math.Ceiling(MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*_boostAmount);
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()
{
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
if (_boostRect == null)
return null;
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);
_boostRect.Draw(g);
}
return bitmap;
}
}
}

View File

@ -3,22 +3,23 @@ using Artemis.Models;
namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueSettings : EffectSettings
public class RocketLeagueSettings : GameSettings
{
public RocketLeagueSettings()
{
Load();
}
public bool Enabled { get; set; }
public Color MainColor { get; set; }
public Color SecondaryColor { get; set; }
public bool ContextualColor { get; set; }
public sealed override void Load()
{
Enabled = RocketLeague.Default.Enabled;
MainColor = RocketLeague.Default.MainColor;
SecondaryColor = RocketLeague.Default.SecondaryColor;
ContextualColor = RocketLeague.Default.ContextualColor;
}
public sealed override void Save()
@ -26,6 +27,7 @@ namespace Artemis.Modules.Games.RocketLeague
RocketLeague.Default.Enabled = Enabled;
RocketLeague.Default.MainColor = MainColor;
RocketLeague.Default.SecondaryColor = SecondaryColor;
RocketLeague.Default.ContextualColor = ContextualColor;
RocketLeague.Default.Save();
}
@ -35,6 +37,7 @@ namespace Artemis.Modules.Games.RocketLeague
Enabled = true;
MainColor = Color.FromArgb(255, 255, 80, 0);
SecondaryColor = Color.FromArgb(255, 255, 0, 0);
ContextualColor = false;
}
}
}

View File

@ -1,83 +1,94 @@
<UserControl x:Class="Artemis.Modules.Games.RocketLeague.RocketLeagueView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
<Label FontSize="20" HorizontalAlignment="Left">
<Label.Content>
<AccessText TextWrapping="Wrap"
Text="Shows your boost amount on the keyboard." />
</Label.Content>
</Label>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=RocketLeagueSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
</StackPanel>
<!-- Main color -->
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
Height="16" Margin="0,8">
Main boost display color
</TextBlock>
<xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=RocketLeagueSettings.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=RocketLeagueSettings.SecondaryColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" 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 Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" MaxWidth="510" TextAlignment="Justify">
Note: Requires patch x.x. When a new patch is released Artemis downloads new pointers for the latest version (unless disabled in settings).
</TextBlock>
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
Style="{DynamicResource SquareButtonStyle}" />
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
Margin="10,0,0,0"
Style="{DynamicResource SquareButtonStyle}" />
</StackPanel>
</Grid>
</ScrollViewer>
<UserControl x:Class="Artemis.Modules.Games.RocketLeague.RocketLeagueView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:cal="http://www.caliburnproject.org"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
<Label FontSize="20" HorizontalAlignment="Left">
<Label.Content>
<AccessText TextWrapping="Wrap"
Text="Shows your boost amount on the keyboard." />
</Label.Content>
</Label>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
</StackPanel>
<!-- Main color -->
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
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 -->
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
Style="{DynamicResource SquareButtonStyle}" />
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
Margin="10,0,0,0"
Style="{DynamicResource SquareButtonStyle}" />
</StackPanel>
</Grid>
</ScrollViewer>
</UserControl>

View File

@ -1,60 +1,60 @@
using Artemis.Models;
using Caliburn.Micro;
using Artemis.Managers;
using Artemis.Settings;
using Artemis.Utilities;
using Artemis.Utilities.Memory;
using Artemis.ViewModels.Abstract;
using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueViewModel : Screen
public class RocketLeagueViewModel : GameViewModel
{
private RocketLeagueSettings _rocketLeagueSettings;
private string _versionText;
public RocketLeagueViewModel(MainModel mainModel)
public RocketLeagueViewModel(MainManager mainManager)
{
MainModel = mainModel;
MainManager = mainManager;
// Settings are loaded from file by class
RocketLeagueSettings = new RocketLeagueSettings();
GameSettings = new RocketLeagueSettings();
// Create effect model and add it to MainModel
RocketLeagueModel = new RocketLeagueModel(mainModel, RocketLeagueSettings);
MainModel.EffectModels.Add(RocketLeagueModel);
// Create effect model and add it to MainManager
GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
MainManager.EffectManager.EffectModels.Add(GameModel);
SetVersionText();
}
public static string Name => "Rocket League";
public MainModel MainModel { get; set; }
public RocketLeagueModel RocketLeagueModel { get; set; }
public RocketLeagueSettings RocketLeagueSettings
public string VersionText
{
get { return _rocketLeagueSettings; }
get { return _versionText; }
set
{
if (Equals(value, _rocketLeagueSettings)) return;
_rocketLeagueSettings = value;
NotifyOfPropertyChange(() => RocketLeagueSettings);
if (value == _versionText) return;
_versionText = value;
NotifyOfPropertyChange(() => VersionText);
}
}
public void SaveSettings()
public RocketLeagueModel RocketLeagueModel { get; set; }
private void SetVersionText()
{
if (RocketLeagueModel == null)
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;
}
RocketLeagueSettings.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
RocketLeagueSettings.ToDefault();
NotifyOfPropertyChange(() => RocketLeagueSettings);
SaveSettings();
}
public void ToggleEffect()
{
RocketLeagueModel.Enabled = _rocketLeagueSettings.Enabled;
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).";
}
}
}

View File

@ -1,38 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Games.Witcher3 {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Witcher3 : global::System.Configuration.ApplicationSettingsBase {
private static Witcher3 defaultInstance = ((Witcher3)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Witcher3())));
public static Witcher3 Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Games.Witcher3 {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Witcher3 : global::System.Configuration.ApplicationSettingsBase {
private static Witcher3 defaultInstance = ((Witcher3)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Witcher3())));
public static Witcher3 Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
}
}

View File

@ -1,11 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -5,6 +5,7 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Text.RegularExpressions;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Utilities.Keyboard;
@ -17,13 +18,14 @@ namespace Artemis.Modules.Games.Witcher3
private KeyboardRectangle _signRect;
private string _witcherSettings;
public Witcher3Model(MainModel mainModel, Witcher3Settings settings) : base(mainModel)
public Witcher3Model(MainManager mainManager, Witcher3Settings settings) : base(mainManager)
{
Settings = settings;
Name = "Witcher3";
ProcessName = "witcher3";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
_updateSw = new Stopwatch();
_signRegex = new Regex("ActiveSign=(.*)", RegexOptions.Compiled);
@ -35,6 +37,7 @@ namespace Artemis.Modules.Games.Witcher3
public override void Dispose()
{
Initialized = false;
_witcherSettings = null;
_updateSw.Reset();
@ -42,7 +45,9 @@ namespace Artemis.Modules.Games.Witcher3
public override void Enable()
{
_signRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>(),
Initialized = false;
_signRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
LinearGradientMode.Horizontal)
{
Rotate = true,
@ -56,6 +61,8 @@ namespace Artemis.Modules.Games.Witcher3
_witcherSettings = witcherSettings;
_updateSw.Start();
Initialized = true;
}
public override void Update()
@ -102,7 +109,7 @@ namespace Artemis.Modules.Games.Witcher3
public override Bitmap GenerateBitmap()
{
var bitmap = MainModel.ActiveKeyboard.KeyboardBitmap(Scale);
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);

View File

@ -2,15 +2,13 @@
namespace Artemis.Modules.Games.Witcher3
{
public class Witcher3Settings : EffectSettings
public class Witcher3Settings : GameSettings
{
public Witcher3Settings()
{
Load();
}
public bool Enabled { get; set; }
public sealed override void Load()
{
Enabled = Witcher3.Default.Enabled;

View File

@ -29,21 +29,21 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=Witcher3Settings.Enabled, Mode=TwoWay}"
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" MaxWidth="510" TextAlignment="Justify">
MaxWidth="510" TextAlignment="Justify">
Artemis requires the latest Witcher 3 version and mod to be installed in order to work. If you don't use any (conflicting) Witcher 3 mods, the mod can automatically be installed.
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" MaxWidth="510" TextAlignment="Justify">
If you do use conflicting mods, we'll let you know what to do.
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify">
Note: If you do use conflicting mods, we'll let you know what to do.
</TextBlock>
<Button Grid.Row="3" Grid.Column="0" x:Name="AutoInstall" Content="Try automatic mod install" Width="160"
Style="{DynamicResource SquareButtonStyle}" HorizontalAlignment="Left" Margin="0,20,0,0" />

View File

@ -3,67 +3,29 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Artemis.Models;
using Artemis.Managers;
using Artemis.Properties;
using Screen = Caliburn.Micro.Screen;
using Artemis.ViewModels.Abstract;
namespace Artemis.Modules.Games.Witcher3
{
public class Witcher3ViewModel : Screen
public class Witcher3ViewModel : GameViewModel
{
private Witcher3Settings _witcher3Settings;
public Witcher3ViewModel(MainModel mainModel)
public Witcher3ViewModel(MainManager mainManager)
{
MainModel = mainModel;
MainManager = mainManager;
// Settings are loaded from file by class
Witcher3Settings = new Witcher3Settings();
GameSettings = new Witcher3Settings();
// Create effect model and add it to MainModel
Witcher3Model = new Witcher3Model(mainModel, Witcher3Settings);
MainModel.EffectModels.Add(Witcher3Model);
// Create effect model and add it to MainManager
GameModel = new Witcher3Model(mainManager, (Witcher3Settings) GameSettings);
MainManager.EffectManager.EffectModels.Add(GameModel);
}
public static string Name => "The Witcher 3";
public MainModel MainModel { get; set; }
public Witcher3Model Witcher3Model { get; set; }
public Witcher3Settings Witcher3Settings
{
get { return _witcher3Settings; }
set
{
if (Equals(value, _witcher3Settings)) return;
_witcher3Settings = value;
NotifyOfPropertyChange(() => Witcher3Settings);
}
}
public void SaveSettings()
{
if (Witcher3Model == null)
return;
Witcher3Settings.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
Witcher3Settings.ToDefault();
NotifyOfPropertyChange(() => Witcher3Settings);
SaveSettings();
}
public void ToggleEffect()
{
Witcher3Model.Enabled = _witcher3Settings.Enabled;
}
public void AutoInstall()
public async void AutoInstall()
{
// Request The Witcher 3 folder
var dialog = new FolderBrowserDialog
@ -77,15 +39,16 @@ namespace Artemis.Modules.Games.Witcher3
// If the subfolder doesn't contain witcher3.exe, it's the wrong folder.
if (!File.Exists(dialog.SelectedPath + @"\bin\x64\witcher3.exe"))
{
var error = MessageBox.Show("That's not a valid Witcher 3 directory\n\n" +
"Default directories:\n" +
"Steam: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Witcher 3\n" +
"GOG: C:\\GOG Games\\The Witcher 3 Wild Hunt", "Installation error",
MessageBoxButtons.RetryCancel);
if (error == DialogResult.Retry)
var retry = await
MainManager.DialogService.ShowQuestionMessageBox("Installation error",
"That's not a valid Witcher 3 directory\n\n" +
"Default directories:\n" +
"Steam: \\SteamApps\\common\\The Witcher 3\n" +
"GOG: C:\\GOG Games\\The Witcher 3 Wild Hunt\n\n" +
"Retry?");
if (retry.Value)
AutoInstall();
else
return;
return;
}
// Look for any conflicting mods
@ -99,27 +62,33 @@ namespace Artemis.Modules.Games.Witcher3
// Don't trip over our own mod
if (!file.Contains("modArtemis"))
{
MessageBox.Show("Oh no, you have a conflicting mod!\n\n" +
"Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) +
"\n\nOnce you press OK you will be taken to an instructions page.",
"Conflicting mod found");
var viewHelp = await
MainManager.DialogService.ShowQuestionMessageBox("Conflicting mod found",
"Oh no, you have a conflicting mod!\n\n" +
"Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) +
"\n\nWould you like to view instructions on how to manually install the mod?");
if (!viewHelp.Value)
return;
// Put the mod in the documents folder instead
// Create the directory structure
var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis";
if (
!Directory.Exists(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player"))
Directory.CreateDirectory(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player");
Directory.CreateDirectory(folder +
@"\Witcher3\mods\modArtemis\content\scripts\game\player");
if (
!Directory.Exists(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc"))
Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc");
// Install the mod files
File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",Resources.artemisXml);
File.WriteAllText(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",Resources.playerWitcherWs);
File.WriteAllText(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc\artemis.xml",
Resources.artemisXml);
File.WriteAllText(
folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
Resources.playerWitcherWs);
Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
return;
}
}
@ -137,7 +106,7 @@ namespace Artemis.Modules.Games.Witcher3
File.WriteAllText(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
Resources.playerWitcherWs);
MessageBox.Show("The mod was successfully installed!", "Success");
MainManager.DialogService.ShowMessageBox("Success", "The mod was successfully installed!");
}
}
}

View File

@ -1,62 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Settings {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class VolumeDisplay : global::System.Configuration.ApplicationSettingsBase {
private static VolumeDisplay defaultInstance = ((VolumeDisplay)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new VolumeDisplay())));
public static VolumeDisplay Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
public global::System.Windows.Media.Color MainColor {
get {
return ((global::System.Windows.Media.Color)(this["MainColor"]));
}
set {
this["MainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
public global::System.Windows.Media.Color SecondaryColor {
get {
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
}
set {
this["SecondaryColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Modules.Overlays.VolumeDisplay {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class VolumeDisplay : global::System.Configuration.ApplicationSettingsBase {
private static VolumeDisplay defaultInstance = ((VolumeDisplay)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new VolumeDisplay())));
public static VolumeDisplay Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Enabled {
get {
return ((bool)(this["Enabled"]));
}
set {
this["Enabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF2900")]
public global::System.Windows.Media.Color MainColor {
get {
return ((global::System.Windows.Media.Color)(this["MainColor"]));
}
set {
this["MainColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#FF26F600")]
public global::System.Windows.Media.Color SecondaryColor {
get {
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
}
set {
this["SecondaryColor"] = value;
}
}
}
}

View File

@ -1,23 +1,23 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using Artemis.Models;
using Artemis.Managers;
using Artemis.Utilities;
using Artemis.Utilities.Keyboard;
namespace Artemis.Modules.Overlays.VolumeDisplay
{
public class VolumeDisplay
public class VolumeBar
{
public VolumeDisplay(MainModel mainModel, VolumeDisplaySettings settings)
public VolumeBar(MainManager mainManager, VolumeDisplaySettings settings)
{
MainModel = mainModel;
MainManager = mainManager;
Settings = settings;
Transparancy = 255;
Scale = 4;
}
public MainModel MainModel { get; set; }
public MainManager MainManager { get; set; }
public VolumeDisplaySettings Settings { get; set; }
@ -30,14 +30,14 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public void Draw(Graphics g)
{
var volumeRect = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List<Color>
var volumeRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.SecondaryColor),
ColorHelpers.ToDrawingColor(Settings.MainColor)
},
LinearGradientMode.Horizontal)
{
Width = (int) (MainModel.ActiveKeyboard.Width*Scale/100.00*Volume),
Width = (int) (MainManager.KeyboardManager.ActiveKeyboard.Width*Scale/100.00*Volume),
ContainedBrush = false
};
volumeRect.Draw(g);

View File

@ -1,17 +1,17 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="VolumeDisplay">
<Profiles />
<Settings>
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF2900</Value>
</Setting>
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FF26F600</Value>
</Setting>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Overlays.VolumeDisplay" GeneratedClassName="VolumeDisplay">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF2900</Value>
</Setting>
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FF26F600</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,7 +1,7 @@
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
using Artemis.Managers;
using Artemis.Models;
using NAudio.CoreAudioApi;
@ -9,28 +9,28 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
{
public class VolumeDisplayModel : OverlayModel
{
public VolumeDisplayModel(MainModel mainModel, VolumeDisplaySettings settings) : base(mainModel)
public VolumeDisplayModel(MainManager mainManager, VolumeDisplaySettings settings) : base(mainManager)
{
Settings = settings;
Name = "VolumeDisplay";
Enabled = Settings.Enabled;
VolumeDisplay = new VolumeDisplay(mainModel, settings);
VolumeDisplay = new VolumeBar(mainManager, settings);
}
public VolumeDisplay VolumeDisplay { get; set; }
public VolumeBar VolumeDisplay { get; set; }
public VolumeDisplaySettings Settings { get; set; }
public override void Dispose()
{
MainModel.KeyboardHook.Unsubscribe(HandleKeypress);
MainManager.KeyboardHook.KeyDownCallback -= KeyPressTask;
}
public override void Enable()
{
// Listener won't start unless the effect is active
MainModel.KeyboardHook.Subscribe(HandleKeypress);
MainManager.KeyboardHook.KeyDownCallback += KeyPressTask;
}
public override void Update()
@ -63,7 +63,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public override Bitmap GenerateBitmap()
{
return GenerateBitmap(MainModel.ActiveKeyboard.KeyboardBitmap(4));
return GenerateBitmap(MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(4));
}
public override Bitmap GenerateBitmap(Bitmap bitmap)
@ -79,11 +79,6 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
return bitmap;
}
private void HandleKeypress(object sender, KeyEventArgs e)
{
Task.Factory.StartNew(() => KeyPressTask(e));
}
private void KeyPressTask(KeyEventArgs e)
{
if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown)

View File

@ -16,18 +16,18 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public sealed override void Load()
{
Enabled = Settings.VolumeDisplay.Default.Enabled;
MainColor = Settings.VolumeDisplay.Default.MainColor;
SecondaryColor = Settings.VolumeDisplay.Default.SecondaryColor;
Enabled = VolumeDisplay.Default.Enabled;
MainColor = VolumeDisplay.Default.MainColor;
SecondaryColor = VolumeDisplay.Default.SecondaryColor;
}
public sealed override void Save()
{
Settings.VolumeDisplay.Default.Enabled = Enabled;
Settings.VolumeDisplay.Default.MainColor = MainColor;
Settings.VolumeDisplay.Default.SecondaryColor = SecondaryColor;
VolumeDisplay.Default.Enabled = Enabled;
VolumeDisplay.Default.MainColor = MainColor;
VolumeDisplay.Default.SecondaryColor = SecondaryColor;
Settings.VolumeDisplay.Default.Save();
VolumeDisplay.Default.Save();
}
public sealed override void ToDefault()

View File

@ -55,17 +55,23 @@
<xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=VolumeDisplaySettings.SecondaryColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22">
<xctk:ColorPicker.Template>
<ControlTemplate>
<Rectangle />
</ControlTemplate>
</xctk:ColorPicker.Template>
</xctk:ColorPicker>
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" MaxWidth="520" TextAlignment="Justify">
MaxWidth="520" TextAlignment="Justify">
Note: This is an overlay. It will go over any other active effect, and is only shown at certain moments (in this case when changing volume). Please also note that it won't work if there aren't any active effects.
</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#B50000" MaxWidth="520" TextAlignment="Justify">
Foreground="{DynamicResource HighlightBrush}" MaxWidth="520" TextAlignment="Justify">
Please also note that it won't work if there aren't any active effects.
</TextBlock>

View File

@ -1,4 +1,4 @@
using Artemis.Models;
using Artemis.Managers;
using Caliburn.Micro;
namespace Artemis.Modules.Overlays.VolumeDisplay
@ -7,21 +7,21 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
{
private VolumeDisplaySettings _volumeDisplaySettings;
public VolumeDisplayViewModel(MainModel mainModel)
public VolumeDisplayViewModel(MainManager mainManager)
{
MainModel = mainModel;
MainManager = mainManager;
// Settings are loaded from file by class
VolumeDisplaySettings = new VolumeDisplaySettings();
// Create effect model and add it to MainModel
VolumeDisplayModel = new VolumeDisplayModel(mainModel, VolumeDisplaySettings);
MainModel.EffectModels.Add(VolumeDisplayModel);
// Create effect model and add it to MainManager
VolumeDisplayModel = new VolumeDisplayModel(mainManager, VolumeDisplaySettings);
MainManager.EffectManager.EffectModels.Add(VolumeDisplayModel);
}
public static string Name => "Volume Display";
public MainModel MainModel { get; set; }
public MainManager MainManager { get; set; }
public VolumeDisplayModel VolumeDisplayModel { get; set; }
public VolumeDisplaySettings VolumeDisplaySettings

View File

@ -1,66 +1,66 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Artemis.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Artemis.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-16&quot;?&gt;
///&lt;!-- Used by Artemis to get the active Sign --&gt;
///&lt;UserConfig&gt;
@ -69,25 +69,25 @@ namespace Artemis.Properties {
/// &lt;Var id=&quot;ActiveSign&quot; displayName=&quot;ActiveSign&quot; displayType=&quot;SLIDER:0:1:1000000&quot;/&gt;
/// &lt;/VisibleVars&gt;
/// &lt;/Group&gt;
///&lt;/UserConfig&gt;.
/// </summary>
internal static string artemisXml {
get {
return ResourceManager.GetString("artemisXml", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bow {
get {
object obj = ResourceManager.GetObject("bow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
///&lt;/UserConfig&gt;.
/// </summary>
internal static string artemisXml {
get {
return ResourceManager.GetString("artemisXml", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bow {
get {
object obj = ResourceManager.GetObject("bow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to &quot;Artemis&quot;
///{
/// &quot;uri&quot; &quot;http://localhost:{{port}}/csgo_game_event&quot;
@ -105,36 +105,56 @@ namespace Artemis.Properties {
/// &quot;player_weapons&quot; &quot;1&quot;
/// &quot;player_match_stats&quot; &quot;1&quot;
/// }
///}.
/// </summary>
internal static string gamestateConfiguration {
get {
return ResourceManager.GetString("gamestateConfiguration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to /***********************************************************************/
////** © 2015 CD PROJEKT S.A. All rights reserved.
////** THE WITCHER® is a trademark of CD PROJEKT S. A.
////** The Witcher game is based on the prose of Andrzej Sapkowski.
////***********************************************************************/
///
///
///
///
///statemachine class W3PlayerWitcher extends CR4Player
///{
///
/// private saved var craftingSchematics : array&lt;name&gt;;
///
///
/// private saved var alchemyRecipes : array&lt;name&gt;; [rest of string was truncated]&quot;;.
/// </summary>
internal static string playerWitcherWs {
get {
return ResourceManager.GetString("playerWitcherWs", resourceCulture);
}
}
}
}
///}.
/// </summary>
internal static string gamestateConfiguration {
get {
return ResourceManager.GetString("gamestateConfiguration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon logo {
get {
object obj = ResourceManager.GetObject("logo", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon logo_disabled {
get {
object obj = ResourceManager.GetObject("logo_disabled", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /***********************************************************************/
////** © 2015 CD PROJEKT S.A. All rights reserved.
////** THE WITCHER® is a trademark of CD PROJEKT S. A.
////** The Witcher game is based on the prose of Andrzej Sapkowski.
////***********************************************************************/
///
///
///
///
///statemachine class W3PlayerWitcher extends CR4Player
///{
///
/// private saved var craftingSchematics : array&lt;name&gt;;
///
///
/// private saved var alchemyRecipes : array&lt;name&gt;; [rest of string was truncated]&quot;;.
/// </summary>
internal static string playerWitcherWs {
get {
return ResourceManager.GetString("playerWitcherWs", resourceCulture);
}
}
}
}

View File

@ -1,133 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="artemisXml" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\witcher3\artemis.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="bow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="gamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<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>
</data>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="artemisXml" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\witcher3\artemis.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="bow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="gamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo_disabled" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo-disabled.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</data>
</root>

View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -0,0 +1,48 @@
//The MIT License(MIT)
//Copyright(c) 2015 ihtfw
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Threading.Tasks;
namespace Artemis.Services
{
public abstract class DialogService
{
public void ShowErrorMessageBox(Exception e)
{
ShowErrorMessageBox(e.Message);
}
public void ShowErrorMessageBox(string message)
{
ShowMessageBox("Error", message);
}
public abstract void ShowMessageBox(string title, string message);
public abstract bool ShowOpenDialog(out string path, string defaultExt, string filter, string initialDir = null);
public abstract Task<string> ShowInputDialog(string title, string message);
public abstract Task<bool?> ShowQuestionMessageBox(string title, string message);
}
}

View File

@ -0,0 +1,143 @@
//The MIT License(MIT)
//Copyright(c) 2015 ihtfw
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Artemis.ViewModels;
using Caliburn.Micro;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using Microsoft.Win32;
namespace Artemis.Services
{
public class MetroDialogService : DialogService
{
private readonly ShellViewModel _shellViewModel;
public MetroDialogService(ShellViewModel shellViewModel)
{
_shellViewModel = shellViewModel;
}
private MetroWindow GetActiveWindow()
{
MetroWindow window = null;
Execute.OnUIThread(() =>
{
window = Application.Current.Windows.OfType<MetroWindow>().FirstOrDefault(w => w.IsActive);
if (window == null)
{
window = Application.Current.Windows.OfType<MetroWindow>().FirstOrDefault();
}
});
return window;
}
public override void ShowMessageBox(string title, string message)
{
if (_shellViewModel.IsActive == false)
return;
Execute.OnUIThread(() => GetActiveWindow().ShowMessageAsync(title, message));
}
public override async Task<bool?> ShowQuestionMessageBox(string title, string message)
{
if (_shellViewModel.IsActive == false)
return null;
var metroDialogSettings = new MetroDialogSettings {AffirmativeButtonText = "Yes", NegativeButtonText = "No"};
var result =
await
GetActiveWindow()
.ShowMessageAsync(title, message, MessageDialogStyle.AffirmativeAndNegative, metroDialogSettings);
switch (result)
{
case MessageDialogResult.Negative:
return false;
case MessageDialogResult.Affirmative:
return true;
default:
return null;
}
}
public override Task<string> ShowInputDialog(string title, string message)
{
if (_shellViewModel.IsActive == false)
return null;
return GetActiveWindow().ShowInputAsync(title, message);
}
public override bool ShowOpenDialog(out string path, string defaultExt, string filter, string initialDir = null)
{
if (_shellViewModel.IsActive == false)
{
path = null;
return false;
}
bool? res = null;
string lPath = null;
Execute.OnUIThread(() =>
{
var ofd = new OpenFileDialog
{
DefaultExt = defaultExt,
Filter = filter
};
if (initialDir != null)
{
ofd.InitialDirectory = initialDir;
}
if (Application.Current.MainWindow != null)
{
res = ofd.ShowDialog(Application.Current.MainWindow);
}
else
{
res = ofd.ShowDialog();
}
if (res == true)
{
lPath = ofd.FileName;
}
else
{
res = false;
}
});
path = lPath;
return res.Value;
}
}
}

View File

@ -1,98 +1,122 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Settings {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class General : global::System.Configuration.ApplicationSettingsBase {
private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General())));
public static General Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("TypeWave")]
public string LastEffect {
get {
return ((string)(this["LastEffect"]));
}
set {
this["LastEffect"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 RGB")]
public string LastKeyboard {
get {
return ((string)(this["LastKeyboard"]));
}
set {
this["LastKeyboard"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnablePointersUpdate {
get {
return ((bool)(this["EnablePointersUpdate"]));
}
set {
this["EnablePointersUpdate"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("51364")]
public int GamestatePort {
get {
return ((int)(this["GamestatePort"]));
}
set {
this["GamestatePort"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Autorun {
get {
return ((bool)(this["Autorun"]));
}
set {
this["Autorun"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Suspended {
get {
return ((bool)(this["Suspended"]));
}
set {
this["Suspended"] = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Artemis.Settings {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class General : global::System.Configuration.ApplicationSettingsBase {
private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General())));
public static General Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("TypeWave")]
public string LastEffect {
get {
return ((string)(this["LastEffect"]));
}
set {
this["LastEffect"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LastKeyboard {
get {
return ((string)(this["LastKeyboard"]));
}
set {
this["LastKeyboard"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool EnablePointersUpdate {
get {
return ((bool)(this["EnablePointersUpdate"]));
}
set {
this["EnablePointersUpdate"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("51364")]
public int GamestatePort {
get {
return ((int)(this["GamestatePort"]));
}
set {
this["GamestatePort"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Autorun {
get {
return ((bool)(this["Autorun"]));
}
set {
this["Autorun"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Suspended {
get {
return ((bool)(this["Suspended"]));
}
set {
this["Suspended"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ShowOnStartup {
get {
return ((bool)(this["ShowOnStartup"]));
}
set {
this["ShowOnStartup"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool CheckForUpdates {
get {
return ((bool)(this["CheckForUpdates"]));
}
set {
this["CheckForUpdates"] = value;
}
}
}
}

View File

@ -1,26 +1,30 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
<Profiles />
<Settings>
<Setting Name="LastEffect" Type="System.String" Scope="User">
<Value Profile="(Default)">TypeWave</Value>
</Setting>
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
<Value Profile="(Default)">Logitech G910 RGB</Value>
</Setting>
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GamestatePort" Type="System.Int32" Scope="User">
<Value Profile="(Default)">51364</Value>
</Setting>
<Setting Name="Autorun" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Suspended" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
<Profiles />
<Settings>
<Setting Name="LastEffect" Type="System.String" Scope="User">
<Value Profile="(Default)">TypeWave</Value>
</Setting>
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="GamestatePort" Type="System.Int32" Scope="User">
<Value Profile="(Default)">51364</Value>
</Setting>
<Setting Name="Autorun" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Suspended" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="ShowOnStartup" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="CheckForUpdates" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -38,6 +38,26 @@ namespace Artemis.Settings
}
}
public bool CheckForUpdates
{
get { return General.Default.CheckForUpdates; }
set
{
if (General.Default.CheckForUpdates == value) return;
General.Default.CheckForUpdates = value;
}
}
public bool ShowOnStartup
{
get { return General.Default.ShowOnStartup; }
set
{
if (General.Default.ShowOnStartup == value) return;
General.Default.ShowOnStartup = value;
}
}
private void ApplyGamestatePort()
{
// TODO: Restart Gamestate server with new port
@ -71,6 +91,8 @@ namespace Artemis.Settings
GamestatePort = 51364;
EnablePointersUpdate = true;
Autorun = true;
CheckForUpdates = true;
ShowOnStartup = true;
SaveSettings();
}

View File

@ -1,7 +1,9 @@
using System.IO;
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Artemis.Settings;
using Newtonsoft.Json;
@ -29,11 +31,18 @@ namespace Artemis.Utilities.GameState
if (Running)
return;
_listener.Prefixes.Clear();
Port = General.Default.GamestatePort;
_listener.Prefixes.Add($"http://localhost:{Port}/");
_listener.Start();
try
{
_listener.Prefixes.Clear();
Port = General.Default.GamestatePort;
_listener.Prefixes.Add($"http://localhost:{Port}/");
_listener.Start();
}
catch (Exception)
{
MessageBox.Show("Couldn't start the webserver. CS:GO effect won't work :c \n\nTry changing the port in Settings and restart Artemis.");
}
ThreadPool.QueueUserWorkItem(o =>
{
@ -74,6 +83,11 @@ namespace Artemis.Utilities.GameState
Running = true;
}
public void Stop()
{
_listener.Stop();
}
private string HandleRequest(HttpListenerRequest request)
{
object json;

View File

@ -1,31 +1,24 @@
using System.Windows.Forms;
using Gma.System.MouseKeyHook;
using System.Threading.Tasks;
using System.Windows.Forms;
using VirtualInput;
namespace Artemis.Utilities.Keyboard
{
public class KeyboardHook
{
private IKeyboardMouseEvents _mGlobalHook;
public int Subscriptions { get; set; }
public delegate void KeyDownCallbackHandler(KeyEventArgs e);
public void Subscribe(KeyEventHandler handleKeypress)
public KeyboardHook()
{
if (Subscriptions < 1)
_mGlobalHook = Hook.GlobalEvents();
_mGlobalHook.KeyDown += handleKeypress;
Subscriptions++;
VirtualKeyboard.KeyDown += VirtualKeyboardOnKeyDown;
VirtualKeyboard.StartInterceptor();
}
public void Unsubscribe(KeyEventHandler handleKeypress)
private void VirtualKeyboardOnKeyDown(object sender, KeyEventArgs keyEventArgs)
{
_mGlobalHook.KeyDown -= handleKeypress;
Subscriptions--;
if (Subscriptions >= 1)
return;
_mGlobalHook.Dispose();
_mGlobalHook = null;
Task.Factory.StartNew(() => { KeyDownCallback?.Invoke(keyEventArgs); });
}
public event KeyDownCallbackHandler KeyDownCallback;
}
}

View File

@ -1,26 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Artemis.Models
{
public class GamePointersCollectionModel
{
public string Game { get; set; }
public string GameVersion { get; set; }
public List<GamePointer> GameAddresses { get; set; }
}
public class GamePointer
{
public string Description { get; set; }
public IntPtr BasePointer { get; set; }
public int[] Offsets { get; set; }
public override string ToString()
{
return Offsets.Aggregate(BasePointer.ToString("X"),
(current, offset) => current + $"+{offset.ToString("X")}");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
namespace Artemis.Utilities.Memory
{
public class GamePointer
{
public string Description { get; set; }
public IntPtr BasePointer { get; set; }
public int[] Offsets { get; set; }
public override string ToString()
{
return Offsets.Aggregate(BasePointer.ToString("X"),
(current, offset) => current + $"+{offset.ToString("X")}");
}
}
public class GamePointersCollection
{
public string Game { get; set; }
public string GameVersion { get; set; }
public List<GamePointer> GameAddresses { get; set; }
}
}

View File

@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using Artemis.Models;
using Artemis.Settings;
using Newtonsoft.Json;
namespace Artemis.Utilities.Memory
{
@ -18,8 +12,8 @@ namespace Artemis.Utilities.Memory
public static Process GetProcessIfRunning(string processName)
{
var rlProcess = Process.GetProcessesByName(processName);
return rlProcess.Length >= 1 ? rlProcess[0] : null;
var processes = Process.GetProcessesByName(processName);
return processes.Length >= 1 ? processes[0] : null;
}
public static IntPtr FindAddress(IntPtr pHandle, IntPtr baseAddress, IntPtr staticPointer, int[] offsets)
@ -43,35 +37,5 @@ namespace Artemis.Utilities.Memory
}
return address;
}
public static void GetPointers()
{
if (!General.Default.EnablePointersUpdate)
return;
try
{
var jsonClient = new WebClient();
// Random number to get around cache issues
var rand = new Random(DateTime.Now.Millisecond);
var json =
jsonClient.DownloadString(
"https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next());
// Get a list of pointers
var pointers = JsonConvert.DeserializeObject<List<GamePointersCollectionModel>>(json);
// Assign each pointer to the settings file
var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague"));
if (rlPointers != null)
{
Offsets.Default.RocketLeague = rlPointers;
Offsets.Default.Save();
}
}
catch (Exception)
{
// ignored
}
}
}
}

View File

@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Artemis.Services;
using Artemis.Settings;
using Artemis.Utilities.Memory;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Artemis.Utilities
{
public static class Updater
{
public static int CurrentVersion = 102;
public static async Task<Action> CheckForUpdate(MetroDialogService dialogService)
{
if (!General.Default.CheckForUpdates)
return null;
var newRelease = IsUpdateAvailable();
if (newRelease == null)
return null;
var viewUpdate = await
dialogService.ShowQuestionMessageBox("Update available",
$"A new version of Artemis is available, version {newRelease["tag_name"].Value<string>()}.\n" +
"Do you wish to view the update on GitHub now?\n\n" +
"Note: You can disable update notifications in the settings menu");
if (viewUpdate.Value)
Process.Start(new ProcessStartInfo(newRelease["html_url"].Value<string>()));
return null;
}
public static JObject IsUpdateAvailable()
{
if (!General.Default.EnablePointersUpdate)
return null;
try
{
var jsonClient = new WebClient();
// GitHub trips if we don't add a user agent
jsonClient.Headers.Add("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
// Random number to get around cache issues
var rand = new Random(DateTime.Now.Millisecond);
var json =
jsonClient.DownloadString("https://api.github.com/repos/SpoinkyNL/Artemis/releases/latest?random=" +
rand.Next());
// Get a list of pointers
var release = JsonConvert.DeserializeObject<JObject>(json);
// Parse a version number string to an int
var remoteVersion = int.Parse(release["tag_name"].Value<string>().Replace(".", ""));
return remoteVersion > CurrentVersion ? release : null;
}
catch (Exception)
{
return null;
}
}
public static void GetPointers()
{
if (!General.Default.EnablePointersUpdate)
return;
try
{
var jsonClient = new WebClient();
// Random number to get around cache issues
var rand = new Random(DateTime.Now.Millisecond);
var json =
jsonClient.DownloadString(
"https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next());
// Get a list of pointers
var pointers = JsonConvert.DeserializeObject<List<GamePointersCollection>>(json);
// Assign each pointer to the settings file
var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague"));
if (rlPointers != null)
{
Offsets.Default.RocketLeague = rlPointers;
Offsets.Default.Save();
}
}
catch (Exception)
{
// ignored
}
}
}
}

View File

@ -0,0 +1,79 @@
using Artemis.Managers;
using Artemis.Models;
using Caliburn.Micro;
namespace Artemis.ViewModels.Abstract
{
public abstract class EffectViewModel : Screen
{
private EffectSettings _effectSettings;
private bool _showDisabledPopup;
public EffectModel EffectModel { get; set; }
public MainManager MainManager { get; set; }
public EffectSettings EffectSettings
{
get { return _effectSettings; }
set
{
if (Equals(value, _effectSettings)) return;
_effectSettings = value;
NotifyOfPropertyChange(() => EffectSettings);
}
}
public bool EffectEnabled => MainManager.EffectManager.ActiveEffect == EffectModel;
public bool ShowDisabledPopup
{
get { return _showDisabledPopup; }
set
{
if (value == _showDisabledPopup) return;
_showDisabledPopup = value;
NotifyOfPropertyChange(() => ShowDisabledPopup);
}
}
public void ToggleEffect()
{
if (!MainManager.ProgramEnabled)
{
NotifyOfPropertyChange(() => EffectEnabled);
ShowDisabledPopup = true;
return;
}
if (EffectEnabled)
MainManager.EffectManager.ClearEffect();
else
MainManager.EffectManager.ChangeEffect(EffectModel);
}
public void SaveSettings()
{
EffectSettings?.Save();
if (!EffectEnabled)
return;
// Restart the effect if it's currently running to apply settings.
MainManager.EffectManager.ChangeEffect(EffectModel, true);
}
public async void ResetSettings()
{
var resetConfirm = await
MainManager.DialogService.ShowQuestionMessageBox("Reset effect settings",
"Are you sure you wish to reset this effect's settings? \nAny changes you made will be lost.");
if (!resetConfirm.Value)
return;
EffectSettings.ToDefault();
NotifyOfPropertyChange(() => EffectSettings);
SaveSettings();
}
}
}

View File

@ -0,0 +1,57 @@
using Artemis.Managers;
using Artemis.Models;
using Caliburn.Micro;
namespace Artemis.ViewModels.Abstract
{
public abstract class GameViewModel : Screen
{
private GameSettings _gameSettings;
public GameModel GameModel { get; set; }
public MainManager MainManager { get; set; }
public GameSettings GameSettings
{
get { return _gameSettings; }
set
{
if (Equals(value, _gameSettings)) return;
_gameSettings = value;
NotifyOfPropertyChange(() => GameSettings);
}
}
public bool GameEnabled => MainManager.EffectManager.ActiveEffect == GameModel;
public void ToggleEffect()
{
GameModel.Enabled = GameSettings.Enabled;
}
public void SaveSettings()
{
GameSettings?.Save();
if (!GameEnabled)
return;
// Restart the game if it's currently running to apply settings.
MainManager.EffectManager.ChangeEffect(GameModel, true);
}
public async void ResetSettings()
{
var resetConfirm = await
MainManager.DialogService.ShowQuestionMessageBox("Reset effect settings",
"Are you sure you wish to reset this effect's settings? \nAny changes you made will be lost.");
if (!resetConfirm.Value)
return;
GameSettings.ToDefault();
NotifyOfPropertyChange(() => GameSettings);
SaveSettings();
}
}
}

View File

@ -1,4 +1,4 @@
using Artemis.Models;
using Artemis.Managers;
using Artemis.Modules.Effects.AudioVisualizer;
using Artemis.Modules.Effects.Debug;
using Artemis.Modules.Effects.TypeHole;
@ -14,12 +14,12 @@ namespace Artemis.ViewModels
private readonly TypeHoleViewModel _typeHoleVm;
private readonly TypeWaveViewModel _typeWaveVm;
public EffectsViewModel(MainModel mainModel)
public EffectsViewModel(MainManager mainManager)
{
_typeWaveVm = new TypeWaveViewModel(mainModel) {DisplayName = "Type Waves"};
//_typeHoleVm = new TypeHoleViewModel(mainModel) {DisplayName = "Type Holes (NYI)"};
_audioVisualizerVm = new AudioVisualizerViewModel(mainModel) {DisplayName = "Audio Visualization"};
_debugVm = new DebugEffectViewModel(mainModel) {DisplayName = "Debug Effect"};
_typeWaveVm = new TypeWaveViewModel(mainManager) {DisplayName = "Type Waves"};
//_typeHoleVm = new TypeHoleViewModel(MainManager) {DisplayName = "Type Holes (NYI)"};
_audioVisualizerVm = new AudioVisualizerViewModel(mainManager) {DisplayName = "Audio Visualization"};
_debugVm = new DebugEffectViewModel(mainManager) {DisplayName = "Debug Effect"};
}
protected override void OnActivate()

View File

@ -1,27 +1,28 @@
using System.Diagnostics;
using System.Linq;
using Artemis.Events;
using Artemis.Models;
using Artemis.Managers;
using Artemis.Settings;
using Caliburn.Micro;
using MahApps.Metro.Controls;
namespace Artemis.ViewModels.Flyouts
{
public class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled>
public class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled>, IHandle<ActiveEffectChanged>
{
private string _activeEffectName;
private bool _enabled;
private GeneralSettings _generalSettings;
private string _selectedKeyboardProvider;
public FlyoutSettingsViewModel(MainModel mainModel)
public FlyoutSettingsViewModel(MainManager mainManager)
{
MainModel = mainModel;
Header = "settings";
MainManager = mainManager;
Header = "Settings";
Position = Position.Right;
GeneralSettings = new GeneralSettings();
MainModel.Events.Subscribe(this);
MainManager.Events.Subscribe(this);
}
public GeneralSettings GeneralSettings
@ -35,10 +36,18 @@ namespace Artemis.ViewModels.Flyouts
}
}
public MainModel MainModel { get; set; }
public MainManager MainManager { get; set; }
public BindableCollection<string> KeyboardProviders
=> new BindableCollection<string>(MainModel.KeyboardProviders.Select(k => k.Name));
{
get
{
var collection = new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders
.Select(k => k.Name));
collection.Insert(0, "None");
return collection;
}
}
public string SelectedKeyboardProvider
{
@ -51,33 +60,52 @@ namespace Artemis.ViewModels.Flyouts
if (value == null)
return;
MainModel.ChangeKeyboard(MainModel.KeyboardProviders.First(k => k.Name == _selectedKeyboardProvider));
MainManager.KeyboardManager.ChangeKeyboard(
MainManager.KeyboardManager.KeyboardProviders.FirstOrDefault(
k => k.Name == _selectedKeyboardProvider));
}
}
public bool Enabled
{
get { return _enabled; }
get { return MainManager.ProgramEnabled; }
set
{
if (value == _enabled) return;
_enabled = value;
NotifyOfPropertyChange(() => Enabled);
if (value)
MainManager.EnableProgram();
else
MainManager.DisableProgram();
}
}
public string ActiveEffectName
{
get { return _activeEffectName; }
set
{
if (value == _activeEffectName) return;
_activeEffectName = value;
NotifyOfPropertyChange(() => ActiveEffectName);
}
}
public void Handle(ActiveEffectChanged message)
{
var effectDisplay = message.ActiveEffect.Length > 0 ? message.ActiveEffect : "none";
ActiveEffectName = $"Active effect: {effectDisplay}";
}
public void Handle(ToggleEnabled message)
{
Enabled = message.Enabled;
NotifyOfPropertyChange(() => Enabled);
}
public void ToggleEnabled()
{
if (Enabled)
MainModel.ShutdownEffects();
MainManager.DisableProgram();
else
MainModel.StartEffects();
MainManager.EnableProgram();
}
public void ResetSettings()
@ -98,7 +126,9 @@ namespace Artemis.ViewModels.Flyouts
protected override void HandleOpen()
{
SelectedKeyboardProvider = MainModel.ActiveKeyboard?.Name;
SelectedKeyboardProvider = General.Default.LastKeyboard.Length > 0
? General.Default.LastKeyboard
: "None";
}
}
}

View File

@ -1,4 +1,4 @@
using Artemis.Models;
using Artemis.Managers;
using Artemis.Modules.Games.CounterStrike;
using Artemis.Modules.Games.Dota2;
using Artemis.Modules.Games.RocketLeague;
@ -14,12 +14,12 @@ namespace Artemis.ViewModels
private readonly RocketLeagueViewModel _rocketLeagueVm;
private readonly Witcher3ViewModel _witcher3Vm;
public GamesViewModel(MainModel mainModel)
public GamesViewModel(MainManager mainManager)
{
_rocketLeagueVm = new RocketLeagueViewModel(mainModel) {DisplayName = "Rocket League"};
_counterStrikeVm = new CounterStrikeViewModel(mainModel) {DisplayName = "CS:GO"};
//_dota2Vm = new Dota2ViewModel(mainModel) {DisplayName = "Dota 2 (NYI)"};
_witcher3Vm = new Witcher3ViewModel(mainModel) {DisplayName = "The Witcher 3"};
_rocketLeagueVm = new RocketLeagueViewModel(mainManager) {DisplayName = "Rocket League"};
_counterStrikeVm = new CounterStrikeViewModel(mainManager) {DisplayName = "CS:GO"};
//_dota2Vm = new Dota2ViewModel(MainManager) {DisplayName = "Dota 2 (NYI)"};
_witcher3Vm = new Witcher3ViewModel(mainManager) {DisplayName = "The Witcher 3"};
}
protected override void OnActivate()

View File

@ -1,4 +1,4 @@
using Artemis.Models;
using Artemis.Managers;
using Artemis.Modules.Overlays.VolumeDisplay;
using Caliburn.Micro;
@ -6,12 +6,12 @@ namespace Artemis.ViewModels
{
public class OverlaysViewModel : Conductor<IScreen>.Collection.OneActive
{
private readonly MainModel _mainModel;
private readonly MainManager _mainManager;
private VolumeDisplayViewModel _volumeDisplayVm;
public OverlaysViewModel(MainModel mainModel)
public OverlaysViewModel(MainManager mainManager)
{
_mainModel = mainModel;
_mainManager = mainManager;
}
protected override void OnActivate()
@ -21,7 +21,7 @@ namespace Artemis.ViewModels
Items.Clear();
// This VM appears to be going out of scope, so recreating it every time just to be sure.
_volumeDisplayVm = new VolumeDisplayViewModel(_mainModel) { DisplayName = "Volume Display" };
_volumeDisplayVm = new VolumeDisplayViewModel(_mainManager) {DisplayName = "Volume Display"};
ActivateItem(_volumeDisplayVm);
ActiveItem = _volumeDisplayVm;
}

View File

@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Windows;
using Artemis.Models;
using System.Linq;
using Artemis.Managers;
using Artemis.Services;
using Artemis.ViewModels.Flyouts;
using Caliburn.Micro;
@ -16,22 +15,24 @@ namespace Artemis.ViewModels
public ShellViewModel()
{
var dialogService = new MetroDialogService(this);
IEventAggregator events = new EventAggregator();
MainModel = new MainModel(events);
MainManager = new MainManager(events, dialogService);
DisplayName = "Artemis";
_welcomeVm = new WelcomeViewModel {DisplayName = "Welcome"};
_effectsVm = new EffectsViewModel(MainModel) {DisplayName = "Effects"};
_gamesVm = new GamesViewModel(MainModel) {DisplayName = "Games"};
_overlaysVm = new OverlaysViewModel(MainModel) {DisplayName = "Overlays"};
_effectsVm = new EffectsViewModel(MainManager) {DisplayName = "Effects"};
_gamesVm = new GamesViewModel(MainManager) {DisplayName = "Games"};
_overlaysVm = new OverlaysViewModel(MainManager) {DisplayName = "Overlays"};
Flyouts.Add(new FlyoutSettingsViewModel(MainModel));
Flyouts.Add(new FlyoutSettingsViewModel(MainManager));
}
public IObservableCollection<FlyoutBaseViewModel> Flyouts { get; set; } =
new BindableCollection<FlyoutBaseViewModel>();
public MainModel MainModel { get; set; }
public MainManager MainManager { get; set; }
protected override void OnActivate()
{
@ -45,15 +46,14 @@ namespace Artemis.ViewModels
ActiveItem = _welcomeVm;
}
public void OnClose(EventArgs e)
{
MainModel.ShutdownEffects();
Application.Current.Shutdown();
}
public void Settings()
{
Flyouts.First().IsOpen = !Flyouts.First().IsOpen;
}
public void CloseSettings()
{
Flyouts.First().IsOpen = false;
}
}
}

View File

@ -1,5 +1,9 @@
using System.Windows;
using System;
using System.Windows;
using Artemis.Events;
using Artemis.Properties;
using Artemis.Settings;
using Artemis.Utilities;
using Caliburn.Micro;
namespace Artemis.ViewModels
@ -9,31 +13,22 @@ namespace Artemis.ViewModels
private readonly ShellViewModel _shellViewModel;
private readonly IWindowManager _windowManager;
private string _activeIcon;
private bool _checkedForUpdate;
private bool _enabled;
private string _toggleText;
/*
* NOTE: In this sample the system tray view-model doesn't receive any notification
* when the other window gets closed by pressing the top right 'x'.
* Thus no property notification is invoked, and system tray context-menu appears
* out of sync, still allowing 'Hide' and disabling 'Show'.
* Given the purpose of the sample - integrating Caliburn.Micro with WPF NotifyIcon -
* sync'ing the two view-models is not of interest here.
* */
public SystemTrayViewModel(IWindowManager windowManager, ShellViewModel shellViewModel)
{
_windowManager = windowManager;
_shellViewModel = shellViewModel;
_shellViewModel.MainModel.Events.Subscribe(this);
_shellViewModel.MainManager.Events.Subscribe(this);
_shellViewModel.MainManager.EnableProgram();
_checkedForUpdate = false;
//ActiveIcon = "../logo.ico";
/*
* By now Effects are added to the MainModel so we can savely start
* This is done from here to make sure all UI elements listening to
* events will receive the first ToggleEnabled event
* */
_shellViewModel.MainModel.StartEffects();
// TODO: Check if show on startup is enabled, if so, show window.
if (General.Default.ShowOnStartup)
ShowWindow();
}
public bool CanShowWindow => !_shellViewModel.IsActive;
@ -49,10 +44,21 @@ namespace Artemis.ViewModels
_enabled = value;
ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis";
ActiveIcon = _enabled ? "../Resources/logo.ico" : "../Resources/logo-disabled.ico";
NotifyOfPropertyChange(() => Enabled);
}
}
public string ActiveIcon
{
get { return _activeIcon; }
set
{
_activeIcon = value;
NotifyOfPropertyChange();
}
}
public string ToggleText
{
get { return _toggleText; }
@ -72,9 +78,9 @@ namespace Artemis.ViewModels
public void ToggleEnabled()
{
if (Enabled)
_shellViewModel.MainModel.ShutdownEffects();
_shellViewModel.MainManager.DisableProgram();
else
_shellViewModel.MainModel.StartEffects();
_shellViewModel.MainManager.EnableProgram();
}
protected override void OnActivate()
@ -95,8 +101,15 @@ namespace Artemis.ViewModels
NotifyOfPropertyChange(() => CanShowWindow);
NotifyOfPropertyChange(() => CanHideWindow);
if (_checkedForUpdate)
return;
_checkedForUpdate = true;
Updater.CheckForUpdate(_shellViewModel.MainManager.DialogService);
}
public void HideWindow()
{
if (!CanHideWindow)
@ -110,8 +123,11 @@ namespace Artemis.ViewModels
public void ExitApplication()
{
_shellViewModel.MainModel.ShutdownEffects();
_shellViewModel.MainManager.Shutdown();
Application.Current.Shutdown();
// Sometimes you need to be rough.
Environment.Exit(0);
}
}
}

View File

@ -6,7 +6,7 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
d:DesignHeight="600" d:DesignWidth="300"
Width="300">
<UserControl.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
@ -24,6 +24,8 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@ -32,8 +34,7 @@
Content="Enable Artemis:" />
<controls:ToggleSwitch Grid.Row="0" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=Enabled, Mode=OneWay}"
cal:Message.Attach="[Event Unchecked] = [Action ToggleEnabled]; [Event Checked] = [Action ToggleEnabled]" />
IsChecked="{Binding Path=Enabled, Mode=TwoWay}" />
<!-- Startup with Windows -->
<Label Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
@ -42,38 +43,52 @@
IsChecked="{Binding Path=GeneralSettings.Autorun, Mode=TwoWay}"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" />
<!-- Keyboard selection -->
<!-- Show on startup -->
<Label Grid.Row="2" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Show on startup:" />
<controls:ToggleSwitch Grid.Row="2" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
IsChecked="{Binding Path=GeneralSettings.ShowOnStartup, Mode=TwoWay}"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" />
<!-- Keyboard selection -->
<Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Keyboard:" />
<ComboBox Grid.Row="2" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center"
<ComboBox Grid.Row="3" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right"
Width="140" />
<!-- TODO: Ugly -->
<!-- Gamestate port -->
<Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
<Label Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Gamestate server port:" />
<controls:NumericUpDown Grid.Row="3" Grid.Column="1" Margin="10" VerticalAlignment="Center"
<controls:NumericUpDown Grid.Row="4" Grid.Column="1" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="120"
Value="{Binding Path=GeneralSettings.GamestatePort, Mode=TwoWay}" />
<!-- Updates check -->
<Label Grid.Row="5" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Check for updates:" />
<controls:ToggleSwitch Grid.Row="5" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.CheckForUpdates, Mode=TwoWay}" />
<!-- Update pointers -->
<Label Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
<Label Grid.Row="6" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Download pointers:" />
<controls:ToggleSwitch Grid.Row="4" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
<controls:ToggleSwitch Grid.Row="6" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.EnablePointersUpdate, Mode=TwoWay}" />
<!-- Buttons -->
<Button Grid.Row="5" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
<Button Grid.Row="7" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
VerticalAlignment="Center" HorizontalAlignment="Left" Width="120"
Style="{DynamicResource SquareButtonStyle}" />
<Button Grid.Row="5" Grid.Column="1" Margin="10" x:Name="SaveSettings" Content="Save changes"
<Button Grid.Row="7" Grid.Column="1" Margin="10" x:Name="SaveSettings" Content="Save changes"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="120"
Style="{DynamicResource SquareButtonStyle}" />
<!-- Version -->
<Grid Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
@ -82,11 +97,14 @@
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Artemis 1.0.0" VerticalAlignment="Center"
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" x:Name="ActiveEffectName" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Artemis 1.0.2" VerticalAlignment="Center"
HorizontalAlignment="Left" />
<Button Grid.Row="0" Grid.Column="1" Focusable="False" Style="{StaticResource AccentedSquareButtonStyle}"
<Button Grid.Row="1" Grid.Column="1" Focusable="False"
Style="{StaticResource AccentedSquareButtonStyle}"
cal:Message.Attach="[Action NavigateTo('https://github.com/SpoinkyNL/Artemis')]"
Content="View on GitHub" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Right" />
Content="View on GitHub" Margin="5,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Right" />
</Grid>
</Grid>
</UserControl>

View File

@ -5,10 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:cal="http://www.caliburnproject.org"
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
dialogs:DialogParticipation.Register="{Binding RelativeSource={RelativeSource Self}, Path=DataContext}"
mc:Ignorable="d"
Title="Artemis" Height="670" Width="690"
MinWidth="500" MinHeight="400"
GlowBrush="{DynamicResource AccentColorBrush}" Icon="/Artemis;component/logo.ico">
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../logo.ico">
<!-- Bit of extra code to use a different icon than in the taskbar -->
<Controls:MetroWindow.IconTemplate>
<DataTemplate>
@ -62,7 +64,7 @@
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
</Grid.Resources>
<TabControl Margin="0,10,10,10" TabStripPlacement="Left" x:Name="Items">
<TabControl Margin="0,10,10,10" TabStripPlacement="Left" x:Name="Items" cal:Message.Attach="[Event GotFocus] = [Action CloseSettings]">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding DisplayName}" />

View File

@ -24,7 +24,7 @@
<!-- the application main system tray icon -->
<tb:TaskbarIcon x:Key="SystemTrayIcon"
IconSource="../logo.ico"
IconSource="{Binding Path=ActiveIcon, Mode=OneWay}"
ToolTipText="Artemis"
cal:Message.Attach="[Event TrayMouseDoubleClick] = [Action ShowWindow]"
ContextMenu="{StaticResource MainSysTrayMenu}" />

View File

@ -28,8 +28,8 @@
</Label>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#070707" MaxWidth="520" TextAlignment="Justify">
TextWrapping="Wrap" HorizontalAlignment="Left"
MaxWidth="520" TextAlignment="Justify">
Hello, <LineBreak /><LineBreak />
Thanks a bunch for downloading this application. You're going to enjoy this! :)<LineBreak />
<LineBreak />

View File

@ -1,19 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="4.0.0-rc1-177" targetFramework="net452" />
<package id="Caliburn.Micro" version="2.0.2" targetFramework="net452" />
<package id="Caliburn.Micro.AutofacBootstrap" version="2.0.9-beta" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="2.0.2" targetFramework="net452" />
<package id="Colore" version="4.0.0" targetFramework="net452" />
<package id="CUE.NET" version="1.0.2" targetFramework="net452" />
<package id="CUE.NET" version="1.0.2.1" targetFramework="net452" />
<package id="Extended.Wpf.Toolkit" version="2.6" targetFramework="net452" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.5" targetFramework="net452" />
<package id="log4net" version="2.0.5" targetFramework="net452" />
<package id="MahApps.Metro" version="1.2.4.0" targetFramework="net452" />
<package id="MahApps.Metro.Resources" version="0.4.0.0" targetFramework="net452" />
<package id="MouseKeyHook" version="5.4.0" targetFramework="net452" />
<package id="NAudio" version="1.7.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" />
<package id="VirtualInput" version="1.0.1" targetFramework="net452" />
<package id="WpfExceptionViewer" version="1.0.0.0" targetFramework="net452" />
</packages>

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Select a Product Configuration -->
<InstallShieldProductConfiguration>Express</InstallShieldProductConfiguration>
<!-- Select a Visual Studio Configuration / InstallShield Release -->
<Configuration>Debug</Configuration>
<InstallShieldRelease>$(Configuration)</InstallShieldRelease>
</PropertyGroup>
<ItemGroup>
<!-- The InstallShieldProject item selects the project to build -->
<InstallShieldProject Include="$(MSBuildProjectDirectory)\$(MSBuildProjectName).isl"/>
<!-- The InstallShieldReleaseFlags sets Release Flags -->
<!--<InstallShieldReleaseFlags Include=""/>-->
<!-- The InstallShieldMergeModulePath specifies what directories are
searched for Merge Modules -->
<!--<InstallShieldMergeModulePath Include=""/>-->
</ItemGroup>
<ItemGroup>
<!-- The ProjectReference items refer to any Visual Studio solutions you want to automatically probe for Project Output Groups. -->
</ItemGroup>
<ItemGroup>
<!-- The TaggedOutputs items allow you to explicitly add extra files to output groups. Each item must include both Name and OutputGroup, as well as TargetPath metadata values. -->
<!--<TaggedOutputs Include="C:\My Test Exe.exe">
<Name>My Test Project</Name>
<OutputGroup>Primary output</OutputGroup>
<TargetPath>My Test Exe.exe</TargetPath>
</TaggedOutputs> -->
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\InstallShield\2015Limited\InstallShield.targets"/>
</Project>