mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Effects to module rewrite
This commit is contained in:
parent
88e5901b67
commit
791ae89a80
@ -1,304 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="Artemis.Modules.Games.EurotruckSimulator2.EurotruckSimulator2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.UnrealTournament.UnrealTournament" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.WoW.WoW" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Effects.Bubbles.Bubbles" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Effects.WindowsProfile.WindowsProfile" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.Overwatch.Overwatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.TheDivision.TheDivision" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.Dota2.Dota2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<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>
|
||||
<configSections />
|
||||
<connectionStrings />
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<Artemis.Modules.Games.EurotruckSimulator2.EurotruckSimulator2>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Artemis.Modules.Games.EurotruckSimulator2.EurotruckSimulator2>
|
||||
<Artemis.Modules.Games.UnrealTournament.UnrealTournament>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Artemis.Modules.Games.UnrealTournament.UnrealTournament>
|
||||
<Artemis.Modules.Games.WoW.WoW>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.WoW.WoW>
|
||||
<Artemis.Modules.Effects.WindowsProfile.WindowsProfile>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Demo (Duplicate to keep changes)</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Effects.WindowsProfile.WindowsProfile>
|
||||
<Artemis.Modules.Games.Overwatch.Overwatch>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Artemis.Modules.Games.Overwatch.Overwatch>
|
||||
<Artemis.Modules.Games.TheDivision.TheDivision>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.TheDivision.TheDivision>
|
||||
<Artemis.Modules.Games.Dota2.Dota2>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Artemis.Modules.Games.Dota2.Dota2>
|
||||
<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>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.RocketLeague.RocketLeague>
|
||||
<Artemis.Settings.Offsets>
|
||||
<setting name="RocketLeague" serializeAs="String">
|
||||
<value>{"Game":"RocketLeague","GameVersion":"1.10","GameAddresses":[{"Description":"Boost","BasePointer":{"value":21998084},"Offsets":[88,1452,1780,540]}]}</value>
|
||||
</setting>
|
||||
<setting name="Witcher3" serializeAs="String">
|
||||
<value>{"Game":"Witcher3","GameVersion":"1.11","GameAddresses":[{"Description":"Sign","BasePointer":{"value":42942304},"Offsets":[40,16,32,3008]}]}</value>
|
||||
</setting>
|
||||
</Artemis.Settings.Offsets>
|
||||
<Artemis.Modules.Games.Witcher3.Witcher3>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.Witcher3.Witcher3>
|
||||
<Artemis.Modules.Effects.AudioVisualizer.AudioVisualization>
|
||||
<setting name="Sensitivity" serializeAs="String">
|
||||
<value>4</value>
|
||||
</setting>
|
||||
<setting name="Bars" serializeAs="String">
|
||||
<value>21</value>
|
||||
</setting>
|
||||
<setting name="FromBottom" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="FadeSpeed" serializeAs="String">
|
||||
<value>3</value>
|
||||
</setting>
|
||||
<setting name="TopColor" serializeAs="String">
|
||||
<value>#FFF90000</value>
|
||||
</setting>
|
||||
<setting name="MiddleColor" serializeAs="String">
|
||||
<value>#FFFF761E</value>
|
||||
</setting>
|
||||
<setting name="BottomColor" serializeAs="String">
|
||||
<value>#FF00DF00</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Effects.AudioVisualizer.AudioVisualization>
|
||||
<Artemis.Modules.Games.CounterStrike.CounterStrike>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Artemis.Modules.Games.CounterStrike.CounterStrike>
|
||||
<Artemis.Settings.CounterStrike>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value>C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive</value>
|
||||
</setting>
|
||||
<setting name="AmmoEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AmmoMainColor" serializeAs="String">
|
||||
<value>#FFFF2900</value>
|
||||
</setting>
|
||||
<setting name="AmmoSecondaryColor" serializeAs="String">
|
||||
<value>#FF26F600</value>
|
||||
</setting>
|
||||
<setting name="TeamColorEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="FlashEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="SmokeEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LowHpEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</Artemis.Settings.CounterStrike>
|
||||
<Artemis.Settings.AudioVisualization>
|
||||
<setting name="Sensitivity" serializeAs="String">
|
||||
<value>4</value>
|
||||
</setting>
|
||||
<setting name="Bars" serializeAs="String">
|
||||
<value>21</value>
|
||||
</setting>
|
||||
<setting name="Spread" serializeAs="String">
|
||||
<value>1</value>
|
||||
</setting>
|
||||
<setting name="FadeSpeed" serializeAs="String">
|
||||
<value>3</value>
|
||||
</setting>
|
||||
<setting name="MainColor" serializeAs="String">
|
||||
<value>#FF0000FF</value>
|
||||
</setting>
|
||||
<setting name="SecondaryColor" serializeAs="String">
|
||||
<value>#FF1E90FF</value>
|
||||
</setting>
|
||||
</Artemis.Settings.AudioVisualization>
|
||||
<Artemis.Settings.RocketLeague>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="MainColor" serializeAs="String">
|
||||
<value>#FFFF5000</value>
|
||||
</setting>
|
||||
<setting name="SecondaryColor" serializeAs="String">
|
||||
<value>#FFFF0000</value>
|
||||
</setting>
|
||||
</Artemis.Settings.RocketLeague>
|
||||
<Artemis.Properties.Settings>
|
||||
<setting name="LastEffect" serializeAs="String">
|
||||
<value>TypeWave</value>
|
||||
</setting>
|
||||
</Artemis.Properties.Settings>
|
||||
<Artemis.Settings.TypeWave>
|
||||
<setting name="IsRandomColors" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="WaveColor" serializeAs="String">
|
||||
<value>#FFFF0000</value>
|
||||
</setting>
|
||||
<setting name="IsShiftColors" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="ShiftColorSpeed" serializeAs="String">
|
||||
<value>20</value>
|
||||
</setting>
|
||||
<setting name="TimeToLive" serializeAs="String">
|
||||
<value>500</value>
|
||||
</setting>
|
||||
<setting name="SpreadSpeed" serializeAs="String">
|
||||
<value>4</value>
|
||||
</setting>
|
||||
</Artemis.Settings.TypeWave>
|
||||
<Artemis.Modules.Effects.Bubbles.Bubbles>
|
||||
<setting name="IsRandomColors" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="BubbleColor" serializeAs="String">
|
||||
<value>#FFFF0000</value>
|
||||
</setting>
|
||||
<setting name="IsShiftColors" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="BubbleSize" serializeAs="String">
|
||||
<value>25</value>
|
||||
</setting>
|
||||
<setting name="MoveSpeed" serializeAs="String">
|
||||
<value>4</value>
|
||||
</setting>
|
||||
<setting name="ShiftColorSpeed" serializeAs="String">
|
||||
<value>12</value>
|
||||
</setting>
|
||||
<setting name="BubbleCount" serializeAs="String">
|
||||
<value>14</value>
|
||||
</setting>
|
||||
<setting name="Smoothness" serializeAs="String">
|
||||
<value>25</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Effects.Bubbles.Bubbles>
|
||||
<Artemis.Settings.General>
|
||||
<setting name="LastEffect" serializeAs="String">
|
||||
<value>WindowsProfile</value>
|
||||
</setting>
|
||||
<setting name="LastKeyboard" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="EnablePointersUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="GamestatePort" serializeAs="String">
|
||||
<value>51364</value>
|
||||
</setting>
|
||||
<setting name="Autorun" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="Suspended" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ShowOnStartup" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="AutoUpdate" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="Theme" serializeAs="String">
|
||||
<value>Light</value>
|
||||
</setting>
|
||||
<setting name="LogLevel" serializeAs="String">
|
||||
<value>Info</value>
|
||||
</setting>
|
||||
</Artemis.Settings.General>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
@ -337,7 +44,6 @@
|
||||
<assemblyIdentity name="DeltaCompressionDotNet.MsDelta" publicKeyToken="46b2138a390abf55" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</assemblyBinding></runtime>
|
||||
|
||||
</configuration>
|
||||
@ -131,24 +131,24 @@
|
||||
<HintPath>..\packages\Betwixt.1.4.1\lib\net35\Betwixt.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro, Version=3.0.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.0.1\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
<Reference Include="Caliburn.Micro, Version=3.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.Core.3.0.2\lib\net45\Caliburn.Micro.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro.Platform, Version=3.0.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.3.0.1\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
|
||||
<Reference Include="Caliburn.Micro.Platform, Version=3.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.3.0.2\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.0.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.3.0.1\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
|
||||
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.0.2.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Caliburn.Micro.3.0.2\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Corale.Colore, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Colore.5.0.0\lib\net35\Corale.Colore.dll</HintPath>
|
||||
<Reference Include="Corale.Colore, Version=5.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Colore.5.1.0\lib\net35\Corale.Colore.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CUE.NET, Version=1.1.0.2, Culture=neutral, processorArchitecture=MSIL">
|
||||
@ -236,7 +236,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.3.10\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.4.1\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@ -255,8 +255,8 @@
|
||||
<HintPath>..\packages\SharpDX.Direct3D9.3.1.1\lib\net45\SharpDX.Direct3D9.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath>
|
||||
<Reference Include="Splat, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Splat.2.0.0\lib\Net45\Splat.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SpotifyAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@ -333,7 +333,7 @@
|
||||
<Compile Include="Dialogs\MarkdownDialog.xaml.cs">
|
||||
<DependentUpon>MarkdownDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Events\EffectChangedEventArgs.cs" />
|
||||
<Compile Include="Events\ModuleChangedEventArgs.cs" />
|
||||
<Compile Include="Events\EnabledChangedEventArgs.cs" />
|
||||
<Compile Include="Events\KeyboardChangedEventArgs.cs" />
|
||||
<Compile Include="Events\ProfileDeviceEventsArg.cs" />
|
||||
@ -349,16 +349,17 @@
|
||||
<Compile Include="DeviceProviders\Logitech\Utilities\OrionUtilities.cs" />
|
||||
<Compile Include="DeviceProviders\Razer\BlackWidow.cs" />
|
||||
<Compile Include="DeviceProviders\Razer\Utilities\RazerUtilities.cs" />
|
||||
<Compile Include="Managers\EffectManager.cs" />
|
||||
<Compile Include="Managers\ModuleManager.cs" />
|
||||
<Compile Include="Managers\DeviceManager.cs" />
|
||||
<Compile Include="Managers\LoopManager.cs" />
|
||||
<Compile Include="Managers\LuaManager.cs" />
|
||||
<Compile Include="Managers\MainManager.cs" />
|
||||
<Compile Include="Managers\ProfileManager.cs" />
|
||||
<Compile Include="Models\EffectModel.cs" />
|
||||
<Compile Include="Models\Interfaces\IDataModel.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\Bubbles.cs" />
|
||||
<Compile Include="Modules\Effects\WindowsProfile\PerformanceInfo.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleDataModel.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
||||
<Compile Include="Modules\Abstract\ModuleViewModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\PerformanceInfo.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\Ets2TelemetryData.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\Ets2TelemetryDataReader.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\Data\IEts2TelemetryData.cs" />
|
||||
@ -454,6 +455,13 @@
|
||||
<Compile Include="Modules\Games\WoW\WoWSettings.cs" />
|
||||
<Compile Include="Modules\Games\WoW\WoWViewModel.cs" />
|
||||
<Compile Include="Modules\Games\WoW\WoWAddresses.cs" />
|
||||
<Compile Include="Modules\Overlays\OverlayProfile\OverlayProfileDataModel.cs" />
|
||||
<Compile Include="Modules\Overlays\OverlayProfile\OverlayProfileModel.cs" />
|
||||
<Compile Include="Modules\Overlays\OverlayProfile\OverlayProfileSettings.cs" />
|
||||
<Compile Include="Modules\Overlays\OverlayProfile\OverlayProfileView.xaml.cs">
|
||||
<DependentUpon>OverlayProfileView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Overlays\OverlayProfile\OverlayProfileViewModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Animations\NoneAnimation.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\EventPropertiesModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\KeyboardEventPropertiesModel.cs" />
|
||||
@ -481,6 +489,8 @@
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\ScreenCapturing\IScreenCapture.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\AmbientLight\ScreenCapturing\ScreenCaptureManager.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Audio\AudioCapturing\AudioCaptureManager.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Audio\AudioCapturing\FftEventArgs.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Audio\AudioCapturing\SampleAggregator.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Audio\AudioPropertiesModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Audio\AudioPropertiesView.xaml.cs">
|
||||
<DependentUpon>AudioPropertiesView.xaml</DependentUpon>
|
||||
@ -525,24 +535,20 @@
|
||||
<Compile Include="Profiles\ProfileModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Models\SimplePropertiesModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\Utilities\FftEventArgs.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\Utilities\SampleAggregator.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\Bubble.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesSettings.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesModel.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesView.xaml.cs">
|
||||
<Compile Include="Modules\General\Bubbles\Bubble.cs" />
|
||||
<Compile Include="Modules\General\Bubbles\BubblesSettings.cs" />
|
||||
<Compile Include="Modules\General\Bubbles\BubblesModel.cs" />
|
||||
<Compile Include="Modules\General\Bubbles\BubblesView.xaml.cs">
|
||||
<DependentUpon>BubblesView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Effects\Bubbles\BubblesViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileSettings.cs" />
|
||||
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileView.xaml.cs">
|
||||
<DependentUpon>WindowsProfileView.xaml</DependentUpon>
|
||||
<Compile Include="Modules\General\Bubbles\BubblesViewModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\GeneralProfileSettings.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\GeneralProfileView.xaml.cs">
|
||||
<DependentUpon>GeneralProfileView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileDataModel.cs" />
|
||||
<Compile Include="Modules\Effects\WindowsProfile\WindowsProfileModel.cs" />
|
||||
<Compile Include="Modules\Effects\ProfilePreview\ProfilePreviewModel.cs" />
|
||||
<Compile Include="Models\GameModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\GeneralProfileViewModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\GeneralProfileDataModel.cs" />
|
||||
<Compile Include="Modules\General\GeneralProfile\GeneralProfileModel.cs" />
|
||||
<Compile Include="Modules\Games\CounterStrike\CounterStrikeDataModel.cs" />
|
||||
<Compile Include="Modules\Games\CounterStrike\CounterStrikeModel.cs" />
|
||||
<Compile Include="Modules\Games\CounterStrike\CounterStrikeSettings.cs" />
|
||||
@ -568,15 +574,6 @@
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3DataModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3Model.cs" />
|
||||
<Compile Include="Models\OverlayModel.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>VolumeDisplay.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayModel.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplaySettings.cs" />
|
||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueSettings.cs" />
|
||||
<Compile Include="InjectionModules\BaseModules.cs" />
|
||||
<Compile Include="InjectionModules\ManagerModules.cs" />
|
||||
@ -609,12 +606,9 @@
|
||||
<Compile Include="Services\DialogService.cs" />
|
||||
<Compile Include="Services\MetroDialogService.cs" />
|
||||
<Compile Include="Services\WindowService.cs" />
|
||||
<Compile Include="Settings\EffectSettings.cs" />
|
||||
<Compile Include="Settings\GameSettings.cs" />
|
||||
<Compile Include="Settings\GeneralSettings.cs" />
|
||||
<Compile Include="Settings\IArtemisSettings.cs" />
|
||||
<Compile Include="Settings\OffsetSettings.cs" />
|
||||
<Compile Include="Settings\OverlaySettings.cs" />
|
||||
<Compile Include="Styles\DropTargetAdorners\DropTargetMetroHighlightAdorner.cs" />
|
||||
<Compile Include="Styles\DropTargetAdorners\DropTargetMetroInsertionAdorner.cs" />
|
||||
<Compile Include="Utilities\ActiveWindowHelper.cs" />
|
||||
@ -635,7 +629,6 @@
|
||||
<Compile Include="Utilities\Markdown\Markdown.cs" />
|
||||
<Compile Include="Utilities\Markdown\TextToFlowDocumentConverter.cs" />
|
||||
<Compile Include="Utilities\Memory\GamePointer.cs" />
|
||||
<Compile Include="Utilities\Keyboard\KeyboardRectangle.cs" />
|
||||
<Compile Include="Utilities\Memory\Memory.cs" />
|
||||
<Compile Include="Utilities\Memory\MemoryHelpers.cs" />
|
||||
<Compile Include="Utilities\Memory\Win32.cs" />
|
||||
@ -644,12 +637,8 @@
|
||||
<Compile Include="Utilities\StickyValue.cs" />
|
||||
<Compile Include="Utilities\Updater.cs" />
|
||||
<Compile Include="ViewModels\Abstract\BaseViewModel.cs" />
|
||||
<Compile Include="ViewModels\Abstract\OverlayViewModel.cs" />
|
||||
<Compile Include="ViewModels\Abstract\EffectViewModel.cs" />
|
||||
<Compile Include="ViewModels\Abstract\GameViewModel.cs" />
|
||||
<Compile Include="ViewModels\DebugViewModel.cs" />
|
||||
<Compile Include="ViewModels\EffectsViewModel.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerViewModel.cs" />
|
||||
<Compile Include="ViewModels\GeneralViewModel.cs" />
|
||||
<Compile Include="ViewModels\FlyoutBaseViewModel.cs" />
|
||||
<Compile Include="ViewModels\Flyouts\FlyoutSettingsViewModel.cs" />
|
||||
<Compile Include="ViewModels\GamesViewModel.cs" />
|
||||
@ -669,22 +658,18 @@
|
||||
<Compile Include="Profiles\Layers\Types\Folder\FolderPropertiesViewModel.cs" />
|
||||
<Compile Include="Profiles\Layers\Types\Mouse\MousePropertiesViewModel.cs" />
|
||||
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
||||
<Compile Include="ViewModels\Profiles\ProfileEditorViewModel.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="ViewModels\WelcomeViewModel.cs" />
|
||||
<Compile Include="Views\DebugView.xaml.cs">
|
||||
<DependentUpon>DebugView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\EffectsView.xaml.cs">
|
||||
<DependentUpon>EffectsView.xaml</DependentUpon>
|
||||
<Compile Include="Views\GeneralView.xaml.cs">
|
||||
<DependentUpon>GeneralView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Flyouts\FlyoutSettingsView.xaml.cs">
|
||||
<DependentUpon>FlyoutSettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerView.xaml.cs">
|
||||
<DependentUpon>AudioVisualizerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\GamesView.xaml.cs">
|
||||
<DependentUpon>GamesView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -727,9 +712,6 @@
|
||||
<Compile Include="Views\OverlaysView.xaml.cs">
|
||||
<DependentUpon>OverlaysView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayView.xaml.cs">
|
||||
<DependentUpon>VolumeDisplayView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Profiles\LayerTweenView.xaml.cs">
|
||||
<DependentUpon>LayerTweenView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -750,13 +732,13 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Resources\Keyboards\masterkeys-pro-s.png" />
|
||||
<None Include="Resources\Keyboards\masterkeys-pro-l.png" />
|
||||
<Resource Include="Resources\Kottke Silkscreen License.txt" />
|
||||
<None Include="Resources\lua-placeholder.lua" />
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Resources\keypress.png" />
|
||||
<None Include="Resources\mousemat.png" />
|
||||
<EmbeddedResource Include="Modules\Games\UnrealTournament\Resources\ut-plugin.zip" />
|
||||
@ -771,10 +753,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Modules\Overlays\VolumeDisplay\VolumeDisplay.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>VolumeDisplay.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@ -828,11 +806,11 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Effects\Bubbles\BubblesView.xaml">
|
||||
<Page Include="Modules\General\Bubbles\BubblesView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Effects\WindowsProfile\WindowsProfileView.xaml">
|
||||
<Page Include="Modules\General\GeneralProfile\GeneralProfileView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@ -868,6 +846,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Modules\Overlays\OverlayProfile\OverlayProfileView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Profiles\Layers\Types\AmbientLight\AmbientLightPropertiesView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -912,11 +894,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\EffectsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Effects\AudioVisualizer\AudioVisualizerView.xaml">
|
||||
<Page Include="Views\GeneralView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@ -980,10 +958,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Modules\Overlays\VolumeDisplay\VolumeDisplayView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Profiles\LayerTweenView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@ -6,7 +6,7 @@ using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles;
|
||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||
using Artemis.Properties;
|
||||
@ -34,18 +34,18 @@ namespace Artemis.DAL
|
||||
InstallDefaults();
|
||||
}
|
||||
|
||||
public static List<string> GetProfileNames(KeyboardProvider keyboard, EffectModel effect)
|
||||
public static List<string> GetProfileNames(KeyboardProvider keyboard, ModuleModel module)
|
||||
{
|
||||
if (keyboard == null || effect == null)
|
||||
if (keyboard == null || module == null)
|
||||
return null;
|
||||
return ReadProfiles(keyboard.Slug + "/" + effect.Name).Select(p => p.Name).ToList();
|
||||
return ReadProfiles(keyboard.Slug + "/" + module.Name).Select(p => p.Name).ToList();
|
||||
}
|
||||
|
||||
public static ProfileModel GetProfile(KeyboardProvider keyboard, EffectModel effect, string name)
|
||||
public static ProfileModel GetProfile(KeyboardProvider keyboard, ModuleModel module, string name)
|
||||
{
|
||||
if (keyboard == null || effect == null)
|
||||
if (keyboard == null || module == null)
|
||||
return null;
|
||||
return ReadProfiles(keyboard.Slug + "/" + effect.Name).FirstOrDefault(p => p.Name == name);
|
||||
return ReadProfiles(keyboard.Slug + "/" + module.Name).FirstOrDefault(p => p.Name == name);
|
||||
}
|
||||
|
||||
public static bool IsProfileUnique(ProfileModel profileModel)
|
||||
@ -238,7 +238,7 @@ namespace Artemis.DAL
|
||||
archive.ExtractToDirectory(ProfileFolder, true);
|
||||
|
||||
|
||||
InsertGif("WindowsProfile", "Demo (duplicate to keep changes)", "GIF", Resources.demo_gif, "demo-gif");
|
||||
InsertGif("GeneralProfile", "Demo (duplicate to keep changes)", "GIF", Resources.demo_gif, "demo-gif");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using Artemis.Models;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class EffectChangedEventArgs : EventArgs
|
||||
{
|
||||
public EffectChangedEventArgs(EffectModel effect)
|
||||
{
|
||||
Effect = effect;
|
||||
}
|
||||
|
||||
public EffectModel Effect { get; }
|
||||
}
|
||||
}
|
||||
15
Artemis/Artemis/Events/ModuleChangedEventArgs.cs
Normal file
15
Artemis/Artemis/Events/ModuleChangedEventArgs.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class ModuleChangedEventArgs : EventArgs
|
||||
{
|
||||
public ModuleChangedEventArgs(ModuleModel module)
|
||||
{
|
||||
Module = module;
|
||||
}
|
||||
|
||||
public ModuleModel Module { get; }
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,22 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class ProfileDeviceEventsArg : EventArgs
|
||||
{
|
||||
public ProfileDeviceEventsArg(string updateType, IDataModel dataModel, bool preview, DrawingContext drawingContext)
|
||||
public ProfileDeviceEventsArg(DrawType updateType, ModuleDataModel dataModel, bool preview, DrawingContext drawingContext)
|
||||
{
|
||||
UpdateType = updateType;
|
||||
UpdateType = updateType.ToString().ToLower();
|
||||
DataModel = dataModel;
|
||||
Preview = preview;
|
||||
DrawingContext = drawingContext;
|
||||
}
|
||||
|
||||
public string UpdateType { get; }
|
||||
public IDataModel DataModel { get; }
|
||||
public ModuleDataModel DataModel { get; }
|
||||
public bool Preview { get; }
|
||||
public DrawingContext DrawingContext { get; }
|
||||
}
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Types.AmbientLight;
|
||||
using Artemis.Profiles.Layers.Types.Audio;
|
||||
using Artemis.Profiles.Layers.Types.Audio.AudioCapturing;
|
||||
using Artemis.Profiles.Layers.Types.KeyPress;
|
||||
using Artemis.Profiles.Lua;
|
||||
using Artemis.Services;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
@ -36,12 +32,6 @@ namespace Artemis.InjectionModules
|
||||
|
||||
#endregion
|
||||
|
||||
#region Models
|
||||
|
||||
Bind<ProfilePreviewModel>().ToSelf().InSingletonScope();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Services
|
||||
|
||||
Bind<MetroDialogService>().ToSelf().InSingletonScope();
|
||||
@ -71,25 +61,17 @@ namespace Artemis.InjectionModules
|
||||
Kernel.Bind(x =>
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<EffectModel>()
|
||||
.InheritedFrom<ModuleModel>()
|
||||
.BindAllBaseClasses()
|
||||
.Configure((b, c) => b.InSingletonScope().Named(c.Name))
|
||||
);
|
||||
Kernel.Bind(x =>
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<EffectViewModel>()
|
||||
.BindBase());
|
||||
Kernel.Bind(x =>
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<GameViewModel>()
|
||||
.BindBase());
|
||||
Kernel.Bind(x =>
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<OverlayViewModel>()
|
||||
.BindBase());
|
||||
.InheritedFrom<ModuleViewModel>()
|
||||
.BindAllBaseClasses()
|
||||
.Configure(b => b.InSingletonScope())
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
@ -115,7 +97,7 @@ namespace Artemis.InjectionModules
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<ILayerType>()
|
||||
.BindToSelf());
|
||||
|
||||
|
||||
// Type helpers
|
||||
Bind<AudioCaptureManager>().ToSelf().InSingletonScope();
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace Artemis.InjectionModules
|
||||
Bind<MainManager>().ToSelf().InSingletonScope();
|
||||
Bind<LoopManager>().ToSelf().InSingletonScope();
|
||||
Bind<DeviceManager>().ToSelf().InSingletonScope();
|
||||
Bind<EffectManager>().ToSelf().InSingletonScope();
|
||||
Bind<ModuleManager>().ToSelf().InSingletonScope();
|
||||
Bind<ProfileManager>().ToSelf().InSingletonScope();
|
||||
Bind<LuaManager>().ToSelf().InSingletonScope();
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Artemis.Managers
|
||||
public bool ChangingKeyboard { get; private set; }
|
||||
|
||||
|
||||
public event EventHandler<KeyboardChangedEventArgs> OnKeyboardChangedEvent;
|
||||
public event EventHandler<KeyboardChangedEventArgs> OnKeyboardChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Enables the last keyboard according to the settings file
|
||||
@ -178,7 +178,7 @@ namespace Artemis.Managers
|
||||
{
|
||||
// I do this in all to avoid a possible race condition
|
||||
// https://msdn.microsoft.com/en-us/library/w369ty8x.aspx
|
||||
var handler = OnKeyboardChangedEvent;
|
||||
var handler = OnKeyboardChanged;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,236 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.Settings;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages the effects
|
||||
/// </summary>
|
||||
public class EffectManager
|
||||
{
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly ILogger _logger;
|
||||
private EffectModel _activeEffect;
|
||||
private LoopManager _waitLoopManager;
|
||||
private EffectModel _waitEffect;
|
||||
private readonly GeneralSettings _generalSettings;
|
||||
|
||||
public EffectManager(ILogger logger, DeviceManager deviceManager, List<EffectModel> effectModels,
|
||||
List<GameModel> gameModels, List<OverlayModel> overlayModels)
|
||||
{
|
||||
_generalSettings = DAL.SettingsProvider.Load<GeneralSettings>();
|
||||
_logger = logger;
|
||||
_deviceManager = deviceManager;
|
||||
|
||||
var models = new List<EffectModel>();
|
||||
// Add regular effects
|
||||
models.AddRange(effectModels);
|
||||
// Add overlays
|
||||
models.AddRange(overlayModels);
|
||||
// Add games, exclude WoW if needed
|
||||
models.AddRange(_generalSettings.GamestatePort != 62575
|
||||
? gameModels.Where(e => e.Name != "WoW")
|
||||
: gameModels);
|
||||
|
||||
EffectModels = models;
|
||||
_logger.Info("Intialized EffectManager");
|
||||
}
|
||||
|
||||
public ProfilePreviewModel ProfilePreviewModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds all the effects the program has
|
||||
/// </summary>
|
||||
public List<EffectModel> EffectModels { get; set; }
|
||||
|
||||
public EffectModel ActiveEffect
|
||||
{
|
||||
get { return _activeEffect; }
|
||||
private set
|
||||
{
|
||||
_activeEffect = value;
|
||||
RaiseEffectChangedEvent(new EffectChangedEventArgs(value));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all enabled overlays
|
||||
/// </summary>
|
||||
public IEnumerable<OverlayModel> EnabledOverlays
|
||||
{
|
||||
get { return EffectModels.OfType<OverlayModel>().Where(o => o.Enabled); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all enabled games
|
||||
/// </summary>
|
||||
public IEnumerable<GameModel> EnabledGames
|
||||
{
|
||||
get { return EffectModels.OfType<GameModel>().Where(g => g.Enabled && g.Settings.Enabled); }
|
||||
}
|
||||
|
||||
public event EventHandler<EffectChangedEventArgs> OnEffectChangedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the last active effect from settings and enables it.
|
||||
/// </summary>
|
||||
/// <returns>Whether enabling was successful or not.</returns>
|
||||
public EffectModel GetLastEffect()
|
||||
{
|
||||
_logger.Debug("Getting last effect: {0}", _generalSettings.LastEffect);
|
||||
return _generalSettings.LastEffect == null
|
||||
? null
|
||||
: EffectModels.FirstOrDefault(e => e.Name == _generalSettings.LastEffect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the current effect and changes it to the provided effect.
|
||||
/// </summary>
|
||||
/// <param name="effectModel">The effect to activate</param>
|
||||
/// <param name="loopManager">Optionally pass the LoopManager to automatically start it, if it's not running.</param>
|
||||
public void ChangeEffect(EffectModel effectModel, LoopManager loopManager = null)
|
||||
{
|
||||
if (_waitEffect != null)
|
||||
{
|
||||
_logger.Debug("Stopping effect because a change is already queued");
|
||||
return;
|
||||
}
|
||||
|
||||
if (effectModel == null)
|
||||
throw new ArgumentNullException(nameof(effectModel));
|
||||
if (effectModel is OverlayModel)
|
||||
throw new ArgumentException("Can't set an Overlay effect as the active effect");
|
||||
|
||||
if (_deviceManager.ActiveKeyboard == null)
|
||||
{
|
||||
_logger.Debug("Stopping effect change until keyboard is enabled");
|
||||
_waitEffect = effectModel;
|
||||
_waitLoopManager = loopManager;
|
||||
_deviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
||||
_deviceManager.EnableLastKeyboard();
|
||||
return;
|
||||
}
|
||||
|
||||
// Game models are only used if they are enabled
|
||||
var gameModel = effectModel as GameModel;
|
||||
if (gameModel != null)
|
||||
if (!gameModel.Enabled)
|
||||
{
|
||||
_logger.Debug("Cancelling effect change, provided game not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var wasNull = false;
|
||||
if (ActiveEffect == null)
|
||||
{
|
||||
wasNull = true;
|
||||
ActiveEffect = effectModel;
|
||||
}
|
||||
|
||||
lock (ActiveEffect)
|
||||
{
|
||||
if (!wasNull)
|
||||
ActiveEffect.Dispose();
|
||||
lock (effectModel)
|
||||
{
|
||||
ActiveEffect = effectModel;
|
||||
ActiveEffect.Enable();
|
||||
if (!ActiveEffect.Initialized)
|
||||
{
|
||||
_logger.Debug("Cancelling effect change, couldn't initialize the effect ({0})", effectModel.Name);
|
||||
ActiveEffect = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loopManager != null && !loopManager.Running)
|
||||
{
|
||||
_logger.Debug("Starting LoopManager for effect change");
|
||||
loopManager.StartAsync();
|
||||
}
|
||||
|
||||
_logger.Debug("Changed active effect to: {0}", effectModel.Name);
|
||||
|
||||
if (ActiveEffect is GameModel || ActiveEffect is ProfilePreviewModel)
|
||||
return;
|
||||
|
||||
// Non-game effects are stored as the new LastEffect.
|
||||
_generalSettings.LastEffect = ActiveEffect?.Name;
|
||||
_generalSettings.Save();
|
||||
}
|
||||
|
||||
private void DeviceManagerOnOnKeyboardChangedEvent(object sender, KeyboardChangedEventArgs e)
|
||||
{
|
||||
_deviceManager.OnKeyboardChangedEvent -= DeviceManagerOnOnKeyboardChangedEvent;
|
||||
_logger.Debug("Resuming effect change");
|
||||
|
||||
var effect = _waitEffect;
|
||||
_waitEffect = null;
|
||||
var loopManager = _waitLoopManager;
|
||||
_waitLoopManager = null;
|
||||
|
||||
ChangeEffect(effect, loopManager);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clears the current effect
|
||||
/// </summary>
|
||||
public void ClearEffect()
|
||||
{
|
||||
if (ActiveEffect == null)
|
||||
return;
|
||||
|
||||
lock (ActiveEffect)
|
||||
{
|
||||
ActiveEffect.Dispose();
|
||||
ActiveEffect = null;
|
||||
|
||||
_generalSettings.LastEffect = null;
|
||||
_generalSettings.Save();
|
||||
}
|
||||
|
||||
_logger.Debug("Cleared active effect");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the given game
|
||||
/// </summary>
|
||||
/// <param name="activeEffect"></param>
|
||||
public void DisableGame(EffectModel activeEffect)
|
||||
{
|
||||
_logger.Debug("Disabling game: {0}", activeEffect?.Name);
|
||||
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);
|
||||
}
|
||||
|
||||
protected virtual void RaiseEffectChangedEvent(EffectChangedEventArgs e)
|
||||
{
|
||||
var handler = OnEffectChangedEvent;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,10 +4,11 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.ViewModels;
|
||||
using Caliburn.Micro;
|
||||
using Ninject.Extensions.Logging;
|
||||
using Color = System.Drawing.Color;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace Artemis.Managers
|
||||
@ -19,15 +20,15 @@ namespace Artemis.Managers
|
||||
{
|
||||
private readonly DebugViewModel _debugViewModel;
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly EffectManager _effectManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly Timer _loopTimer;
|
||||
private readonly ModuleManager _moduleManager;
|
||||
|
||||
public LoopManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager,
|
||||
public LoopManager(ILogger logger, ModuleManager moduleManager, DeviceManager deviceManager,
|
||||
DebugViewModel debugViewModel)
|
||||
{
|
||||
_logger = logger;
|
||||
_effectManager = effectManager;
|
||||
_moduleManager = moduleManager;
|
||||
_deviceManager = deviceManager;
|
||||
_debugViewModel = debugViewModel;
|
||||
|
||||
@ -89,15 +90,15 @@ namespace Artemis.Managers
|
||||
return;
|
||||
}
|
||||
|
||||
if (_effectManager.ActiveEffect == null)
|
||||
if (_moduleManager.ActiveModule == null)
|
||||
{
|
||||
var lastEffect = _effectManager.GetLastEffect();
|
||||
if (lastEffect == null)
|
||||
var lastModule = _moduleManager.GetLastModule();
|
||||
if (lastModule == null)
|
||||
{
|
||||
_logger.Debug("Cancel LoopManager start, no effect");
|
||||
_logger.Debug("Cancel LoopManager start, no module");
|
||||
return;
|
||||
}
|
||||
_effectManager.ChangeEffect(lastEffect);
|
||||
_moduleManager.ChangeActiveModule(lastModule);
|
||||
}
|
||||
|
||||
Running = true;
|
||||
@ -119,14 +120,14 @@ namespace Artemis.Managers
|
||||
if (!Running || _deviceManager.ChangingKeyboard)
|
||||
return;
|
||||
|
||||
// Stop if no active effect
|
||||
if (_effectManager.ActiveEffect == null)
|
||||
// Stop if no active module
|
||||
if (_moduleManager.ActiveModule == null)
|
||||
{
|
||||
_logger.Debug("No active effect, stopping");
|
||||
_logger.Debug("No active module, stopping");
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
var renderEffect = _effectManager.ActiveEffect;
|
||||
var renderModule = _moduleManager.ActiveModule;
|
||||
|
||||
// Stop if no active keyboard
|
||||
if (_deviceManager.ActiveKeyboard == null)
|
||||
@ -138,13 +139,13 @@ namespace Artemis.Managers
|
||||
|
||||
lock (_deviceManager.ActiveKeyboard)
|
||||
{
|
||||
// Skip frame if effect is still initializing
|
||||
if (renderEffect.Initialized == false)
|
||||
// Skip frame if module is still initializing
|
||||
if (renderModule.IsInitialized == false)
|
||||
return;
|
||||
|
||||
// ApplyProperties the current effect
|
||||
if (renderEffect.Initialized)
|
||||
renderEffect.Update();
|
||||
// ApplyProperties the current module
|
||||
if (renderModule.IsInitialized)
|
||||
renderModule.Update();
|
||||
|
||||
// Get the devices that must be rendered to
|
||||
var mice = _deviceManager.MiceProviders.Where(m => m.CanUse).ToList();
|
||||
@ -156,14 +157,14 @@ namespace Artemis.Managers
|
||||
// Setup the frame for this tick
|
||||
using (var frame = new RenderFrame(_deviceManager.ActiveKeyboard))
|
||||
{
|
||||
if (renderEffect.Initialized)
|
||||
renderEffect.Render(frame, keyboardOnly);
|
||||
if (renderModule.IsInitialized)
|
||||
renderModule.Render(frame, keyboardOnly);
|
||||
|
||||
// Draw enabled overlays on top of the renderEffect
|
||||
foreach (var overlayModel in _effectManager.EnabledOverlays)
|
||||
// Draw enabled overlays on top of the renderModule
|
||||
foreach (var overlayModel in _moduleManager.OverlayModules.Where(o => o.Settings.IsEnabled))
|
||||
{
|
||||
overlayModel.Update();
|
||||
overlayModel.RenderOverlay(frame, keyboardOnly);
|
||||
overlayModel.Render(frame, keyboardOnly);
|
||||
}
|
||||
|
||||
// Update the keyboard
|
||||
|
||||
@ -35,7 +35,7 @@ namespace Artemis.Managers
|
||||
|
||||
public void SetupLua(ProfileModel profileModel)
|
||||
{
|
||||
_logger.Debug("Setting up LUA for {0}-{1}.", profileModel?.Name, profileModel?.GameName);
|
||||
_logger.Debug("Setting up LUA for profile '{0}', module '{1}'", profileModel?.Name, profileModel?.GameName);
|
||||
// Clear old state
|
||||
ClearLua();
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Artemis.Utilities.GameState;
|
||||
@ -23,13 +22,13 @@ namespace Artemis.Managers
|
||||
private readonly Timer _processTimer;
|
||||
|
||||
public MainManager(ILogger logger, LoopManager loopManager, DeviceManager deviceManager,
|
||||
EffectManager effectManager, ProfileManager profileManager, PipeServer pipeServer,
|
||||
ModuleManager moduleManager, ProfileManager profileManager, PipeServer pipeServer,
|
||||
GameStateWebServer gameStateWebServer)
|
||||
{
|
||||
Logger = logger;
|
||||
LoopManager = loopManager;
|
||||
DeviceManager = deviceManager;
|
||||
EffectManager = effectManager;
|
||||
ModuleManager = moduleManager;
|
||||
ProfileManager = profileManager;
|
||||
PipeServer = pipeServer;
|
||||
|
||||
@ -64,7 +63,7 @@ namespace Artemis.Managers
|
||||
public ILogger Logger { get; set; }
|
||||
public LoopManager LoopManager { get; }
|
||||
public DeviceManager DeviceManager { get; set; }
|
||||
public EffectManager EffectManager { get; set; }
|
||||
public ModuleManager ModuleManager { get; set; }
|
||||
public ProfileManager ProfileManager { get; set; }
|
||||
|
||||
public PipeServer PipeServer { get; set; }
|
||||
@ -79,12 +78,12 @@ namespace Artemis.Managers
|
||||
_processTimer?.Stop();
|
||||
_processTimer?.Dispose();
|
||||
LoopManager?.Stop();
|
||||
EffectManager?.ActiveEffect?.Dispose();
|
||||
ModuleManager?.ActiveModule?.Dispose();
|
||||
GameStateWebServer?.Stop();
|
||||
PipeServer?.Stop();
|
||||
}
|
||||
|
||||
public event EventHandler<EnabledChangedEventArgs> OnEnabledChangedEvent;
|
||||
public event EventHandler<EnabledChangedEventArgs> EnabledChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the loop manager when the system resumes
|
||||
@ -126,7 +125,7 @@ namespace Artemis.Managers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manages active games by keeping an eye on their processes
|
||||
/// Manages active process bound modules by keeping an eye on their processes
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
@ -135,36 +134,38 @@ namespace Artemis.Managers
|
||||
if (!ProgramEnabled)
|
||||
return;
|
||||
|
||||
var runningProcesses = System.Diagnostics.Process.GetProcesses();
|
||||
var processes = System.Diagnostics.Process.GetProcesses();
|
||||
var module = ModuleManager.ActiveModule;
|
||||
|
||||
// If the currently active effect is a disabled game, get rid of it.
|
||||
if (EffectManager.ActiveEffect != null)
|
||||
EffectManager.DisableInactiveGame();
|
||||
// If the active module is a process bound module, make sure it should still be enabled
|
||||
if (module != null && module.IsBoundToProcess)
|
||||
{
|
||||
if (!module.Settings.IsEnabled)
|
||||
ModuleManager.DisableProcessBoundModule();
|
||||
|
||||
// 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.Any(p => p.ProcessName == activeGame.ProcessName && p.HasExited == false))
|
||||
// If the currently active effect is a no longer running game, get rid of it.
|
||||
if (!processes.Any(p => p.ProcessName == module.ProcessName && p.HasExited == false))
|
||||
{
|
||||
Logger.Info("Disabling game: {0}", activeGame.Name);
|
||||
EffectManager.DisableGame(activeGame);
|
||||
Logger.Info("Disabling process bound module because process stopped: {0}", module.Name);
|
||||
ModuleManager.DisableProcessBoundModule();
|
||||
}
|
||||
}
|
||||
|
||||
// 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 && p.HasExited == false));
|
||||
var newModule = ModuleManager.ProcessModules.Where(g => g.Settings.IsEnabled && g.Settings.IsEnabled)
|
||||
.FirstOrDefault(g => processes.Any(p => p.ProcessName == g.ProcessName && p.HasExited == false));
|
||||
|
||||
if (newGame == null || EffectManager.ActiveEffect == newGame)
|
||||
if (newModule == null || module == newModule)
|
||||
return;
|
||||
|
||||
// If it's not already enabled, do so.
|
||||
Logger.Info("Detected and enabling game: {0}", newGame.Name);
|
||||
EffectManager.ChangeEffect(newGame, LoopManager);
|
||||
Logger.Info("Detected and enabling process bound module: {0}", newModule.Name);
|
||||
ModuleManager.ChangeActiveModule(newModule, LoopManager);
|
||||
}
|
||||
|
||||
protected virtual void RaiseEnabledChangedEvent(EnabledChangedEventArgs e)
|
||||
{
|
||||
var handler = OnEnabledChangedEvent;
|
||||
var handler = EnabledChanged;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
204
Artemis/Artemis/Managers/ModuleManager.cs
Normal file
204
Artemis/Artemis/Managers/ModuleManager.cs
Normal file
@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Events;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Settings;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
public class ModuleManager
|
||||
{
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly ILogger _logger;
|
||||
private ModuleModel _activeModule;
|
||||
private LoopManager _waitLoopManager;
|
||||
private ModuleModel _waitEffect;
|
||||
private readonly GeneralSettings _generalSettings;
|
||||
|
||||
public ModuleManager(ILogger logger, DeviceManager deviceManager, List<ModuleModel> moduleModels)
|
||||
{
|
||||
_generalSettings = DAL.SettingsProvider.Load<GeneralSettings>();
|
||||
_logger = logger;
|
||||
_deviceManager = deviceManager;
|
||||
|
||||
Modules = new List<ModuleModel>(moduleModels.Where(m => !m.IsOverlay && !m.IsBoundToProcess));
|
||||
OverlayModules = new List<ModuleModel>(moduleModels.Where(m => m.IsOverlay));
|
||||
// Exclude WoW if needed
|
||||
ProcessModules = _generalSettings.GamestatePort == 62575
|
||||
? new List<ModuleModel>(moduleModels.Where(m => m.IsBoundToProcess))
|
||||
: new List<ModuleModel>(moduleModels.Where(m => m.IsBoundToProcess && m.Name != "WoW"));
|
||||
|
||||
_logger.Info("Intialized ModuleManager");
|
||||
}
|
||||
|
||||
public List<ModuleModel> Modules { get; set; }
|
||||
public List<ModuleModel> ProcessModules { get; set; }
|
||||
public List<ModuleModel> OverlayModules { get; set; }
|
||||
|
||||
public ModuleModel ActiveModule
|
||||
{
|
||||
get { return _activeModule; }
|
||||
private set
|
||||
{
|
||||
_activeModule = value;
|
||||
RaiseEffectChangedEvent(new ModuleChangedEventArgs(value));
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ModuleChangedEventArgs> EffectChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the last active module from settings and enables it.
|
||||
/// </summary>
|
||||
public ModuleModel GetLastModule()
|
||||
{
|
||||
_logger.Debug("Getting last module: {0}", _generalSettings.LastModule);
|
||||
|
||||
if (_generalSettings.LastModule != null)
|
||||
{
|
||||
var lastModule = Modules.FirstOrDefault(e => e.Name == _generalSettings.LastModule);
|
||||
if (lastModule != null)
|
||||
return lastModule;
|
||||
}
|
||||
|
||||
_logger.Debug("Getting last module not found, defaulting to GeneralProfile");
|
||||
return Modules.First(e => e.Name == "GeneralProfile");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the current module and changes it to the provided module.
|
||||
/// </summary>
|
||||
/// <param name="moduleModel">The module to activate</param>
|
||||
/// <param name="loopManager">Optionally pass the LoopManager to automatically start it, if it's not running.</param>
|
||||
public void ChangeActiveModule(ModuleModel moduleModel, LoopManager loopManager = null)
|
||||
{
|
||||
if (_waitEffect != null)
|
||||
{
|
||||
_logger.Debug("Stopping module change because a change is already queued");
|
||||
return;
|
||||
}
|
||||
|
||||
if (moduleModel == null)
|
||||
throw new ArgumentNullException(nameof(moduleModel));
|
||||
if (moduleModel.IsOverlay)
|
||||
throw new ArgumentException("Can't set an General module as the active module");
|
||||
|
||||
if (_deviceManager.ActiveKeyboard == null)
|
||||
{
|
||||
_logger.Debug("Stopping module change until keyboard is enabled");
|
||||
_waitEffect = moduleModel;
|
||||
_waitLoopManager = loopManager;
|
||||
_deviceManager.OnKeyboardChanged += DeviceManagerOnOnKeyboardChanged;
|
||||
_deviceManager.EnableLastKeyboard();
|
||||
return;
|
||||
}
|
||||
|
||||
// Process bound modules are only used if they are enabled
|
||||
if (moduleModel.Settings != null && !moduleModel.Settings.IsEnabled && moduleModel.IsBoundToProcess)
|
||||
{
|
||||
_logger.Debug("Cancelling module change, provided module is process bound and not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var wasNull = false;
|
||||
if (ActiveModule == null)
|
||||
{
|
||||
wasNull = true;
|
||||
ActiveModule = moduleModel;
|
||||
}
|
||||
|
||||
lock (ActiveModule)
|
||||
{
|
||||
if (!wasNull)
|
||||
ActiveModule.Dispose();
|
||||
lock (moduleModel)
|
||||
{
|
||||
ActiveModule = moduleModel;
|
||||
ActiveModule.Enable();
|
||||
if (!ActiveModule.IsInitialized)
|
||||
{
|
||||
_logger.Debug("Cancelling module change, couldn't initialize the module ({0})", moduleModel.Name);
|
||||
ActiveModule = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loopManager != null && !loopManager.Running)
|
||||
{
|
||||
_logger.Debug("Starting LoopManager for module change");
|
||||
loopManager.StartAsync();
|
||||
}
|
||||
|
||||
_logger.Debug("Changed active module to: {0}", moduleModel.Name);
|
||||
|
||||
if (ActiveModule.IsBoundToProcess || ActiveModule.IsOverlay || ActiveModule.Name == "Profile preview")
|
||||
return;
|
||||
|
||||
// Regular modules are stored as the last active module
|
||||
_generalSettings.LastModule = ActiveModule?.Name;
|
||||
_generalSettings.Save();
|
||||
}
|
||||
|
||||
private void DeviceManagerOnOnKeyboardChanged(object sender, KeyboardChangedEventArgs e)
|
||||
{
|
||||
_deviceManager.OnKeyboardChanged -= DeviceManagerOnOnKeyboardChanged;
|
||||
_logger.Debug("Resuming module change");
|
||||
|
||||
var module = _waitEffect;
|
||||
_waitEffect = null;
|
||||
var loopManager = _waitLoopManager;
|
||||
_waitLoopManager = null;
|
||||
|
||||
ChangeActiveModule(module, loopManager);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clears the current module
|
||||
/// </summary>
|
||||
public void ClearActiveModule()
|
||||
{
|
||||
if (ActiveModule == null)
|
||||
return;
|
||||
|
||||
lock (ActiveModule)
|
||||
{
|
||||
ActiveModule.Dispose();
|
||||
ActiveModule = null;
|
||||
|
||||
_generalSettings.LastModule = null;
|
||||
_generalSettings.Save();
|
||||
}
|
||||
|
||||
_logger.Debug("Cleared active module");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the currently active process bound module
|
||||
/// </summary>
|
||||
public void DisableProcessBoundModule()
|
||||
{
|
||||
if (!ActiveModule.IsBoundToProcess)
|
||||
{
|
||||
_logger.Warn("Active module {0} is not process bound but is being disabled as if it is.",
|
||||
ActiveModule.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLastModule() == null)
|
||||
ClearActiveModule();
|
||||
else
|
||||
ChangeActiveModule(GetLastModule());
|
||||
}
|
||||
|
||||
protected virtual void RaiseEffectChangedEvent(ModuleChangedEventArgs e)
|
||||
{
|
||||
var handler = EffectChanged;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,32 +2,31 @@
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Settings;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
public class ProfileManager
|
||||
{
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly EffectManager _effectManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ModuleManager _moduleManager;
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly LoopManager _loopManager;
|
||||
private GeneralSettings _generalSettings;
|
||||
private readonly GeneralSettings _generalSettings;
|
||||
|
||||
public ProfileManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager,
|
||||
public ProfileManager(ILogger logger, ModuleManager moduleManager, DeviceManager deviceManager,
|
||||
LoopManager loopManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_effectManager = effectManager;
|
||||
_moduleManager = moduleManager;
|
||||
_deviceManager = deviceManager;
|
||||
_loopManager = loopManager;
|
||||
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||
|
||||
GameViewModels = new List<GameViewModel>();
|
||||
PreviewViewModules = new List<ModuleViewModel>();
|
||||
|
||||
var profilePreviewTimer = new Timer(500);
|
||||
profilePreviewTimer.Elapsed += SetupProfilePreview;
|
||||
@ -36,9 +35,7 @@ namespace Artemis.Managers
|
||||
_logger.Info("Intialized ProfileManager");
|
||||
}
|
||||
|
||||
public ProfilePreviewModel ProfilePreviewModel { get; set; }
|
||||
|
||||
public List<GameViewModel> GameViewModels { get; set; }
|
||||
public List<ModuleViewModel> PreviewViewModules { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of profiles being previewed and sets up the active efffect accordingly
|
||||
@ -47,44 +44,39 @@ namespace Artemis.Managers
|
||||
/// <param name="e"></param>
|
||||
private void SetupProfilePreview(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_generalSettings.LastKeyboard) || _deviceManager.ChangingKeyboard ||
|
||||
ProfilePreviewModel == null)
|
||||
return;
|
||||
|
||||
lock (GameViewModels)
|
||||
{
|
||||
var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive);
|
||||
|
||||
if (activePreview == null)
|
||||
{
|
||||
// Should not be active if no selected profile is set
|
||||
if (_effectManager.ActiveEffect != ProfilePreviewModel)
|
||||
return;
|
||||
|
||||
_logger.Debug("Loading last effect after profile preview");
|
||||
var lastEffect = _effectManager.GetLastEffect();
|
||||
if (lastEffect != null)
|
||||
_effectManager.ChangeEffect(lastEffect);
|
||||
else
|
||||
_effectManager.ClearEffect();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_effectManager.ActiveEffect != ProfilePreviewModel &&
|
||||
!(_effectManager.ActiveEffect is GameModel))
|
||||
{
|
||||
_logger.Debug("Activate profile preview");
|
||||
_effectManager.ChangeEffect(ProfilePreviewModel);
|
||||
}
|
||||
|
||||
// LoopManager might be running, this method won't do any harm in that case.
|
||||
_loopManager.StartAsync();
|
||||
|
||||
ProfilePreviewModel.ProfileViewModel = activePreview.ProfileEditor.ProfileViewModel;
|
||||
if (!ReferenceEquals(ProfilePreviewModel.Profile, activePreview.ProfileEditor.SelectedProfile))
|
||||
ProfilePreviewModel.Profile = activePreview.ProfileEditor.SelectedProfile;
|
||||
}
|
||||
}
|
||||
// if (string.IsNullOrEmpty(_generalSettings.LastKeyboard) || _deviceManager.ChangingKeyboard)
|
||||
// return;
|
||||
//
|
||||
// var activePreview = PreviewViewModules.FirstOrDefault(vm => vm.IsActive);
|
||||
// if (activePreview == null)
|
||||
// {
|
||||
// // Should not be active if no selected profile is set
|
||||
// if (_moduleManager.ActiveModule != _profilePreviewModel)
|
||||
// return;
|
||||
//
|
||||
// _logger.Debug("Loading last module after profile preview");
|
||||
// var lastModule = _moduleManager.GetLastModule();
|
||||
// if (lastModule != null)
|
||||
// _moduleManager.ChangeActiveModule(lastModule);
|
||||
// else
|
||||
// _moduleManager.ClearActiveModule();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (_moduleManager.ActiveModule != null && _moduleManager.ActiveModule != _profilePreviewModel &&
|
||||
// _moduleManager.ActiveModule != activePreview.ModuleModel)
|
||||
// {
|
||||
// _logger.Debug("Activate profile preview");
|
||||
// _moduleManager.ChangeActiveModule(_profilePreviewModel);
|
||||
// }
|
||||
//
|
||||
// // LoopManager might be running, this method won't do any harm in that case.
|
||||
// _loopManager.StartAsync();
|
||||
//
|
||||
// // Can safely spam this, it won't do anything if they are equal
|
||||
// _profilePreviewModel.ProfileViewModel = activePreview.ProfileEditor.ProfileViewModel;
|
||||
// _profilePreviewModel.ChangeProfile(activePreview.ModuleModel.ProfileModel);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,156 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Profiles;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Settings;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public abstract class EffectModel : IDisposable
|
||||
{
|
||||
public delegate void SettingsUpdateHandler(EffectSettings settings);
|
||||
|
||||
protected DateTime LastTrace;
|
||||
|
||||
protected EffectModel(DeviceManager deviceManager, LuaManager luaManager, EffectSettings settings,
|
||||
IDataModel dataModel)
|
||||
{
|
||||
DeviceManager = deviceManager;
|
||||
LuaManager = luaManager;
|
||||
Settings = settings;
|
||||
DataModel = dataModel;
|
||||
|
||||
DeviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
||||
}
|
||||
|
||||
public bool Initialized { get; set; }
|
||||
public DeviceManager DeviceManager { get; set; }
|
||||
public LuaManager LuaManager { get; }
|
||||
public EffectSettings Settings { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int KeyboardScale { get; set; } = 4;
|
||||
// Used by profile system
|
||||
public IDataModel DataModel { get; set; }
|
||||
|
||||
public ProfileModel Profile { get; set; }
|
||||
|
||||
[Inject]
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
Profile?.Deactivate(LuaManager);
|
||||
Profile = null;
|
||||
}
|
||||
|
||||
private void DeviceManagerOnOnKeyboardChangedEvent(object sender, KeyboardChangedEventArgs args)
|
||||
{
|
||||
if (!Initialized)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrEmpty(Settings?.LastProfile))
|
||||
Profile = ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, Settings.LastProfile);
|
||||
else
|
||||
Profile = ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, "Default");
|
||||
|
||||
Profile?.Activate(LuaManager);
|
||||
}
|
||||
|
||||
// Called on creation
|
||||
public virtual void Enable()
|
||||
{
|
||||
// If set, load the last profile from settings
|
||||
if (!string.IsNullOrEmpty(Settings?.LastProfile))
|
||||
Profile = ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, Settings.LastProfile);
|
||||
else
|
||||
Profile = ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, "Default");
|
||||
|
||||
Profile?.Activate(LuaManager);
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
public abstract void Update();
|
||||
|
||||
// Called after every update
|
||||
/// <summary>
|
||||
/// Renders the currently active profile
|
||||
/// </summary>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="keyboardOnly"></param>
|
||||
public virtual void Render(RenderFrame frame, bool keyboardOnly)
|
||||
{
|
||||
if (Profile == null || DataModel == null || DeviceManager.ActiveKeyboard == null)
|
||||
return;
|
||||
|
||||
lock (DataModel)
|
||||
{
|
||||
lock (Profile)
|
||||
{
|
||||
// Get all enabled layers who's conditions are met
|
||||
var renderLayers = GetRenderLayers(keyboardOnly);
|
||||
|
||||
// If the profile has no active LUA wrapper, create one
|
||||
if (!string.IsNullOrEmpty(Profile.LuaScript))
|
||||
Profile.Activate(LuaManager);
|
||||
|
||||
// Render the keyboard layer-by-layer
|
||||
var keyboardRect = DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Keyboard),
|
||||
DataModel, keyboardRect, false, true, "keyboard");
|
||||
}
|
||||
// Render mice layer-by-layer
|
||||
var devRec = new Rect(0, 0, 40, 40);
|
||||
using (var g = Graphics.FromImage(frame.MouseBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Mouse),
|
||||
DataModel, devRec, false, true, "mouse");
|
||||
}
|
||||
// Render headsets layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.HeadsetBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Headset),
|
||||
DataModel, devRec, false, true, "headset");
|
||||
}
|
||||
// Render generic devices layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.GenericBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Generic),
|
||||
DataModel, devRec, false, true, "generic");
|
||||
}
|
||||
// Render mousemats layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.MousematBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Mousemat),
|
||||
DataModel, devRec, false, true, "mousemat");
|
||||
}
|
||||
|
||||
// Trace debugging
|
||||
if (DateTime.Now.AddSeconds(-2) <= LastTrace || Logger == null)
|
||||
return;
|
||||
|
||||
LastTrace = DateTime.Now;
|
||||
var dmJson = JsonConvert.SerializeObject(DataModel, Formatting.Indented);
|
||||
Logger.Trace("Effect datamodel as JSON: \r\n{0}", dmJson);
|
||||
Logger.Trace("Effect {0} has to render {1} layers", Name, renderLayers.Count);
|
||||
foreach (var renderLayer in renderLayers)
|
||||
Logger.Trace("- Layer name: {0}, layer type: {1}", renderLayer.Name, renderLayer.LayerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract List<LayerModel> GetRenderLayers(bool keyboardOnly);
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Settings;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public abstract class GameModel : EffectModel
|
||||
{
|
||||
protected GameModel(DeviceManager deviceManager, LuaManager luaManager, GameSettings settings,
|
||||
IDataModel dataModel) : base(deviceManager, luaManager, settings, dataModel)
|
||||
{
|
||||
// Override settings to the GameSettings type
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
public new GameSettings Settings { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string ProcessName { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
namespace Artemis.Models.Interfaces
|
||||
{
|
||||
public interface IDataModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Settings;
|
||||
|
||||
namespace Artemis.Models
|
||||
{
|
||||
public abstract class OverlayModel : EffectModel
|
||||
{
|
||||
private bool _enabled;
|
||||
public string ProcessName;
|
||||
|
||||
protected OverlayModel(DeviceManager deviceManager, LuaManager luaManager, OverlaySettings settings)
|
||||
: base(deviceManager, luaManager, settings, null)
|
||||
{
|
||||
Settings = settings;
|
||||
Enabled = settings.Enabled;
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return _enabled; }
|
||||
set
|
||||
{
|
||||
if (_enabled == value)
|
||||
return;
|
||||
|
||||
if (value)
|
||||
Enable();
|
||||
else
|
||||
Dispose();
|
||||
_enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public new OverlaySettings Settings { get; set; }
|
||||
public abstract void RenderOverlay(RenderFrame frame, bool keyboardOnly);
|
||||
}
|
||||
}
|
||||
7
Artemis/Artemis/Modules/Abstract/ModuleDataModel.cs
Normal file
7
Artemis/Artemis/Modules/Abstract/ModuleDataModel.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Artemis.Modules.Abstract
|
||||
{
|
||||
public abstract class ModuleDataModel
|
||||
{
|
||||
public ModuleDataModel ParentDataModel { get; set; }
|
||||
}
|
||||
}
|
||||
189
Artemis/Artemis/Modules/Abstract/ModuleModel.cs
Normal file
189
Artemis/Artemis/Modules/Abstract/ModuleModel.cs
Normal file
@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Profiles;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Modules.Abstract
|
||||
{
|
||||
public abstract class ModuleModel : IDisposable
|
||||
{
|
||||
private readonly LuaManager _luaManager;
|
||||
protected readonly DeviceManager DeviceManager;
|
||||
private DateTime _lastTrace;
|
||||
|
||||
public ModuleModel(DeviceManager deviceManager, LuaManager luaManager)
|
||||
{
|
||||
_luaManager = luaManager;
|
||||
|
||||
DeviceManager = deviceManager;
|
||||
PreviewLayers = new List<LayerModel>();
|
||||
|
||||
DeviceManager.OnKeyboardChanged += OnKeyboardChanged;
|
||||
}
|
||||
|
||||
#region Abstract properties
|
||||
|
||||
/// <summary>
|
||||
/// The module's name, used in setting files and logging
|
||||
/// </summary>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the module should be rendered as an overlay
|
||||
/// </summary>
|
||||
public abstract bool IsOverlay { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the module is enabled by a certain process
|
||||
/// </summary>
|
||||
public abstract bool IsBoundToProcess { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The module's settings
|
||||
/// </summary>
|
||||
public ModuleSettings Settings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The module's data model
|
||||
/// </summary>
|
||||
public ModuleDataModel DataModel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Base properties
|
||||
|
||||
[Inject]
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the module is initialized and ready to be updated/rendered
|
||||
/// </summary>
|
||||
public bool IsInitialized { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// If this collection contains any layers they will be drawn instead of the regular profile
|
||||
/// </summary>
|
||||
public List<LayerModel> PreviewLayers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The process the module is bound to
|
||||
/// </summary>
|
||||
public string ProcessName { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The currently active profile of the module
|
||||
/// </summary>
|
||||
public ProfileModel ProfileModel { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Base methods
|
||||
|
||||
public void ChangeProfile(ProfileModel profileModel)
|
||||
{
|
||||
if (!IsInitialized || Equals(profileModel, ProfileModel))
|
||||
return;
|
||||
|
||||
ProfileModel = profileModel;
|
||||
ProfileModel?.Activate(_luaManager);
|
||||
}
|
||||
|
||||
public virtual void Enable()
|
||||
{
|
||||
IsInitialized = true;
|
||||
ChangeToLastProfile();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
IsInitialized = false;
|
||||
|
||||
PreviewLayers.Clear();
|
||||
ProfileModel?.Deactivate(_luaManager);
|
||||
ProfileModel = null;
|
||||
}
|
||||
|
||||
private void OnKeyboardChanged(object sender, KeyboardChangedEventArgs e)
|
||||
{
|
||||
ChangeToLastProfile();
|
||||
}
|
||||
|
||||
private void ChangeToLastProfile()
|
||||
{
|
||||
var profileName = !string.IsNullOrEmpty(Settings?.LastProfile) ? Settings.LastProfile : "Default";
|
||||
ChangeProfile(ProfileProvider.GetProfile(DeviceManager.ActiveKeyboard, this, profileName));
|
||||
}
|
||||
|
||||
public abstract void Update();
|
||||
|
||||
public virtual void Render(RenderFrame frame, bool keyboardOnly)
|
||||
{
|
||||
if (ProfileModel == null || DataModel == null || DeviceManager.ActiveKeyboard == null)
|
||||
return;
|
||||
|
||||
lock (DataModel)
|
||||
{
|
||||
lock (ProfileModel)
|
||||
{
|
||||
// Get all enabled layers who's conditions are met
|
||||
var layers = GetRenderLayers(keyboardOnly);
|
||||
|
||||
// Render the keyboard layer-by-layer
|
||||
var keyboardRect = DeviceManager.ActiveKeyboard.KeyboardRectangle();
|
||||
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||
{
|
||||
ProfileModel?.DrawLayers(g, layers, DrawType.Keyboard, DataModel, keyboardRect, false, true);
|
||||
}
|
||||
// Render mice layer-by-layer
|
||||
var devRec = new Rect(0, 0, 40, 40);
|
||||
using (var g = Graphics.FromImage(frame.MouseBitmap))
|
||||
{
|
||||
ProfileModel?.DrawLayers(g, layers, DrawType.Mouse, DataModel, devRec, false, true);
|
||||
}
|
||||
// Render headsets layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.HeadsetBitmap))
|
||||
{
|
||||
ProfileModel?.DrawLayers(g, layers, DrawType.Headset, DataModel, devRec, false, true);
|
||||
}
|
||||
// Render generic devices layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.GenericBitmap))
|
||||
{
|
||||
ProfileModel?.DrawLayers(g, layers, DrawType.Generic, DataModel, devRec, false, true);
|
||||
}
|
||||
// Render mousemats layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.MousematBitmap))
|
||||
{
|
||||
ProfileModel?.DrawLayers(g, layers, DrawType.Mousemat, DataModel, devRec, false, true);
|
||||
}
|
||||
|
||||
// Trace debugging
|
||||
if (DateTime.Now.AddSeconds(-2) <= _lastTrace || Logger == null)
|
||||
return;
|
||||
|
||||
_lastTrace = DateTime.Now;
|
||||
var dmJson = JsonConvert.SerializeObject(DataModel, Formatting.Indented);
|
||||
Logger.Trace("Effect datamodel as JSON: \r\n{0}", dmJson);
|
||||
Logger.Trace("Effect {0} has to render {1} layers", Name, layers.Count);
|
||||
foreach (var renderLayer in layers)
|
||||
Logger.Trace("- Layer name: {0}, layer type: {1}", renderLayer.Name, renderLayer.LayerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return ProfileModel?.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,29 +1,34 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.DAL;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Settings
|
||||
{
|
||||
public class EffectSettings : IArtemisSettings
|
||||
{
|
||||
[DefaultValue("Default")]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public string LastProfile { get; set; }
|
||||
|
||||
public void Save()
|
||||
{
|
||||
SettingsProvider.Save(this);
|
||||
}
|
||||
|
||||
public void Reset(bool save = false)
|
||||
{
|
||||
JsonConvert.PopulateObject("{}", this, new JsonSerializerSettings
|
||||
{
|
||||
ObjectCreationHandling = ObjectCreationHandling.Reuse
|
||||
});
|
||||
|
||||
if (save)
|
||||
SettingsProvider.Save(this);
|
||||
}
|
||||
}
|
||||
using System.ComponentModel;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Settings;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Abstract
|
||||
{
|
||||
public abstract class ModuleSettings : IArtemisSettings
|
||||
{
|
||||
[DefaultValue(true)]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
[DefaultValue("Default")]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public string LastProfile { get; set; }
|
||||
|
||||
public void Save()
|
||||
{
|
||||
SettingsProvider.Save(this);
|
||||
}
|
||||
|
||||
public void Reset(bool save = false)
|
||||
{
|
||||
JsonConvert.PopulateObject("{}", this, new JsonSerializerSettings
|
||||
{
|
||||
ObjectCreationHandling = ObjectCreationHandling.Reuse
|
||||
});
|
||||
|
||||
if (save)
|
||||
SettingsProvider.Save(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
137
Artemis/Artemis/Modules/Abstract/ModuleViewModel.cs
Normal file
137
Artemis/Artemis/Modules/Abstract/ModuleViewModel.cs
Normal file
@ -0,0 +1,137 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Services;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Caliburn.Micro;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.Logging;
|
||||
using Ninject.Parameters;
|
||||
|
||||
namespace Artemis.Modules.Abstract
|
||||
{
|
||||
public abstract class ModuleViewModel : Screen
|
||||
{
|
||||
private readonly ModuleManager _moduleManager;
|
||||
private readonly MainManager _mainManager;
|
||||
private ModuleSettings _settings;
|
||||
|
||||
public ModuleViewModel(MainManager mainManager, ModuleModel moduleModel, IKernel kernel)
|
||||
{
|
||||
_mainManager = mainManager;
|
||||
_moduleManager = mainManager.ModuleManager;
|
||||
ModuleModel = moduleModel;
|
||||
|
||||
Settings = moduleModel.Settings;
|
||||
IParameter[] args =
|
||||
{
|
||||
new ConstructorArgument("mainManager", _mainManager),
|
||||
new ConstructorArgument("moduleModel", ModuleModel),
|
||||
new ConstructorArgument("lastProfile", Settings.LastProfile)
|
||||
};
|
||||
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
|
||||
|
||||
_mainManager.EnabledChanged += MainManagerOnEnabledChanged;
|
||||
_moduleManager.EffectChanged += ModuleManagerOnModuleChanged;
|
||||
}
|
||||
|
||||
public ProfileEditorViewModel ProfileEditor { get; set; }
|
||||
public ModuleModel ModuleModel { get; }
|
||||
|
||||
[Inject]
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
[Inject]
|
||||
public MetroDialogService DialogService { get; set; }
|
||||
|
||||
public ModuleSettings Settings
|
||||
{
|
||||
get { return _settings; }
|
||||
set
|
||||
{
|
||||
if (Equals(value, _settings)) return;
|
||||
_settings = value;
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsModuleActive => _moduleManager.ActiveModule == ModuleModel;
|
||||
public abstract bool UsesProfileEditor { get; }
|
||||
|
||||
private void MainManagerOnEnabledChanged(object sender, EnabledChangedEventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(() => IsModuleActive);
|
||||
UpdateIsEnabled();
|
||||
}
|
||||
|
||||
private void ModuleManagerOnModuleChanged(object sender, ModuleChangedEventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(() => IsModuleActive);
|
||||
UpdateIsEnabled();
|
||||
}
|
||||
|
||||
private void UpdateIsEnabled()
|
||||
{
|
||||
if (ModuleModel.IsBoundToProcess || ModuleModel.IsOverlay)
|
||||
return;
|
||||
|
||||
Settings.IsEnabled = IsModuleActive;
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
|
||||
public virtual void ToggleModule()
|
||||
{
|
||||
Settings.IsEnabled = !Settings.IsEnabled;
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
|
||||
// On process-bound modules, only set the module model
|
||||
if (ModuleModel.IsBoundToProcess || ModuleModel.IsOverlay)
|
||||
return;
|
||||
|
||||
// On other modules, activate them if necessary
|
||||
if (IsModuleActive && !Settings.IsEnabled)
|
||||
_moduleManager.ClearActiveModule();
|
||||
else if (!IsModuleActive && Settings.IsEnabled)
|
||||
_moduleManager.ChangeActiveModule(ModuleModel, _mainManager.LoopManager);
|
||||
}
|
||||
|
||||
public virtual void SaveSettings()
|
||||
{
|
||||
Settings?.Save();
|
||||
if (UsesProfileEditor)
|
||||
ProfileEditor.SaveSelectedProfile();
|
||||
if (!IsModuleActive)
|
||||
return;
|
||||
|
||||
// Restart the module if it's currently running to apply settings.
|
||||
_moduleManager.ChangeActiveModule(ModuleModel);
|
||||
}
|
||||
|
||||
public virtual async void ResetSettings()
|
||||
{
|
||||
var resetConfirm = await DialogService.ShowQuestionMessageBox("Reset module settings",
|
||||
"Are you sure you wish to reset this module's settings? \nAny changes you made will be lost.");
|
||||
|
||||
if (!resetConfirm.Value)
|
||||
return;
|
||||
|
||||
Settings.Reset(true);
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
base.OnActivate();
|
||||
ProfileEditor.Activate();
|
||||
}
|
||||
|
||||
protected override void OnDeactivate(bool close)
|
||||
{
|
||||
base.OnDeactivate(close);
|
||||
ProfileEditor.Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
<UserControl x:Class="Artemis.Modules.Effects.AudioVisualizer.AudioVisualizerView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15, 5, 15, 5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" FontSize="20" MaxWidth="500" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap" Text="Gone!" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
|
||||
<TextBlock Grid.Row="1" VerticalAlignment="Center" Margin="0,8" TextWrapping="Wrap"
|
||||
HorizontalAlignment="Left" TextAlignment="Justify">
|
||||
<Run Text="In case you're wondering where these effects went, they are now part of the layer system." />
|
||||
<LineBreak />
|
||||
<Run Text="To use them, navigate to the Windows Profile effect and select one of these profiles:" />
|
||||
<LineBreak /><Run Text="• Default - Type waves" /><LineBreak />
|
||||
<Run Text="• Default - Audio visualization" /><LineBreak /><Run /><LineBreak />
|
||||
<Run Text="You can also add these effects to your own profile, even in games! " /><LineBreak />
|
||||
<Run
|
||||
Text="To do so, create a new layer, open up its property window and change the type according to what you want it to be, 'key press' or 'audio visualization'." />
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AudioVisualizerView.xaml
|
||||
/// </summary>
|
||||
public partial class AudioVisualizerView : UserControl
|
||||
{
|
||||
public AudioVisualizerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
// This class allows you to handle specific events on the settings class:
|
||||
// The SettingChanging event is raised before a setting's value is changed.
|
||||
// The PropertyChanged event is raised after a setting's value is changed.
|
||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||
// The SettingsSaving event is raised before the setting values are saved.
|
||||
internal sealed partial class Bubbles
|
||||
{
|
||||
private void SettingChangingEventHandler(object sender, SettingChangingEventArgs e)
|
||||
{
|
||||
// Add code to handle the SettingChangingEvent event here.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, CancelEventArgs e)
|
||||
{
|
||||
// Add code to handle the SettingsSaving event here.
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Utilities;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public class BubblesModel : EffectModel
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public BubblesModel(DeviceManager deviceManager, LuaManager luaManager)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<BubblesSettings>(), null)
|
||||
{
|
||||
Name = "Bubbles";
|
||||
Initialized = false;
|
||||
Settings = (BubblesSettings) base.Settings;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private static readonly Random _random = new Random();
|
||||
|
||||
private readonly List<Bubble> _bubbles = new List<Bubble>();
|
||||
|
||||
public new BubblesSettings Settings { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
KeyboardScale = Settings.Smoothness;
|
||||
|
||||
var rect = DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||
var scaleFactor = Settings.Smoothness / 25.0;
|
||||
|
||||
for (var i = 0; i < Settings.BubbleCount; i++)
|
||||
{
|
||||
var color = Settings.IsRandomColors
|
||||
? ColorHelpers.GetRandomRainbowColor()
|
||||
: ColorHelpers.ToDrawingColor(Settings.BubbleColor);
|
||||
// -Settings.MoveSpeed because we want to spawn at least one move away from borders
|
||||
var initialPositionX = (rect.Width - Settings.BubbleSize * scaleFactor * 2 -
|
||||
Settings.MoveSpeed * scaleFactor) *
|
||||
_random.NextDouble() + Settings.BubbleSize * scaleFactor;
|
||||
var initialPositionY = (rect.Height - Settings.BubbleSize * scaleFactor * 2 -
|
||||
Settings.MoveSpeed * scaleFactor) *
|
||||
_random.NextDouble() + Settings.BubbleSize * scaleFactor;
|
||||
var initialDirectionX = Settings.MoveSpeed * scaleFactor * _random.NextDouble() *
|
||||
(_random.Next(1) == 0 ? -1 : 1);
|
||||
var initialDirectionY = (Settings.MoveSpeed * scaleFactor - Math.Abs(initialDirectionX)) *
|
||||
(_random.Next(1) == 0 ? -1 : 1);
|
||||
|
||||
_bubbles.Add(new Bubble(color, (int) Math.Round(Settings.BubbleSize * scaleFactor),
|
||||
new Point(initialPositionX, initialPositionY), new Vector(initialDirectionX, initialDirectionY)));
|
||||
}
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_bubbles.Clear();
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var keyboardRectangle = DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||
foreach (var bubble in _bubbles)
|
||||
{
|
||||
if (Settings.IsShiftColors)
|
||||
bubble.Color = ColorHelpers.ShiftColor(bubble.Color,
|
||||
Settings.IsRandomColors
|
||||
? (int) Math.Round(Settings.ShiftColorSpeed * _random.NextDouble())
|
||||
: Settings.ShiftColorSpeed);
|
||||
|
||||
bubble.CheckCollision(keyboardRectangle);
|
||||
bubble.Move();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||
{
|
||||
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||
{
|
||||
foreach (var bubble in _bubbles)
|
||||
bubble.Draw(g);
|
||||
}
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Profiles.Lua;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Castle.Components.DictionaryAdapter;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Effects.ProfilePreview
|
||||
{
|
||||
public class ProfilePreviewModel : EffectModel
|
||||
{
|
||||
public ProfilePreviewModel(DeviceManager deviceManager, LuaManager luaManager): base(deviceManager, luaManager, null, new ProfilePreviewDataModel())
|
||||
{
|
||||
Name = "Profile Preview";
|
||||
}
|
||||
|
||||
public ProfileViewModel ProfileViewModel { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return ProfileViewModel != null ? ProfileViewModel.GetRenderLayers() : new EditableList<LayerModel>();
|
||||
}
|
||||
|
||||
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||
{
|
||||
if ((Profile == null) || (DataModel == null) || (DeviceManager.ActiveKeyboard == null))
|
||||
return;
|
||||
|
||||
lock (DataModel)
|
||||
{
|
||||
// Get all enabled layers who's conditions are met
|
||||
var renderLayers = GetRenderLayers(keyboardOnly);
|
||||
|
||||
// If the profile has no active LUA wrapper, create one
|
||||
if (!Equals(LuaManager.ProfileModel, Profile))
|
||||
Profile.Activate(LuaManager);
|
||||
|
||||
// Render the keyboard layer-by-layer
|
||||
var keyboardRect = DeviceManager.ActiveKeyboard.KeyboardRectangle(KeyboardScale);
|
||||
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Keyboard),
|
||||
DataModel, keyboardRect, true, true, "keyboard");
|
||||
}
|
||||
// Render mice layer-by-layer
|
||||
var devRec = new Rect(0, 0, 40, 40);
|
||||
using (var g = Graphics.FromImage(frame.MouseBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Mouse), DataModel,
|
||||
devRec, true, true, "mouse");
|
||||
}
|
||||
// Render headsets layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.HeadsetBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Headset),
|
||||
DataModel, devRec, true, true, "headset");
|
||||
}
|
||||
// Render generic devices layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.GenericBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Generic),
|
||||
DataModel, devRec, true, true, "generic");
|
||||
}
|
||||
// Render mousemats layer-by-layer
|
||||
using (var g = Graphics.FromImage(frame.MousematBitmap))
|
||||
{
|
||||
Profile?.DrawLayers(g, renderLayers.Where(rl => rl.LayerType.DrawType == DrawType.Mousemat),
|
||||
DataModel, devRec, true, true, "mousemat");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class ProfilePreviewDataModel : IDataModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
using Artemis.Settings;
|
||||
|
||||
namespace Artemis.Modules.Effects.WindowsProfile
|
||||
{
|
||||
public class WindowsProfileSettings : GameSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
|
||||
namespace Artemis.Modules.Effects.WindowsProfile
|
||||
{
|
||||
// TODO: This effect is a hybrid between a regular effect and a game, may want to clean this up
|
||||
public sealed class WindowsProfileViewModel : EffectViewModel
|
||||
{
|
||||
public WindowsProfileViewModel(MainManager main, IKernel kernel, ProfilePreviewModel profilePreviewModel,
|
||||
[Named("WindowsProfileModel")] EffectModel model) : base(main, model)
|
||||
{
|
||||
DisplayName = "Windows Profile";
|
||||
ProfilePreviewModel = profilePreviewModel;
|
||||
EffectSettings = ((WindowsProfileModel) EffectModel).Settings;
|
||||
|
||||
IParameter[] args =
|
||||
{
|
||||
new ConstructorArgument("mainManager", main),
|
||||
new ConstructorArgument("effectModel", (WindowsProfileModel) EffectModel),
|
||||
new ConstructorArgument("lastProfile", ((WindowsProfileSettings) EffectSettings).LastProfile)
|
||||
};
|
||||
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
|
||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||
|
||||
EffectModel.Profile = ProfileEditor.SelectedProfile;
|
||||
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
|
||||
}
|
||||
|
||||
public ProfileEditorViewModel ProfileEditor { get; set; }
|
||||
public ProfilePreviewModel ProfilePreviewModel { get; set; }
|
||||
|
||||
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if ((e.PropertyName != "SelectedProfile") && IsActive)
|
||||
return;
|
||||
|
||||
EffectModel.Profile = ProfileEditor.SelectedProfile;
|
||||
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
|
||||
|
||||
if ((e.PropertyName != "SelectedProfile") || !ProfileEditor.ProfileViewModel.Activated ||
|
||||
(ProfileEditor.ProfileViewModel.SelectedProfile == null))
|
||||
return;
|
||||
|
||||
((WindowsProfileSettings) EffectSettings).LastProfile = ProfileEditor.ProfileViewModel.SelectedProfile.Name;
|
||||
EffectSettings.Save();
|
||||
}
|
||||
|
||||
public override void SaveSettings()
|
||||
{
|
||||
ProfileEditor.SaveSelectedProfile();
|
||||
base.SaveSettings();
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
base.OnActivate();
|
||||
ProfileEditor.Activate();
|
||||
}
|
||||
|
||||
protected override void OnDeactivate(bool close)
|
||||
{
|
||||
base.OnDeactivate(close);
|
||||
ProfileEditor.Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class CounterStrikeDataModel : IDataModel
|
||||
public class CounterStrikeDataModel : ModuleDataModel
|
||||
{
|
||||
public Provider provider { get; set; }
|
||||
public Map map { get; set; }
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Services;
|
||||
using Artemis.Utilities;
|
||||
@ -13,7 +11,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public class CounterStrikeModel : GameModel
|
||||
public class CounterStrikeModel : ModuleModel
|
||||
{
|
||||
private readonly MetroDialogService _dialogService;
|
||||
private readonly GameStateWebServer _gameStateWebServer;
|
||||
@ -22,40 +20,34 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
private DateTime _lastKill;
|
||||
private int _lastKills;
|
||||
|
||||
public CounterStrikeModel(DeviceManager deviceManager, LuaManager luaManager,
|
||||
GameStateWebServer gameStateWebServer, MetroDialogService dialogService)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<CounterStrikeSettings>(),
|
||||
new CounterStrikeDataModel())
|
||||
public CounterStrikeModel(DeviceManager deviceManager, LuaManager luaManager, MetroDialogService dialogService,
|
||||
GameStateWebServer gameStateWebServer) : base(deviceManager, luaManager)
|
||||
{
|
||||
_gameStateWebServer = gameStateWebServer;
|
||||
_dialogService = dialogService;
|
||||
|
||||
Name = "CounterStrike";
|
||||
Settings = SettingsProvider.Load<CounterStrikeSettings>();
|
||||
DataModel = new CounterStrikeDataModel();
|
||||
ProcessName = "csgo";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
|
||||
FindGameDir();
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public override string Name => "CounterStrike";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
_gameStateWebServer.GameDataReceived -= HandleGameData;
|
||||
|
||||
base.Dispose();
|
||||
_gameStateWebServer.GameDataReceived -= HandleGameData;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
_gameStateWebServer.GameDataReceived += HandleGameData;
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -80,8 +72,10 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
dm.player.state.made_kill = true;
|
||||
_lastKill = DateTime.Now;
|
||||
}
|
||||
else if (dm.player.state.made_kill && (DateTime.Now - _lastKill > TimeSpan.FromMilliseconds(500)))
|
||||
else if (dm.player.state.made_kill && DateTime.Now - _lastKill > TimeSpan.FromMilliseconds(500))
|
||||
{
|
||||
dm.player.state.made_kill = false;
|
||||
}
|
||||
_lastKills = dm.player.state.round_kills;
|
||||
|
||||
// Detect a headshot
|
||||
@ -90,8 +84,10 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
dm.player.state.made_headshot = true;
|
||||
_lastHeadshot = DateTime.Now;
|
||||
}
|
||||
else if (dm.player.state.made_headshot && (DateTime.Now - _lastHeadshot > TimeSpan.FromMilliseconds(500)))
|
||||
else if (dm.player.state.made_headshot && DateTime.Now - _lastHeadshot > TimeSpan.FromMilliseconds(500))
|
||||
{
|
||||
dm.player.state.made_headshot = false;
|
||||
}
|
||||
_lastHeadshots = dm.player.state.round_killhs;
|
||||
|
||||
// Detect a round win
|
||||
@ -106,7 +102,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
var gameSettings = (CounterStrikeSettings) Settings;
|
||||
// If already propertly set up, don't do anything
|
||||
if ((gameSettings.GameDirectory != null) && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
|
||||
if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
|
||||
File.Exists(gameSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg"))
|
||||
return;
|
||||
|
||||
@ -159,11 +155,5 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Settings;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public class CounterStrikeSettings : GameSettings
|
||||
public class CounterStrikeSettings : ModuleSettings
|
||||
{
|
||||
public string GameDirectory { get; set; }
|
||||
}
|
||||
|
||||
@ -28,11 +28,12 @@
|
||||
</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}"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@ -43,7 +44,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Counter-Strike Global Offensive directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
|
||||
@ -1,22 +1,24 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public sealed class CounterStrikeViewModel : GameViewModel
|
||||
public sealed class CounterStrikeViewModel : ModuleViewModel
|
||||
{
|
||||
public CounterStrikeViewModel(MainManager main, IKernel kernel, [Named("CounterStrikeModel")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
public CounterStrikeViewModel(MainManager mainManager,
|
||||
[Named(nameof(CounterStrikeModel))] ModuleModel moduleModel, IKernel kernel)
|
||||
: base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "CS:GO";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
((CounterStrikeModel) GameModel).PlaceConfigFile();
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
((CounterStrikeModel) ModuleModel).PlaceConfigFile();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class Dota2DataModel : IDataModel
|
||||
public class Dota2DataModel : ModuleDataModel
|
||||
{
|
||||
public Provider provider { get; set; }
|
||||
public Map map { get; set; }
|
||||
@ -15,6 +15,8 @@ namespace Artemis.Modules.Games.Dota2
|
||||
public Previously previously { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
[MoonSharpUserData]
|
||||
public class Provider
|
||||
{
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Services;
|
||||
using Artemis.Utilities;
|
||||
@ -12,43 +10,40 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public class Dota2Model : GameModel
|
||||
public class Dota2Model : ModuleModel
|
||||
{
|
||||
private readonly MetroDialogService _dialogService;
|
||||
private readonly GameStateWebServer _gameStateWebServer;
|
||||
|
||||
public Dota2Model(DeviceManager deviceManager, LuaManager luaManager, GameStateWebServer gameStateWebServer,
|
||||
MetroDialogService dialogService)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<Dota2Settings>(), new Dota2DataModel())
|
||||
|
||||
public Dota2Model(DeviceManager deviceManager, LuaManager luaManager, MetroDialogService dialogService,
|
||||
GameStateWebServer gameStateWebServer) : base(deviceManager, luaManager)
|
||||
{
|
||||
_gameStateWebServer = gameStateWebServer;
|
||||
_dialogService = dialogService;
|
||||
|
||||
Name = "Dota2";
|
||||
Settings = SettingsProvider.Load<Dota2Settings>();
|
||||
DataModel = new Dota2DataModel();
|
||||
ProcessName = "dota2";
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
Scale = 4;
|
||||
|
||||
FindGameDir();
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public override string Name => "Dota2";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
_gameStateWebServer.GameDataReceived -= HandleGameData;
|
||||
base.Dispose();
|
||||
_gameStateWebServer.GameDataReceived -= HandleGameData;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
_gameStateWebServer.GameDataReceived += HandleGameData;
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -83,16 +78,14 @@ namespace Artemis.Modules.Games.Dota2
|
||||
_gameStateWebServer.Port.ToString());
|
||||
try
|
||||
{
|
||||
File.WriteAllText(
|
||||
gameSettings.GameDirectory +
|
||||
"/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg", cfgFile);
|
||||
File.WriteAllText(gameSettings.GameDirectory +
|
||||
"/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg", cfgFile);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
Directory.CreateDirectory(gameSettings.GameDirectory + "/game/dota/cfg/gamestate_integration/");
|
||||
File.WriteAllText(
|
||||
gameSettings.GameDirectory +
|
||||
"/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg",
|
||||
File.WriteAllText(gameSettings.GameDirectory +
|
||||
"/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg",
|
||||
cfgFile);
|
||||
}
|
||||
|
||||
@ -126,10 +119,5 @@ namespace Artemis.Modules.Games.Dota2
|
||||
// Parse the JSON
|
||||
DataModel = JsonConvert.DeserializeObject<Dota2DataModel>(jsonString);
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public class Dota2Settings : GameSettings
|
||||
public class Dota2Settings : ModuleSettings
|
||||
{
|
||||
public string GameDirectory { get; set; }
|
||||
}
|
||||
|
||||
@ -28,11 +28,12 @@
|
||||
</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}"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@ -42,7 +43,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Dota 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
|
||||
@ -1,22 +1,23 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public sealed class Dota2ViewModel : GameViewModel
|
||||
public sealed class Dota2ViewModel : ModuleViewModel
|
||||
{
|
||||
public Dota2ViewModel(MainManager main, IKernel kernel, [Named("Dota2Model")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
public Dota2ViewModel(MainManager mainManager, [Named(nameof(Dota2Model))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Dota 2";
|
||||
}
|
||||
|
||||
public void PlaceConfigFile()
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
((Dota2Model) GameModel).PlaceConfigFile();
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
((Dota2Model) ModuleModel).PlaceConfigFile();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.EurotruckSimulator2.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class EurotruckSimulator2DataModel : IDataModel
|
||||
public class EurotruckSimulator2DataModel : ModuleDataModel
|
||||
{
|
||||
public EurotruckSimulator2DataModel()
|
||||
{
|
||||
|
||||
@ -1,52 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.EurotruckSimulator2.Data;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Services;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public class EurotruckSimulator2Model : GameModel
|
||||
public class EurotruckSimulator2Model : ModuleModel
|
||||
{
|
||||
private readonly MetroDialogService _dialogService;
|
||||
|
||||
|
||||
public EurotruckSimulator2Model(DeviceManager deviceManager, LuaManager luaManager,
|
||||
MetroDialogService dialogService)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<EurotruckSimulator2Settings>(),
|
||||
new EurotruckSimulator2DataModel())
|
||||
MetroDialogService dialogService) : base(deviceManager, luaManager)
|
||||
{
|
||||
_dialogService = dialogService;
|
||||
Name = "EurotruckSimulator2";
|
||||
|
||||
Settings = SettingsProvider.Load<EurotruckSimulator2Settings>();
|
||||
DataModel = new EurotruckSimulator2DataModel();
|
||||
ProcessName = "eurotrucks2";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
|
||||
FindGameDir();
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
public override string Name => "EurotruckSimulator2";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
@ -62,7 +45,6 @@ namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
|
||||
public void FindGameDir()
|
||||
{
|
||||
var gameSettings = (EurotruckSimulator2Settings) Settings;
|
||||
// Demo is also supported but resides in a different directory, the full game can also be 64-bits
|
||||
var dir = GeneralHelpers.FindSteamGame(@"\Euro Truck Simulator 2\bin\win_x64\eurotrucks2.exe") ??
|
||||
GeneralHelpers.FindSteamGame(@"\Euro Truck Simulator 2\bin\win_x86\eurotrucks2.exe") ??
|
||||
@ -71,8 +53,8 @@ namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
if (string.IsNullOrEmpty(dir))
|
||||
return;
|
||||
|
||||
gameSettings.GameDirectory = dir;
|
||||
gameSettings.Save();
|
||||
((EurotruckSimulator2Settings) Settings).GameDirectory = dir;
|
||||
Settings.Save();
|
||||
|
||||
if (!File.Exists(dir + "/plugins/ets2-telemetry-server.dll"))
|
||||
PlacePlugin();
|
||||
@ -80,11 +62,10 @@ namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
|
||||
public void PlacePlugin()
|
||||
{
|
||||
var gameSettings = (EurotruckSimulator2Settings) Settings;
|
||||
if (gameSettings.GameDirectory == string.Empty)
|
||||
if (((EurotruckSimulator2Settings) Settings).GameDirectory == string.Empty)
|
||||
return;
|
||||
|
||||
var path = gameSettings.GameDirectory;
|
||||
var path = ((EurotruckSimulator2Settings) Settings).GameDirectory;
|
||||
|
||||
// Ensure the selected directory exists
|
||||
if (!Directory.Exists(path))
|
||||
@ -119,10 +100,5 @@ namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public class EurotruckSimulator2Settings : GameSettings
|
||||
public class EurotruckSimulator2Settings : ModuleSettings
|
||||
{
|
||||
public string GameDirectory { get; set; }
|
||||
}
|
||||
|
||||
@ -47,11 +47,12 @@
|
||||
project by Funbit
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" 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}"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@ -62,7 +63,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Euro Truck Simulator 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlacePlugin]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
|
||||
@ -1,35 +1,35 @@
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public sealed class EurotruckSimulator2ViewModel : GameViewModel
|
||||
public sealed class EurotruckSimulator2ViewModel : ModuleViewModel
|
||||
{
|
||||
public EurotruckSimulator2ViewModel(MainManager main, IKernel kernel,
|
||||
[Named("EurotruckSimulator2Model")] GameModel model) : base(main, model, kernel)
|
||||
public EurotruckSimulator2ViewModel(MainManager mainManager,
|
||||
[Named(nameof(EurotruckSimulator2Model))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "ETS 2";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
public new EurotruckSimulator2Settings Settings { get; set; }
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog
|
||||
{
|
||||
SelectedPath = ((EurotruckSimulator2Settings) GameSettings).GameDirectory
|
||||
};
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = Settings.GameDirectory};
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((EurotruckSimulator2Settings) GameSettings).GameDirectory = Path.GetDirectoryName(dialog.SelectedPath);
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
Settings.GameDirectory = Path.GetDirectoryName(dialog.SelectedPath);
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
Settings.Save();
|
||||
|
||||
GameSettings.Save();
|
||||
((EurotruckSimulator2Model) GameModel).PlacePlugin();
|
||||
((EurotruckSimulator2Model) ModuleModel).PlacePlugin();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.GtaV
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class GtaVDataModel : IDataModel
|
||||
public class GtaVDataModel : ModuleDataModel
|
||||
{
|
||||
public bool IsWanted { get; set; }
|
||||
public string Color { get; set; }
|
||||
|
||||
@ -1,42 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
|
||||
namespace Artemis.Modules.Games.GtaV
|
||||
{
|
||||
public class GtaVModel : GameModel
|
||||
public class GtaVModel : ModuleModel
|
||||
{
|
||||
private readonly PipeServer _pipeServer;
|
||||
|
||||
public GtaVModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<GtaVSettings>(), new GtaVDataModel())
|
||||
: base(deviceManager, luaManager)
|
||||
{
|
||||
_pipeServer = pipeServer;
|
||||
Name = "GTAV";
|
||||
|
||||
Settings = SettingsProvider.Load<GtaVSettings>();
|
||||
DataModel = new GtaVDataModel();
|
||||
ProcessName = "GTA5";
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public override string Name => "GTAV";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
DllManager.PlaceLogitechDll();
|
||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
|
||||
// Delay restoring the DLL to allow GTA to release it
|
||||
Task.Factory.StartNew(() =>
|
||||
@ -46,7 +46,6 @@ namespace Artemis.Modules.Games.GtaV
|
||||
});
|
||||
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -54,14 +53,9 @@ namespace Artemis.Modules.Games.GtaV
|
||||
// DataModel updating is done whenever a pipe message is received
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
|
||||
private void PipeServerOnPipeMessage(string reply)
|
||||
{
|
||||
if (!Initialized)
|
||||
if (!IsInitialized)
|
||||
return;
|
||||
|
||||
// Convert the given string to a list of ints
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.GtaV
|
||||
{
|
||||
public class GtaVSettings : GameSettings
|
||||
public class GtaVSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -30,11 +30,12 @@
|
||||
</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}"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.GtaV
|
||||
{
|
||||
public sealed class GtaVViewModel : GameViewModel
|
||||
public sealed class GtaVViewModel : ModuleViewModel
|
||||
{
|
||||
public GtaVViewModel(MainManager mainManager, [Named("GtaVModel")] GameModel model, IKernel kernel)
|
||||
: base(mainManager, model, kernel)
|
||||
public GtaVViewModel(MainManager mainManager, [Named(nameof(GtaVModel))] ModuleModel moduleModel, IKernel kernel)
|
||||
: base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "GTA V";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.LightFx.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
using Newtonsoft.Json;
|
||||
@ -6,7 +6,7 @@ using Newtonsoft.Json;
|
||||
namespace Artemis.Modules.Games.LightFx
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class LightFxDataModel : IDataModel
|
||||
public class LightFxDataModel : ModuleDataModel
|
||||
{
|
||||
[JsonProperty(PropertyName = "lightFxState")]
|
||||
public LightFxState LightFxState { get; set; }
|
||||
|
||||
@ -1,73 +1,53 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.IO;
|
||||
//using Artemis.DAL;
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Models;
|
||||
//using Artemis.Profiles.Layers.Models;
|
||||
//using Artemis.Utilities.DataReaders;
|
||||
//using Newtonsoft.Json;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.LightFx
|
||||
//{
|
||||
// public class LightFxModel : GameModel
|
||||
// {
|
||||
// public LightFxModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
// : base(deviceManager, luaManager, SettingsProvider.Load<LightFxSettings>(), new LightFxDataModel())
|
||||
// {
|
||||
// Name = "LightFX";
|
||||
// ProcessName = "LoL";
|
||||
// Scale = 4;
|
||||
// Enabled = Settings.Enabled;
|
||||
// Initialized = false;
|
||||
//
|
||||
// // This model can enable itself by changing its process name to the currently running Light FX game.
|
||||
// pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
// }
|
||||
//
|
||||
// public int Scale { get; set; }
|
||||
//
|
||||
// private void PipeServerOnPipeMessage(string msg)
|
||||
// {
|
||||
// // Ensure it's Light FX JSON
|
||||
// if (!msg.Contains("lightFxState"))
|
||||
// return;
|
||||
//
|
||||
// // Deserialize and data
|
||||
// try
|
||||
// {
|
||||
// JsonConvert.PopulateObject(msg, DataModel);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Logger?.Error(ex, "Failed to deserialize LightFX JSON");
|
||||
// throw;
|
||||
// }
|
||||
//
|
||||
// // Setup process name
|
||||
// ProcessName = Path.GetFileNameWithoutExtension(((LightFxDataModel) DataModel).LightFxState.game);
|
||||
// }
|
||||
//
|
||||
// public override void Dispose()
|
||||
// {
|
||||
// Initialized = false;
|
||||
// base.Dispose();
|
||||
// }
|
||||
//
|
||||
// public override void Enable()
|
||||
// {
|
||||
// base.Enable();
|
||||
//
|
||||
// Initialized = true;
|
||||
// }
|
||||
//
|
||||
// public override void Update()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
// {
|
||||
// return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
using System;
|
||||
using System.IO;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.LightFx
|
||||
{
|
||||
public class LightFxModel : ModuleModel
|
||||
{
|
||||
public LightFxModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
: base(deviceManager, luaManager)
|
||||
{
|
||||
Settings = SettingsProvider.Load<LightFxSettings>();
|
||||
DataModel = new LightFxDataModel();
|
||||
ProcessName = "LoL";
|
||||
|
||||
// This model can enable itself by changing its process name to the currently running Light FX game.
|
||||
pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
}
|
||||
|
||||
public override string Name => "LightFX";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
private void PipeServerOnPipeMessage(string msg)
|
||||
{
|
||||
// Ensure it's Light FX JSON
|
||||
if (!msg.Contains("lightFxState"))
|
||||
return;
|
||||
|
||||
// Deserialize and data
|
||||
try
|
||||
{
|
||||
JsonConvert.PopulateObject(msg, DataModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.Error(ex, "Failed to deserialize LightFX JSON");
|
||||
throw;
|
||||
}
|
||||
|
||||
// Setup process name
|
||||
ProcessName = Path.GetFileNameWithoutExtension(((LightFxDataModel) DataModel).LightFxState.game);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.LightFx
|
||||
{
|
||||
public class LightFxSettings : GameSettings
|
||||
public class LightFxSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -36,11 +36,12 @@
|
||||
</Label>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" 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]" />
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Models;
|
||||
//using Artemis.ViewModels.Abstract;
|
||||
//using Ninject;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.LightFx
|
||||
//{
|
||||
// public sealed class LightFxViewModel : GameViewModel
|
||||
// {
|
||||
// public LightFxViewModel(MainManager main, IKernel kernel,
|
||||
// [Named("LightFxModel")] GameModel model) : base(main, model, kernel)
|
||||
// {
|
||||
// DisplayName = "Light FX";
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class OverwatchDataModel : IDataModel
|
||||
public class OverwatchDataModel : ModuleDataModel
|
||||
{
|
||||
public OverwatchStatus Status { get; set; }
|
||||
public OverwatchCharacter Character { get; set; }
|
||||
|
||||
@ -5,8 +5,7 @@ using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Services;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
@ -15,7 +14,7 @@ using Microsoft.Win32;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
public class OverwatchModel : GameModel
|
||||
public class OverwatchModel : ModuleModel
|
||||
{
|
||||
private readonly DebugViewModel _debugViewModel;
|
||||
private readonly MetroDialogService _dialogService;
|
||||
@ -29,26 +28,27 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
private DateTime _ultimateReady;
|
||||
private DateTime _ultimateUsed;
|
||||
|
||||
|
||||
public OverwatchModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer,
|
||||
MetroDialogService dialogService, DebugViewModel debugViewModel)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<OverwatchSettings>(), new OverwatchDataModel())
|
||||
MetroDialogService dialogService, DebugViewModel debugViewModel) : base(deviceManager, luaManager)
|
||||
{
|
||||
_pipeServer = pipeServer;
|
||||
_dialogService = dialogService;
|
||||
_debugViewModel = debugViewModel;
|
||||
Name = "Overwatch";
|
||||
|
||||
Settings = SettingsProvider.Load<OverwatchSettings>();
|
||||
DataModel = new OverwatchDataModel();
|
||||
ProcessName = "Overwatch";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
|
||||
LoadOverwatchCharacters();
|
||||
FindOverwatch();
|
||||
}
|
||||
|
||||
public List<CharacterColor> OverwatchCharacters { get; set; }
|
||||
public override string Name => "Overwatch";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public int Scale { get; set; }
|
||||
public List<CharacterColor> OverwatchCharacters { get; set; }
|
||||
|
||||
private void LoadOverwatchCharacters()
|
||||
{
|
||||
@ -82,26 +82,22 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
_stickyStatus = new StickyValue<OverwatchStatus>(300);
|
||||
_stickyUltimateReady = new StickyValue<bool>(350);
|
||||
_stickyUltimateUsed = new StickyValue<bool>(350);
|
||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
|
||||
_stickyStatus?.Dispose();
|
||||
_stickyUltimateReady?.Dispose();
|
||||
_stickyUltimateUsed?.Dispose();
|
||||
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private void PipeServerOnPipeMessage(string message)
|
||||
@ -146,10 +142,10 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
// Ult can't possibly be ready within 2 seconds of changing, this avoids false positives.
|
||||
// Filtering on ultReady and ultUsed removes false positives from the native ultimate effects
|
||||
// The control keys don't show during character select, so don't continue on those either.
|
||||
if ((_characterChange.AddSeconds(2) >= DateTime.Now) ||
|
||||
(_ultimateUsed.AddSeconds(2) >= DateTime.Now) ||
|
||||
(_ultimateReady.AddSeconds(2) >= DateTime.Now) ||
|
||||
(_stickyStatus.Value == OverwatchStatus.InCharacterSelect))
|
||||
if (_characterChange.AddSeconds(2) >= DateTime.Now ||
|
||||
_ultimateUsed.AddSeconds(2) >= DateTime.Now ||
|
||||
_ultimateReady.AddSeconds(2) >= DateTime.Now ||
|
||||
_stickyStatus.Value == OverwatchStatus.InCharacterSelect)
|
||||
return;
|
||||
|
||||
ParseSpecialKeys(gameDataModel, characterMatch, colors);
|
||||
@ -161,7 +157,7 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
if (string.IsNullOrEmpty(arrayString))
|
||||
return null;
|
||||
var intermediateArray = arrayString.Split('|');
|
||||
if ((intermediateArray[0] == "1") || (intermediateArray.Length < 2))
|
||||
if (intermediateArray[0] == "1" || intermediateArray.Length < 2)
|
||||
return null;
|
||||
var array = intermediateArray[1].Substring(1).Split(' ');
|
||||
if (!array.Any())
|
||||
@ -177,7 +173,7 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
|
||||
// Can't parse to a byte directly since it may contain values >254
|
||||
var parts = intermediate.Split(',').Select(int.Parse).ToArray();
|
||||
if ((parts[0] >= 5) && (parts[1] >= 21))
|
||||
if (parts[0] >= 5 && parts[1] >= 21)
|
||||
continue;
|
||||
|
||||
colors[parts[0], parts[1]] = Color.FromRgb((byte) parts[2], (byte) parts[3], (byte) parts[4]);
|
||||
@ -231,13 +227,13 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
private bool ControlsShown(Color[,] colors)
|
||||
{
|
||||
var keyColor = Color.FromRgb(222, 153, 0);
|
||||
return (colors[2, 3] == keyColor) || (colors[3, 2] == keyColor) ||
|
||||
(colors[3, 3] == keyColor) || (colors[3, 4] == keyColor);
|
||||
return colors[2, 3] == keyColor || colors[3, 2] == keyColor ||
|
||||
colors[3, 3] == keyColor || colors[3, 4] == keyColor;
|
||||
}
|
||||
|
||||
private void ParseSpecialKeys(OverwatchDataModel gameDataModel, CharacterColor? characterMatch, Color[,] colors)
|
||||
{
|
||||
if ((characterMatch == null) || (characterMatch.Value.Character == OverwatchCharacter.None))
|
||||
if (characterMatch == null || characterMatch.Value.Character == OverwatchCharacter.None)
|
||||
return;
|
||||
|
||||
// Ultimate is ready when Q is blinking
|
||||
@ -277,11 +273,6 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
gameDataModel.Ability2Ready = colors[2, 4].Equals(Color.FromRgb(4, 141, 144));
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
|
||||
public void FindOverwatch()
|
||||
{
|
||||
var gameSettings = Settings as OverwatchSettings;
|
||||
@ -289,7 +280,7 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
return;
|
||||
|
||||
// If already propertly set up, don't do anything
|
||||
if ((gameSettings.GameDirectory != null) && File.Exists(gameSettings.GameDirectory + "Overwatch.exe") &&
|
||||
if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "Overwatch.exe") &&
|
||||
File.Exists(gameSettings.GameDirectory + "RzChromaSDK64.dll"))
|
||||
return;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
public class OverwatchSettings : GameSettings
|
||||
public class OverwatchSettings : ModuleSettings
|
||||
{
|
||||
public string GameDirectory { get; set; }
|
||||
}
|
||||
|
||||
@ -45,11 +45,12 @@
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" 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]" />
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -1,30 +1,31 @@
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
public sealed class OverwatchViewModel : GameViewModel
|
||||
public sealed class OverwatchViewModel : ModuleViewModel
|
||||
{
|
||||
public OverwatchViewModel(MainManager main, IKernel kernel, [Named("OverwatchModel")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
public OverwatchViewModel(MainManager mainManager, [Named(nameof(OverwatchModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Overwatch";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((OverwatchSettings) GameSettings).GameDirectory};
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((OverwatchSettings) Settings).GameDirectory};
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((OverwatchSettings) GameSettings).GameDirectory = dialog.SelectedPath;
|
||||
GameSettings.Save();
|
||||
((OverwatchModel) GameModel).PlaceDll();
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
((OverwatchSettings) Settings).GameDirectory = dialog.SelectedPath;
|
||||
((OverwatchModel) ModuleModel).PlaceDll();
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.ProjectCars.Data;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.ProjectCars
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class ProjectCarsDataModel : IDataModel
|
||||
public class ProjectCarsDataModel : ModuleDataModel
|
||||
{
|
||||
public ProjectCarsDataModel()
|
||||
{
|
||||
|
||||
@ -1,56 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Games.ProjectCars.Data;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Services;
|
||||
|
||||
namespace Artemis.Modules.Games.ProjectCars
|
||||
{
|
||||
public class ProjectCarsModel : GameModel
|
||||
{
|
||||
private readonly MetroDialogService _dialogService;
|
||||
|
||||
public ProjectCarsModel(DeviceManager deviceManager, LuaManager luaManager, MetroDialogService dialogService)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<ProjectCarsSettings>(), new ProjectCarsDataModel())
|
||||
{
|
||||
_dialogService = dialogService;
|
||||
Name = "ProjectCars";
|
||||
ProcessName = "pCARS64";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var dataModel = (ProjectCarsDataModel) DataModel;
|
||||
var returnTuple = pCarsAPI_GetData.ReadSharedMemoryData();
|
||||
|
||||
// item1 is the true/false indicating a good read or not
|
||||
if (returnTuple.Item1)
|
||||
dataModel.GameData = dataModel.GameData.MapStructToClass(returnTuple.Item2, dataModel.GameData);
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.ProjectCars.Data;
|
||||
|
||||
namespace Artemis.Modules.Games.ProjectCars
|
||||
{
|
||||
public class ProjectCarsModel : ModuleModel
|
||||
{
|
||||
public ProjectCarsModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Settings = SettingsProvider.Load<ProjectCarsSettings>();
|
||||
DataModel = new ProjectCarsDataModel();
|
||||
ProcessName = "pCARS64";
|
||||
}
|
||||
|
||||
public override string Name => "ProjectCars";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var dataModel = (ProjectCarsDataModel) DataModel;
|
||||
var returnTuple = pCarsAPI_GetData.ReadSharedMemoryData();
|
||||
|
||||
// item1 is the true/false indicating a good read or not
|
||||
if (returnTuple.Item1)
|
||||
dataModel.GameData = dataModel.GameData.MapStructToClass(returnTuple.Item2, dataModel.GameData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.ProjectCars
|
||||
{
|
||||
public class ProjectCarsSettings : GameSettings
|
||||
public class ProjectCarsSettings : ModuleSettings
|
||||
{
|
||||
public string GameDirectory { get; set; }
|
||||
}
|
||||
}
|
||||
@ -46,11 +46,12 @@
|
||||
project by MikeyTT
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" 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]" />
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.ProjectCars
|
||||
{
|
||||
public sealed class ProjectCarsViewModel : GameViewModel
|
||||
public sealed class ProjectCarsViewModel : ModuleViewModel
|
||||
{
|
||||
public ProjectCarsViewModel(MainManager main, IKernel kernel,
|
||||
[Named("ProjectCarsModel")] GameModel model) : base(main, model, kernel)
|
||||
public ProjectCarsViewModel(MainManager mainManager, [Named(nameof(ProjectCarsModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Project CARS";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class RocketLeagueDataModel : IDataModel
|
||||
public class RocketLeagueDataModel : ModuleDataModel
|
||||
{
|
||||
public int Boost { get; set; }
|
||||
}
|
||||
|
||||
@ -1,29 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
public class RocketLeagueModel : GameModel
|
||||
public class RocketLeagueModel : ModuleModel
|
||||
{
|
||||
private Memory _memory;
|
||||
private GamePointersCollection _pointer;
|
||||
|
||||
public RocketLeagueModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager, SettingsProvider.Load<RocketLeagueSettings>(), new RocketLeagueDataModel())
|
||||
|
||||
public RocketLeagueModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Name = "RocketLeague";
|
||||
Settings = SettingsProvider.Load<RocketLeagueSettings>();
|
||||
DataModel = new RocketLeagueDataModel();
|
||||
ProcessName = "RocketLeague";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
|
||||
// Generate a new offset when the game is updated
|
||||
//var offset = new GamePointersCollection
|
||||
@ -43,20 +38,20 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
//var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public override string Name => "RocketLeague";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
_memory = null;
|
||||
base.Dispose();
|
||||
|
||||
_memory?.Dispose();
|
||||
_memory = null;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
Initialized = false;
|
||||
Updater.GetPointers();
|
||||
_pointer = SettingsProvider.Load<OffsetSettings>().RocketLeague;
|
||||
|
||||
@ -66,17 +61,17 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
|
||||
_memory = new Memory(tempProcess);
|
||||
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if ((Profile == null) || (DataModel == null) || (_memory == null))
|
||||
if (ProfileModel == null || DataModel == null || _memory == null)
|
||||
return;
|
||||
|
||||
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
|
||||
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
|
||||
var boostInt = (int) (_memory.ReadFloat(boostAddress)*100);
|
||||
var boostInt = (int) (_memory.ReadFloat(boostAddress) * 100);
|
||||
if (boostInt > 100)
|
||||
boostInt = 100;
|
||||
if (boostInt < 0)
|
||||
@ -84,10 +79,5 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
|
||||
((RocketLeagueDataModel) DataModel).Boost = boostInt;
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
public class RocketLeagueSettings : GameSettings
|
||||
public class RocketLeagueSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -3,9 +3,7 @@
|
||||
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">
|
||||
@ -19,8 +17,6 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
@ -32,19 +28,25 @@
|
||||
</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}"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
|
||||
<TextBlock x:Name="VersionText" Grid.Row="4" 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">
|
||||
<StackPanel Grid.Column="0" Grid.Row="5" 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"
|
||||
|
||||
@ -1,24 +1,26 @@
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
public sealed class RocketLeagueViewModel : GameViewModel
|
||||
public sealed class RocketLeagueViewModel : ModuleViewModel
|
||||
{
|
||||
private string _versionText;
|
||||
|
||||
public RocketLeagueViewModel(MainManager main, IKernel kernel, [Named("RocketLeagueModel")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
|
||||
public RocketLeagueViewModel(MainManager mainManager, [Named(nameof(RocketLeagueModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Rocket League";
|
||||
SetVersionText();
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public string VersionText
|
||||
{
|
||||
get { return _versionText; }
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class TheDivisionDataModel : IDataModel
|
||||
public class TheDivisionDataModel : ModuleDataModel
|
||||
{
|
||||
public PlayerState PartyMember1 { get; set; }
|
||||
public PlayerState PartyMember2 { get; set; }
|
||||
|
||||
@ -3,35 +3,35 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
public class TheDivisionModel : GameModel
|
||||
public class TheDivisionModel : ModuleModel
|
||||
{
|
||||
private readonly PipeServer _pipeServer;
|
||||
private StickyValue<bool> _stickyAmmo;
|
||||
private StickyValue<bool> _stickyHp;
|
||||
|
||||
public TheDivisionModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<TheDivisionSettings>(), new TheDivisionDataModel())
|
||||
: base(deviceManager, luaManager)
|
||||
{
|
||||
_pipeServer = pipeServer;
|
||||
Name = "TheDivision";
|
||||
|
||||
Settings = SettingsProvider.Load<TheDivisionSettings>();
|
||||
DataModel = new TheDivisionDataModel();
|
||||
ProcessName = "TheDivision";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public override string Name => "TheDivision";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
|
||||
// Delay restoring the DLL to allow The Division to release it
|
||||
Task.Factory.StartNew(() =>
|
||||
@ -42,28 +42,24 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
|
||||
_stickyAmmo?.Dispose();
|
||||
_stickyHp?.Dispose();
|
||||
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
Initialized = false;
|
||||
_stickyAmmo = new StickyValue<bool>(200);
|
||||
_stickyHp = new StickyValue<bool>(200);
|
||||
|
||||
DllManager.PlaceLogitechDll();
|
||||
|
||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
Initialized = true;
|
||||
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
private void PipeServerOnPipeMessage(string reply)
|
||||
{
|
||||
if (!Initialized)
|
||||
if (!IsInitialized)
|
||||
return;
|
||||
|
||||
// Convert the given string to a list of ints
|
||||
@ -86,7 +82,7 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
var bPer = parts[4];
|
||||
|
||||
// F1 to F4 indicate the player and his party. Blinks red on damage taken
|
||||
if ((keyCode >= 59) && (keyCode <= 62))
|
||||
if (keyCode >= 59 && keyCode <= 62)
|
||||
{
|
||||
var playerId = keyCode - 58;
|
||||
|
||||
@ -110,15 +106,15 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
// R blinks white when low on ammo
|
||||
else if (keyCode == 19)
|
||||
{
|
||||
_stickyAmmo.Value = (rPer == 100) && (gPer > 1) && (bPer > 1);
|
||||
_stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
gameDataModel.LowAmmo = _stickyAmmo.Value;
|
||||
}
|
||||
// G turns white when holding a grenade, turns off when out of grenades
|
||||
else if (keyCode == 34)
|
||||
{
|
||||
if ((rPer == 100) && (gPer < 10) && (bPer < 10))
|
||||
if (rPer == 100 && gPer < 10 && bPer < 10)
|
||||
gameDataModel.GrenadeState = GrenadeState.HasGrenade;
|
||||
else if ((rPer == 100) && (gPer > 10) && (bPer > 10))
|
||||
else if (rPer == 100 && gPer > 10 && bPer > 10)
|
||||
gameDataModel.GrenadeState = GrenadeState.GrenadeEquipped;
|
||||
else
|
||||
gameDataModel.GrenadeState = GrenadeState.HasNoGrenade;
|
||||
@ -126,7 +122,7 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
// V blinks on low HP
|
||||
else if (keyCode == 47)
|
||||
{
|
||||
_stickyHp.Value = (rPer == 100) && (gPer > 1) && (bPer > 1);
|
||||
_stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
|
||||
gameDataModel.LowHp = _stickyHp.Value;
|
||||
}
|
||||
}
|
||||
@ -135,10 +131,5 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
// DataModel updating is done whenever a pipe message is received
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
public class TheDivisionSettings : GameSettings
|
||||
public class TheDivisionSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -29,11 +29,12 @@
|
||||
</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}"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
using Ninject;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
public sealed class TheDivisionViewModel : GameViewModel
|
||||
public sealed class TheDivisionViewModel : ModuleViewModel
|
||||
{
|
||||
public TheDivisionViewModel(MainManager main, IKernel kernel, [Named("TheDivisionModel")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
public TheDivisionViewModel(MainManager mainManager, [Named(nameof(TheDivisionModel))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "The Division";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.UnrealTournament
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class UnrealTournamentDataModel : IDataModel
|
||||
public class UnrealTournamentDataModel : ModuleDataModel
|
||||
{
|
||||
public State State { get; set; }
|
||||
public Environment Environment { get; set; }
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Services;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Newtonsoft.Json;
|
||||
@ -18,25 +15,22 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Artemis.Modules.Games.UnrealTournament
|
||||
{
|
||||
public class UnrealTournamentModel : GameModel
|
||||
public class UnrealTournamentModel : ModuleModel
|
||||
{
|
||||
private readonly PipeServer _pipeServer;
|
||||
private readonly MetroDialogService _dialogService;
|
||||
private Timer _killTimer;
|
||||
private readonly PipeServer _pipeServer;
|
||||
private readonly Timer _killTimer;
|
||||
private int _lastScore;
|
||||
|
||||
public UnrealTournamentModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer,
|
||||
MetroDialogService dialogService)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<UnrealTournamentSettings>(),
|
||||
new UnrealTournamentDataModel())
|
||||
MetroDialogService dialogService) : base(deviceManager, luaManager)
|
||||
{
|
||||
_pipeServer = pipeServer;
|
||||
_dialogService = dialogService;
|
||||
Name = "UnrealTournament";
|
||||
|
||||
Settings = SettingsProvider.Load<UnrealTournamentSettings>();
|
||||
DataModel = new UnrealTournamentDataModel();
|
||||
ProcessName = "UE4-Win64-Shipping";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
|
||||
_killTimer = new Timer(3500);
|
||||
_killTimer.Elapsed += KillTimerOnElapsed;
|
||||
@ -44,11 +38,15 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
FindGame();
|
||||
}
|
||||
|
||||
public override string Name => "UnrealTournament";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public void FindGame()
|
||||
{
|
||||
var gameSettings = (UnrealTournamentSettings) Settings;
|
||||
// If already propertly set up, don't do anything
|
||||
if ((gameSettings.GameDirectory != null) &&
|
||||
if (gameSettings.GameDirectory != null &&
|
||||
File.Exists(gameSettings.GameDirectory + "UE4-Win64-Shipping.exe"))
|
||||
return;
|
||||
|
||||
@ -56,12 +54,10 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
if (!File.Exists(@"C:\ProgramData\Epic\UnrealEngineLauncher\LauncherInstalled.dat"))
|
||||
return;
|
||||
|
||||
var json =
|
||||
JsonConvert.DeserializeObject<JObject>(
|
||||
File.ReadAllText(@"C:\ProgramData\Epic\UnrealEngineLauncher\LauncherInstalled.dat"));
|
||||
var utEntry =
|
||||
json["InstallationList"].Children()
|
||||
.FirstOrDefault(c => c["AppName"].Value<string>() == "UnrealTournamentDev");
|
||||
var json = JsonConvert.DeserializeObject<JObject>(
|
||||
File.ReadAllText(@"C:\ProgramData\Epic\UnrealEngineLauncher\LauncherInstalled.dat"));
|
||||
var utEntry = json["InstallationList"].Children()
|
||||
.FirstOrDefault(c => c["AppName"].Value<string>() == "UnrealTournamentDev");
|
||||
if (utEntry == null)
|
||||
return;
|
||||
|
||||
@ -113,25 +109,20 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
Logger?.Info("Installed Unreal Tournament plugin in '{0}'", path);
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
|
||||
_killTimer.Stop();
|
||||
_pipeServer.PipeMessage -= PipeServerOnPipeMessage;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||
_killTimer.Start();
|
||||
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
private void PipeServerOnPipeMessage(string message)
|
||||
@ -181,10 +172,5 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
if (dataModel.Player != null)
|
||||
dataModel.Player.KillState = KillState.None;
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.UnrealTournament
|
||||
{
|
||||
public class UnrealTournamentSettings : GameSettings
|
||||
public class UnrealTournamentSettings : ModuleSettings
|
||||
{
|
||||
public string GameDirectory { get; set; }
|
||||
}
|
||||
|
||||
@ -29,11 +29,12 @@
|
||||
</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]" />
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@ -45,7 +46,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Unreal Tournament Directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||
Text="{Binding Path=Settings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceFiles]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
|
||||
@ -1,39 +1,35 @@
|
||||
using System.Windows.Forms;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Properties;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.UnrealTournament
|
||||
{
|
||||
public sealed class UnrealTournamentViewModel : GameViewModel
|
||||
public sealed class UnrealTournamentViewModel : ModuleViewModel
|
||||
{
|
||||
public UnrealTournamentViewModel(MainManager main, IKernel kernel,
|
||||
[Named("UnrealTournamentModel")] GameModel model) : base(main, model, kernel)
|
||||
public UnrealTournamentViewModel(MainManager mainManager,
|
||||
[Named(nameof(UnrealTournamentModel))] ModuleModel moduleModel, IKernel kernel)
|
||||
: base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "Unreal Tournament";
|
||||
InstallGif();
|
||||
}
|
||||
|
||||
public UnrealTournamentModel UnrealTournamentModel { get; set; }
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog
|
||||
{
|
||||
SelectedPath = ((UnrealTournamentSettings) GameSettings).GameDirectory
|
||||
};
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((UnrealTournamentSettings) Settings).GameDirectory};
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((UnrealTournamentSettings) GameSettings).GameDirectory = dialog.SelectedPath;
|
||||
GameSettings.Save();
|
||||
((UnrealTournamentModel) GameModel).PlaceFiles();
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
((UnrealTournamentSettings) Settings).GameDirectory = dialog.SelectedPath;
|
||||
((UnrealTournamentModel) ModuleModel).PlaceFiles();
|
||||
Settings.Save();
|
||||
NotifyOfPropertyChange(() => Settings);
|
||||
}
|
||||
|
||||
// Installing GIF on editor open to make sure the proper profiles are loaded
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class Witcher3DataModel : IDataModel
|
||||
public class Witcher3DataModel : ModuleDataModel
|
||||
{
|
||||
public WitcherSign WitcherSign { get; set; }
|
||||
public int MaxHealth { get; set; }
|
||||
|
||||
@ -1,51 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class Witcher3Model : GameModel
|
||||
public class Witcher3Model : ModuleModel
|
||||
{
|
||||
private readonly Regex _configRegex;
|
||||
private readonly Stopwatch _updateSw;
|
||||
private string _witcherSettings;
|
||||
|
||||
public Witcher3Model(DeviceManager deviceManager, LuaManager luaManager)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<Witcher3Settings>(), new Witcher3DataModel())
|
||||
public Witcher3Model(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Name = "Witcher3";
|
||||
ProcessName = "witcher3";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
|
||||
_updateSw = new Stopwatch();
|
||||
_configRegex = new Regex("\\[Artemis\\](.+?)\\[", RegexOptions.Singleline);
|
||||
|
||||
Settings = SettingsProvider.Load<Witcher3Settings>();
|
||||
DataModel = new Witcher3DataModel();
|
||||
ProcessName = "witcher3";
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public override string Name => "Witcher3";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
_witcherSettings = null;
|
||||
|
||||
_updateSw.Reset();
|
||||
base.Dispose();
|
||||
|
||||
_witcherSettings = null;
|
||||
_updateSw.Reset();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
Initialized = false;
|
||||
// Ensure the config file is found
|
||||
var witcherSettings = Environment.GetFolderPath(Environment.SpecialFolder.Personal) +
|
||||
@"\The Witcher 3\user.settings";
|
||||
@ -54,7 +47,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
|
||||
_updateSw.Start();
|
||||
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
@ -139,10 +132,5 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
gameDataModel.Vitality = vitalityInt;
|
||||
}
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class Witcher3Settings : GameSettings
|
||||
public class Witcher3Settings : ModuleSettings
|
||||
{
|
||||
// TODO: Change this to work the same as UT
|
||||
public string GameDirectory { get; set; }
|
||||
|
||||
@ -27,11 +27,12 @@
|
||||
</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]" />
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
||||
|
||||
@ -5,22 +5,23 @@ using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public sealed class Witcher3ViewModel : GameViewModel
|
||||
public sealed class Witcher3ViewModel : ModuleViewModel
|
||||
{
|
||||
public Witcher3ViewModel(MainManager main, IKernel kernel, [Named("Witcher3Model")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
public Witcher3ViewModel(MainManager mainManager, [Named(nameof(Witcher3Model))] ModuleModel moduleModel,
|
||||
IKernel kernel) : base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "The Witcher 3";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
|
||||
public async void AutoInstall()
|
||||
{
|
||||
// Request The Witcher 3 folder
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.WoW.Data;
|
||||
|
||||
namespace Artemis.Modules.Games.WoW
|
||||
{
|
||||
public class WoWDataModel : IDataModel
|
||||
public class WoWDataModel : ModuleDataModel
|
||||
{
|
||||
public WoWUnit Player { get; set; }
|
||||
public WoWUnit Target { get; set; }
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Modules.Games.WoW.Data;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Process.NET;
|
||||
@ -13,24 +11,22 @@ using Process.NET.Memory;
|
||||
|
||||
namespace Artemis.Modules.Games.WoW
|
||||
{
|
||||
public class WoWModel : GameModel
|
||||
public class WoWModel : ModuleModel
|
||||
{
|
||||
private readonly GamePointersCollection _pointer;
|
||||
private ProcessSharp _process;
|
||||
|
||||
public WoWModel(DeviceManager deviceManager, LuaManager luaManager)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<WoWSettings>(), new WoWDataModel())
|
||||
|
||||
public WoWModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Name = "WoW";
|
||||
Settings = SettingsProvider.Load<WoWSettings>();
|
||||
DataModel = new WoWDataModel();
|
||||
ProcessName = "Wow-64";
|
||||
Scale = 4;
|
||||
|
||||
// Currently WoW is locked behind a hidden trigger (obviously not that hidden since you're reading this)
|
||||
// It is using memory reading and lets first try to contact Blizzard
|
||||
var settings = SettingsProvider.Load<GeneralSettings>();
|
||||
Enabled = (settings.GamestatePort == 62575) && Settings.Enabled;
|
||||
|
||||
Initialized = false;
|
||||
Settings.IsEnabled = settings.GamestatePort == 62575 && Settings.IsEnabled;
|
||||
|
||||
_pointer = SettingsProvider.Load<OffsetSettings>().WorldOfWarcraft;
|
||||
//_pointer = new GamePointersCollection
|
||||
@ -64,33 +60,32 @@ namespace Artemis.Modules.Games.WoW
|
||||
//var res = JsonConvert.SerializeObject(_pointer, Formatting.Indented);
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public override string Name => "WoW";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => true;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
|
||||
_process?.Dispose();
|
||||
_process = null;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
if (tempProcess == null)
|
||||
return;
|
||||
|
||||
_process = new ProcessSharp(tempProcess, MemoryType.Remote);
|
||||
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if ((Profile == null) || (DataModel == null) || (_process == null))
|
||||
if (ProfileModel == null || DataModel == null || _process == null)
|
||||
return;
|
||||
|
||||
var dataModel = (WoWDataModel) DataModel;
|
||||
@ -104,7 +99,7 @@ namespace Artemis.Modules.Games.WoW
|
||||
_pointer.GameAddresses.First(a => a.Description == "TargetGuid").BasePointer, true);
|
||||
|
||||
dataModel.Player = player;
|
||||
if ((dataModel.Player != null) && (dataModel.Player.Guid != Guid.Empty))
|
||||
if (dataModel.Player != null && dataModel.Player.Guid != Guid.Empty)
|
||||
{
|
||||
dataModel.Player.UpdateDetails(nameCache);
|
||||
var target = player.GetTarget(objectManager);
|
||||
@ -119,10 +114,5 @@ namespace Artemis.Modules.Games.WoW
|
||||
dataModel.Target = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.WoW
|
||||
{
|
||||
public class WoWSettings : GameSettings
|
||||
public class WoWSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -32,11 +32,12 @@
|
||||
</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]" />
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Games.WoW
|
||||
{
|
||||
public sealed class WoWViewModel : GameViewModel
|
||||
public sealed class WoWViewModel : ModuleViewModel
|
||||
{
|
||||
public WoWViewModel(MainManager main, IKernel kernel, [Named("WoWModel")] GameModel model)
|
||||
: base(main, model, kernel)
|
||||
public WoWViewModel(MainManager mainManager, [Named(nameof(WoWModel))] ModuleModel moduleModel, IKernel kernel)
|
||||
: base(mainManager, moduleModel, kernel)
|
||||
{
|
||||
DisplayName = "WoW";
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => true;
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
using System.Windows;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
namespace Artemis.Modules.General.Bubbles
|
||||
{
|
||||
public class Bubble
|
||||
{
|
||||
104
Artemis/Artemis/Modules/General/Bubbles/BubblesModel.cs
Normal file
104
Artemis/Artemis/Modules/General/Bubbles/BubblesModel.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.Modules.General.Bubbles
|
||||
{
|
||||
public class BubblesModel : ModuleModel
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public BubblesModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
Settings = SettingsProvider.Load<BubblesSettings>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public override string Name => "Bubbles";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => false;
|
||||
|
||||
private static readonly Random Random = new Random();
|
||||
private readonly List<Bubble> _bubbles = new List<Bubble>();
|
||||
private int _scale;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
var bubbleSettings = (BubblesSettings) Settings;
|
||||
_scale = bubbleSettings.Smoothness;
|
||||
|
||||
var rect = DeviceManager.ActiveKeyboard.KeyboardRectangle(_scale);
|
||||
var scaleFactor = bubbleSettings.Smoothness / 25.0;
|
||||
|
||||
for (var i = 0; i < bubbleSettings.BubbleCount; i++)
|
||||
{
|
||||
var color = bubbleSettings.IsRandomColors
|
||||
? ColorHelpers.GetRandomRainbowColor()
|
||||
: ColorHelpers.ToDrawingColor(bubbleSettings.BubbleColor);
|
||||
// -bubbleSettings.MoveSpeed because we want to spawn at least one move away from borders
|
||||
var initialPositionX = (rect.Width - bubbleSettings.BubbleSize * scaleFactor * 2 -
|
||||
bubbleSettings.MoveSpeed * scaleFactor) *
|
||||
Random.NextDouble() + bubbleSettings.BubbleSize * scaleFactor;
|
||||
var initialPositionY = (rect.Height - bubbleSettings.BubbleSize * scaleFactor * 2 -
|
||||
bubbleSettings.MoveSpeed * scaleFactor) *
|
||||
Random.NextDouble() + bubbleSettings.BubbleSize * scaleFactor;
|
||||
var initialDirectionX = bubbleSettings.MoveSpeed * scaleFactor * Random.NextDouble() *
|
||||
(Random.Next(1) == 0 ? -1 : 1);
|
||||
var initialDirectionY = (bubbleSettings.MoveSpeed * scaleFactor - Math.Abs(initialDirectionX)) *
|
||||
(Random.Next(1) == 0 ? -1 : 1);
|
||||
|
||||
_bubbles.Add(new Bubble(color, (int) Math.Round(bubbleSettings.BubbleSize * scaleFactor),
|
||||
new Point(initialPositionX, initialPositionY), new Vector(initialDirectionX, initialDirectionY)));
|
||||
}
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_bubbles.Clear();
|
||||
IsInitialized = false;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var bubbleSettings = (BubblesSettings) Settings;
|
||||
var keyboardRectangle = DeviceManager.ActiveKeyboard.KeyboardRectangle(_scale);
|
||||
foreach (var bubble in _bubbles)
|
||||
{
|
||||
if (bubbleSettings.IsShiftColors)
|
||||
bubble.Color = ColorHelpers.ShiftColor(bubble.Color,
|
||||
bubbleSettings.IsRandomColors
|
||||
? (int) Math.Round(bubbleSettings.ShiftColorSpeed * Random.NextDouble())
|
||||
: bubbleSettings.ShiftColorSpeed);
|
||||
|
||||
bubble.CheckCollision(keyboardRectangle);
|
||||
bubble.Move();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Render(RenderFrame frame, bool keyboardOnly)
|
||||
{
|
||||
using (var g = Graphics.FromImage(frame.KeyboardBitmap))
|
||||
{
|
||||
foreach (var bubble in _bubbles)
|
||||
bubble.Draw(g);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Media;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
namespace Artemis.Modules.General.Bubbles
|
||||
{
|
||||
public class BubblesSettings : EffectSettings
|
||||
public class BubblesSettings : ModuleSettings
|
||||
{
|
||||
[DefaultValue(true)]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
@ -1,10 +1,9 @@
|
||||
<UserControl x:Class="Artemis.Modules.Effects.Bubbles.BubblesView"
|
||||
<UserControl x:Class="Artemis.Modules.General.Bubbles.BubblesView"
|
||||
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:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:cal="http://www.caliburnproject.org"
|
||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||
mc:Ignorable="d"
|
||||
@ -36,36 +35,29 @@
|
||||
</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"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
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>
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Color -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Height="16"
|
||||
Margin="0,8">
|
||||
Bubble color
|
||||
</TextBlock>
|
||||
<ncore:ColorBox Brush="{Binding BubbleColor, Mode=TwoWay}" Grid.Row="1" Grid.Column="1" Width="110"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,5,-1,5" Height="22"
|
||||
ShowNone="False" ShowLinear="False" ShowRadial="False"/>
|
||||
ShowNone="False" ShowLinear="False" ShowRadial="False" />
|
||||
<!-- Random colors -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Height="16" Margin="0,8">
|
||||
Use random colors
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.IsRandomColors, Mode=TwoWay}"
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=Settings.IsRandomColors, Mode=TwoWay}"
|
||||
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
@ -75,7 +67,7 @@
|
||||
Height="16" Margin="0,8">
|
||||
Shift through colors as the bubble moves
|
||||
</TextBlock>
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.IsShiftColors, Mode=TwoWay}"
|
||||
<controls:ToggleSwitch IsChecked="{Binding Path=Settings.IsShiftColors, Mode=TwoWay}"
|
||||
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
|
||||
OffLabel="No"
|
||||
Margin="0,0,-5,0" Width="114" />
|
||||
@ -87,7 +79,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=EffectSettings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
|
||||
Value="{Binding Path=Settings.ShiftColorSpeed, Mode=TwoWay}" Minimum="1" Maximum="200"
|
||||
SmallChange="45" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- coun -->
|
||||
@ -97,7 +89,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="BubbleCount" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.BubbleCount, Mode=TwoWay}" Minimum="1" Maximum="40"
|
||||
Value="{Binding Path=Settings.BubbleCount, Mode=TwoWay}" Minimum="1" Maximum="40"
|
||||
SmallChange="1" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- size -->
|
||||
@ -107,7 +99,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Size" Grid.Row="7" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.BubbleSize, Mode=TwoWay}" Minimum="10" Maximum="50"
|
||||
Value="{Binding Path=Settings.BubbleSize, Mode=TwoWay}" Minimum="10" Maximum="50"
|
||||
SmallChange="10" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- speed -->
|
||||
@ -117,7 +109,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="MoveSpeed" Grid.Row="8" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.MoveSpeed, Mode=TwoWay}" Minimum="1" Maximum="15"
|
||||
Value="{Binding Path=Settings.MoveSpeed, Mode=TwoWay}" Minimum="1" Maximum="15"
|
||||
SmallChange="10" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Smoothness -->
|
||||
@ -127,7 +119,7 @@
|
||||
</TextBlock>
|
||||
<Slider x:Name="Smoothness" Grid.Row="9" Grid.Column="1" VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right" Width="110" TickPlacement="None" TickFrequency="1"
|
||||
Value="{Binding Path=EffectSettings.Smoothness, Mode=TwoWay}" Minimum="1" Maximum="100"
|
||||
Value="{Binding Path=Settings.Smoothness, Mode=TwoWay}" Minimum="1" Maximum="100"
|
||||
SmallChange="10" IsSnapToTickEnabled="True" />
|
||||
|
||||
<!-- Buttons -->
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
namespace Artemis.Modules.General.Bubbles
|
||||
{
|
||||
public partial class BubblesView : UserControl
|
||||
{
|
||||
@ -1,21 +1,19 @@
|
||||
using System.Windows.Media;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Ninject;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
namespace Artemis.Modules.General.Bubbles
|
||||
{
|
||||
public sealed class BubblesViewModel : EffectViewModel
|
||||
public sealed class BubblesViewModel : ModuleViewModel
|
||||
{
|
||||
private readonly BubblesModel _model;
|
||||
private SolidColorBrush _bubbleColor;
|
||||
|
||||
public BubblesViewModel(MainManager main, [Named("BubblesModel")] EffectModel model) : base(main, model)
|
||||
public BubblesViewModel(MainManager mainManager, [Named(nameof(BubblesModel))] ModuleModel model, IKernel kernel)
|
||||
: base(mainManager, model, kernel)
|
||||
{
|
||||
_model = (BubblesModel) model;
|
||||
DisplayName = "Bubbles";
|
||||
BubbleColor = new SolidColorBrush(_model.Settings.BubbleColor);
|
||||
BubbleColor = new SolidColorBrush(((BubblesSettings) ModuleModel.Settings).BubbleColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -29,9 +27,11 @@ namespace Artemis.Modules.Effects.Bubbles
|
||||
if (Equals(value, _bubbleColor)) return;
|
||||
_bubbleColor = (SolidColorBrush) value;
|
||||
|
||||
_model.Settings.BubbleColor = _bubbleColor.Color;
|
||||
((BubblesSettings) ModuleModel.Settings).BubbleColor = _bubbleColor.Color;
|
||||
NotifyOfPropertyChange(() => BubbleColor);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool UsesProfileEditor => false;
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Modules.Abstract;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Artemis.Modules.Effects.WindowsProfile
|
||||
namespace Artemis.Modules.General.GeneralProfile
|
||||
{
|
||||
[MoonSharpUserData]
|
||||
public class WindowsProfileDataModel : IDataModel
|
||||
public class GeneralProfileDataModel : ModuleDataModel
|
||||
{
|
||||
public WindowsProfileDataModel()
|
||||
public GeneralProfileDataModel()
|
||||
{
|
||||
Spotify = new Spotify();
|
||||
GooglePlayMusic = new GooglePlayMusic();
|
||||
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@ -8,15 +8,14 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.DAL;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Modules.Abstract;
|
||||
using Artemis.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using SpotifyAPI.Local;
|
||||
|
||||
namespace Artemis.Modules.Effects.WindowsProfile
|
||||
namespace Artemis.Modules.General.GeneralProfile
|
||||
{
|
||||
public class WindowsProfileModel : EffectModel
|
||||
public class GeneralProfileModel : ModuleModel
|
||||
{
|
||||
private List<PerformanceCounter> _cores;
|
||||
private int _cpuFrames;
|
||||
@ -25,34 +24,29 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
private SpotifyLocalAPI _spotify;
|
||||
private bool _spotifySetupBusy;
|
||||
|
||||
public WindowsProfileModel(DeviceManager deviceManager, LuaManager luaManager)
|
||||
: base(deviceManager, luaManager, SettingsProvider.Load<WindowsProfileSettings>(),
|
||||
new WindowsProfileDataModel())
|
||||
public GeneralProfileModel(DeviceManager deviceManager, LuaManager luaManager) : base(deviceManager, luaManager)
|
||||
{
|
||||
_lastMusicUpdate = DateTime.Now;
|
||||
|
||||
Name = "WindowsProfile";
|
||||
Settings = SettingsProvider.Load<GeneralProfileSettings>();
|
||||
DataModel = new GeneralProfileDataModel();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
base.Dispose();
|
||||
}
|
||||
public override string Name => "GeneralProfile";
|
||||
public override bool IsOverlay => false;
|
||||
public override bool IsBoundToProcess => false;
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
base.Enable();
|
||||
|
||||
SetupCpu();
|
||||
SetupSpotify();
|
||||
|
||||
Initialized = true;
|
||||
base.Enable();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var dataModel = (WindowsProfileDataModel) DataModel;
|
||||
var dataModel = (GeneralProfileDataModel) DataModel;
|
||||
UpdateCpu(dataModel);
|
||||
UpdateMusicPlayers(dataModel);
|
||||
UpdateDay(dataModel);
|
||||
@ -62,7 +56,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
|
||||
#region Current Time
|
||||
|
||||
private void UpdateDay(WindowsProfileDataModel dataModel)
|
||||
private void UpdateDay(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
dataModel.CurrentTime.Hours24 = int.Parse(now.ToString("HH"));
|
||||
@ -94,9 +88,9 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCpu(WindowsProfileDataModel dataModel)
|
||||
private void UpdateCpu(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
if ((_cores == null) || (_overallCpu == null))
|
||||
if (_cores == null || _overallCpu == null)
|
||||
return;
|
||||
|
||||
// CPU is only updated every 15 frames, the performance counter gives 0 if updated too often
|
||||
@ -135,11 +129,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
dataModel.Performance.RAMUsage = (int) percentOccupied;
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly, false);
|
||||
}
|
||||
|
||||
public static PerformanceCounter GetOverallPerformanceCounter()
|
||||
{
|
||||
var cpuCounter = new PerformanceCounter
|
||||
@ -181,8 +170,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
{
|
||||
var tryCount = 0;
|
||||
while (tryCount <= 10)
|
||||
{
|
||||
// Causes WebException if not internet connection is available
|
||||
try
|
||||
{
|
||||
tryCount++;
|
||||
@ -195,13 +182,11 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
_spotifySetupBusy = false;
|
||||
});
|
||||
}
|
||||
|
||||
public void UpdateMusicPlayers(WindowsProfileDataModel dataModel)
|
||||
public void UpdateMusicPlayers(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
// This is quite resource hungry so only update it once every two seconds
|
||||
if (DateTime.Now - _lastMusicUpdate < TimeSpan.FromSeconds(2))
|
||||
@ -212,7 +197,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
UpdateGooglePlayMusic(dataModel);
|
||||
}
|
||||
|
||||
private void UpdateSpotify(WindowsProfileDataModel dataModel)
|
||||
private void UpdateSpotify(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
// Spotify
|
||||
if (!dataModel.Spotify.Running && SpotifyLocalAPI.IsSpotifyRunning())
|
||||
@ -238,7 +223,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
(int) (status.PlayingPosition / dataModel.Spotify.SongLength * 100.0);
|
||||
}
|
||||
|
||||
private void UpdateGooglePlayMusic(WindowsProfileDataModel dataModel)
|
||||
private void UpdateGooglePlayMusic(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
// Google Play Music
|
||||
var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
@ -257,14 +242,14 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
CallingConvention = CallingConvention.Winapi)]
|
||||
public static extern short GetKeyState(int keyCode);
|
||||
|
||||
private void UpdateKeyStates(WindowsProfileDataModel dataModel)
|
||||
private void UpdateKeyStates(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
dataModel.Keyboard.NumLock = ((ushort) GetKeyState(0x90) & 0xffff) != 0;
|
||||
dataModel.Keyboard.CapsLock = ((ushort) GetKeyState(0x14) & 0xffff) != 0;
|
||||
dataModel.Keyboard.ScrollLock = ((ushort) GetKeyState(0x91) & 0xffff) != 0;
|
||||
}
|
||||
|
||||
private void UpdateActiveWindow(WindowsProfileDataModel dataModel)
|
||||
private void UpdateActiveWindow(GeneralProfileDataModel dataModel)
|
||||
{
|
||||
dataModel.ActiveWindow.ProcessName = ActiveWindowHelper.ActiveWindowProcessName;
|
||||
dataModel.ActiveWindow.WindowTitle = ActiveWindowHelper.ActiveWindowWindowTitle;
|
||||
@ -0,0 +1,8 @@
|
||||
using Artemis.Modules.Abstract;
|
||||
|
||||
namespace Artemis.Modules.General.GeneralProfile
|
||||
{
|
||||
public class GeneralProfileSettings : ModuleSettings
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,9 @@
|
||||
<UserControl x:Class="Artemis.Modules.Effects.WindowsProfile.WindowsProfileView"
|
||||
<UserControl x:Class="Artemis.Modules.General.GeneralProfile.GeneralProfileView"
|
||||
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">
|
||||
@ -27,25 +25,25 @@
|
||||
<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="Allows you to create layers shown while not gaming" />
|
||||
<AccessText TextWrapping="Wrap" Text="Allows you to create layers shown while not gaming" />
|
||||
</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"
|
||||
<Label Content="Enable module" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton Margin="0 3 0 0" Width="25" Height="25"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
|
||||
ToolTip="Note: You can't enable an effect when Artemis is disabled" />
|
||||
ToolTip="Note: You can't enable an module when Artemis is disabled"
|
||||
IsChecked="{Binding Path=Settings.Enabled, Mode=OneWay}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleModule]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,-30,0" x:Name="ProfileEditor"/>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
<Button x:Name="ResetSettings" Content="Reset module" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user