mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added addition DI to modules
Added Eurotruck Simulator 2 module
This commit is contained in:
parent
b0d33b29f2
commit
21dbbe4eef
@ -3,6 +3,7 @@
|
||||
<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" />
|
||||
@ -29,6 +30,17 @@
|
||||
<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>
|
||||
|
||||
@ -165,6 +165,10 @@
|
||||
<HintPath>..\packages\DynamicExpresso.Core.1.3.1.0\lib\net40\DynamicExpresso.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ets2SdkClient, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>lib\Ets2SdkClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GongSolutions.Wpf.DragDrop, Version=0.1.4.3, Culture=neutral, PublicKeyToken=d19974ea350ccea1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\gong-wpf-dragdrop.0.1.4.3\lib\net40\GongSolutions.Wpf.DragDrop.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -216,6 +220,10 @@
|
||||
<HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.Conventions, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Conventions.3.2.0.0\lib\net45-full\Ninject.Extensions.Conventions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.Factory, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Factory.3.2.1.0\lib\net45-full\Ninject.Extensions.Factory.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -324,12 +332,16 @@
|
||||
<Compile Include="DeviceProviders\Logitech\G810.cs" />
|
||||
<Compile Include="DeviceProviders\Logitech\LogitechGeneric.cs" />
|
||||
<Compile Include="DeviceProviders\Logitech\LogitechKeyboard.cs" />
|
||||
<Compile Include="Events\ActiveKeyboardChanged.cs" />
|
||||
<Compile Include="Events\EffectChangedEventArgs.cs" />
|
||||
<Compile Include="Events\EnabledChangedEventArgs.cs" />
|
||||
<Compile Include="Events\KeyboardChangedEventArgs.cs" />
|
||||
<Compile Include="Events\RazerColorArrayChanged.cs" />
|
||||
<Compile Include="Events\ToggleEnabled.cs" />
|
||||
<Compile Include="Events\ActiveEffectChanged.cs" />
|
||||
<Compile Include="Events\RazerColorsChangedEventArgs.cs" />
|
||||
<Compile Include="InjectionFactories\ILayerEditorVmFactory.cs" />
|
||||
<Compile Include="InjectionFactories\IProfileEditorVmFactory.cs" />
|
||||
<Compile Include="InjectionModules\DeviceModules.cs" />
|
||||
<Compile Include="InjectionModules\EffectModules.cs" />
|
||||
<Compile Include="InjectionModules\ProfileModules.cs" />
|
||||
<Compile Include="ItemBehaviours\BindableSelectedItemBehavior.cs" />
|
||||
<Compile Include="DeviceProviders\Corsair\CorsairKeyboards.cs" />
|
||||
<Compile Include="DeviceProviders\KeyboardProvider.cs" />
|
||||
@ -352,6 +364,18 @@
|
||||
<Compile Include="Models\OverlaySettings.cs" />
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualization.cs" />
|
||||
<Compile Include="Modules\Effects\Bubbles\Bubbles.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>EurotruckSimulator2.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2DataModel.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2Model.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2Settings.cs" />
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2View.xaml.cs">
|
||||
<DependentUpon>EurotruckSimulator2View.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2ViewModel.cs" />
|
||||
<Compile Include="Modules\Games\UnrealTournament\UnrealTournament.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
@ -497,7 +521,6 @@
|
||||
<Compile Include="Modules\Effects\AudioVisualizer\AudioVisualizerSettings.cs" />
|
||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplaySettings.cs" />
|
||||
<Compile Include="Modules\Games\RocketLeague\RocketLeagueSettings.cs" />
|
||||
<Compile Include="InjectionModules\ArtemisModules.cs" />
|
||||
<Compile Include="InjectionModules\BaseModules.cs" />
|
||||
<Compile Include="InjectionModules\ManagerModules.cs" />
|
||||
<Compile Include="Profiles\Layers\Animations\GrowAnimation.cs" />
|
||||
@ -670,6 +693,10 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Modules\Games\UnrealTournament\Resources\ut-plugin.zip" />
|
||||
<None Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>EurotruckSimulator2.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Modules\Games\UnrealTournament\UnrealTournament.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>UnrealTournament.Designer.cs</LastGenOutput>
|
||||
@ -734,6 +761,8 @@
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
<Resource Include="Resources\bow.png" />
|
||||
<Content Include="lib\ColorBox.dll" />
|
||||
<Content Include="lib\Ets2SdkClient.dll" />
|
||||
<Content Include="logo.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -781,6 +810,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Modules\Games\EurotruckSimulator2\EurotruckSimulator2View.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Modules\Games\Overwatch\OverwatchView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@ -12,7 +11,6 @@ using Artemis.ViewModels;
|
||||
using Caliburn.Micro;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis
|
||||
{
|
||||
@ -75,7 +73,9 @@ namespace Artemis
|
||||
|
||||
protected override void Configure()
|
||||
{
|
||||
_kernel = new StandardKernel(new BaseModules(), new ArtemisModules(), new ManagerModules());
|
||||
_kernel = new StandardKernel(new BaseModules(), new ManagerModules(), new DeviceModules(),
|
||||
new EffectModules(), new ProfileModules());
|
||||
|
||||
_kernel.Bind<IWindowManager>().To<WindowManager>().InSingletonScope();
|
||||
_kernel.Bind<IEventAggregator>().To<EventAggregator>().InSingletonScope();
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class ActiveEffectChanged
|
||||
{
|
||||
public ActiveEffectChanged(string activeEffect)
|
||||
{
|
||||
ActiveEffect = activeEffect;
|
||||
}
|
||||
|
||||
public string ActiveEffect { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
using Artemis.DeviceProviders;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class ActiveKeyboardChanged
|
||||
{
|
||||
public ActiveKeyboardChanged(KeyboardProvider oldKeyboard, KeyboardProvider newKeyboard)
|
||||
{
|
||||
OldKeyboard = oldKeyboard;
|
||||
NewKeyboard = newKeyboard;
|
||||
}
|
||||
|
||||
public KeyboardProvider OldKeyboard { get; set; }
|
||||
public KeyboardProvider NewKeyboard { get; set; }
|
||||
}
|
||||
}
|
||||
15
Artemis/Artemis/Events/EffectChangedEventArgs.cs
Normal file
15
Artemis/Artemis/Events/EffectChangedEventArgs.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using Artemis.Models;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class EffectChangedEventArgs : EventArgs
|
||||
{
|
||||
public EffectChangedEventArgs(EffectModel effect)
|
||||
{
|
||||
Effect = effect;
|
||||
}
|
||||
|
||||
public EffectModel Effect { get; }
|
||||
}
|
||||
}
|
||||
14
Artemis/Artemis/Events/EnabledChangedEventArgs.cs
Normal file
14
Artemis/Artemis/Events/EnabledChangedEventArgs.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class EnabledChangedEventArgs : EventArgs
|
||||
{
|
||||
public EnabledChangedEventArgs(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public bool Enabled { get; }
|
||||
}
|
||||
}
|
||||
17
Artemis/Artemis/Events/KeyboardChangedEventArgs.cs
Normal file
17
Artemis/Artemis/Events/KeyboardChangedEventArgs.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using Artemis.DeviceProviders;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class KeyboardChangedEventArgs : EventArgs
|
||||
{
|
||||
public KeyboardChangedEventArgs(KeyboardProvider oldKeyboard, KeyboardProvider newKeyboard)
|
||||
{
|
||||
OldKeyboard = oldKeyboard;
|
||||
NewKeyboard = newKeyboard;
|
||||
}
|
||||
|
||||
public KeyboardProvider OldKeyboard { get; }
|
||||
public KeyboardProvider NewKeyboard { get; }
|
||||
}
|
||||
}
|
||||
15
Artemis/Artemis/Events/RazerColorsChangedEventArgs.cs
Normal file
15
Artemis/Artemis/Events/RazerColorsChangedEventArgs.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class RazerColorsChangedEventArgs : EventArgs
|
||||
{
|
||||
public RazerColorsChangedEventArgs(Color[,] colors)
|
||||
{
|
||||
Colors = colors;
|
||||
}
|
||||
|
||||
public Color[,] Colors { get; }
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
namespace Artemis.Events
|
||||
{
|
||||
public class ToggleEnabled
|
||||
{
|
||||
public ToggleEnabled(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,11 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.InjectionFactories
|
||||
{
|
||||
public interface IProfileEditorVmFactory
|
||||
{
|
||||
ProfileEditorViewModel CreateProfileEditorVm(IEventAggregator events, MainManager mainManager,
|
||||
EffectModel gameModel, string lastProfile);
|
||||
ProfileEditorViewModel CreateProfileEditorVm(MainManager mainManager, EffectModel gameModel, string lastProfile);
|
||||
}
|
||||
}
|
||||
@ -1,105 +0,0 @@
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.DeviceProviders.Corsair;
|
||||
using Artemis.DeviceProviders.Logitech;
|
||||
using Artemis.DeviceProviders.Razer;
|
||||
using Artemis.Modules.Effects.AudioVisualizer;
|
||||
using Artemis.Modules.Effects.Bubbles;
|
||||
using Artemis.Modules.Effects.WindowsProfile;
|
||||
using Artemis.Modules.Games.CounterStrike;
|
||||
using Artemis.Modules.Games.Dota2;
|
||||
using Artemis.Modules.Games.Overwatch;
|
||||
using Artemis.Modules.Games.RocketLeague;
|
||||
using Artemis.Modules.Games.TheDivision;
|
||||
using Artemis.Modules.Games.UnrealTournament;
|
||||
using Artemis.Modules.Games.Witcher3;
|
||||
using Artemis.Modules.Overlays.VolumeDisplay;
|
||||
using Artemis.Profiles.Layers.Animations;
|
||||
using Artemis.Profiles.Layers.Conditions;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Types.Audio;
|
||||
using Artemis.Profiles.Layers.Types.Folder;
|
||||
using Artemis.Profiles.Layers.Types.Generic;
|
||||
using Artemis.Profiles.Layers.Types.Headset;
|
||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||
using Artemis.Profiles.Layers.Types.KeyboardGif;
|
||||
using Artemis.Profiles.Layers.Types.KeyPress;
|
||||
using Artemis.Profiles.Layers.Types.Mouse;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Ninject.Modules;
|
||||
|
||||
namespace Artemis.InjectionModules
|
||||
{
|
||||
public class ArtemisModules : NinjectModule
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
#region Modules
|
||||
|
||||
// Effects
|
||||
Bind<EffectViewModel>().To<AudioVisualizerViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<BubblesViewModel>().InSingletonScope();
|
||||
Bind<EffectViewModel>().To<WindowsProfileViewModel>().InSingletonScope();
|
||||
|
||||
// Games
|
||||
Bind<GameViewModel>().To<CounterStrikeViewModel>().InSingletonScope();
|
||||
Bind<GameViewModel>().To<Dota2ViewModel>().InSingletonScope();
|
||||
Bind<GameViewModel>().To<RocketLeagueViewModel>().InSingletonScope();
|
||||
Bind<GameViewModel>().To<TheDivisionViewModel>().InSingletonScope();
|
||||
Bind<GameViewModel>().To<Witcher3ViewModel>().InSingletonScope();
|
||||
Bind<GameViewModel>().To<OverwatchViewModel>().InSingletonScope();
|
||||
Bind<GameViewModel>().To<UnrealTournamentViewModel>().InSingletonScope();
|
||||
|
||||
// Overlays
|
||||
Bind<OverlayViewModel>().To<VolumeDisplayViewModel>().InSingletonScope();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Devices
|
||||
|
||||
// Keyboards
|
||||
Bind<DeviceProvider>().To<CorsairKeyboards>().InSingletonScope();
|
||||
Bind<DeviceProvider>().To<G910>().InSingletonScope();
|
||||
Bind<DeviceProvider>().To<G810>().InSingletonScope();
|
||||
Bind<DeviceProvider>().To<BlackWidow>().InSingletonScope();
|
||||
// Mice
|
||||
Bind<DeviceProvider>().To<CorsairMice>().InSingletonScope();
|
||||
// Headsets
|
||||
Bind<DeviceProvider>().To<CorsairHeadsets>().InSingletonScope();
|
||||
// Other
|
||||
Bind<DeviceProvider>().To<LogitechGeneric>().InSingletonScope();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Layers
|
||||
|
||||
// Animations
|
||||
Bind<ILayerAnimation>().To<NoneAnimation>();
|
||||
Bind<ILayerAnimation>().To<GrowAnimation>();
|
||||
Bind<ILayerAnimation>().To<PulseAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideDownAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideLeftAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideRightAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideUpAnimation>();
|
||||
|
||||
// Conditions
|
||||
Bind<ILayerCondition>().To<DataModelCondition>();
|
||||
Bind<ILayerCondition>().To<EventCondition>();
|
||||
|
||||
// Types
|
||||
Bind<ILayerType>().To<FolderType>();
|
||||
Bind<ILayerType>().To<HeadsetType>();
|
||||
Bind<ILayerType>().To<KeyboardType>();
|
||||
Bind<ILayerType>().To<KeyboardGifType>();
|
||||
Bind<ILayerType>().To<MouseType>();
|
||||
Bind<ILayerType>().To<GenericType>();
|
||||
Bind<ILayerType>().To<KeyPressType>();
|
||||
Bind<ILayerType>().To<AudioType>();
|
||||
|
||||
// Bind some Layer Types to self as well in order to allow JSON.NET injection
|
||||
Bind<KeyPressType>().ToSelf();
|
||||
Bind<AudioType>().ToSelf();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Artemis/Artemis/InjectionModules/DeviceModules.cs
Normal file
29
Artemis/Artemis/InjectionModules/DeviceModules.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Artemis.DeviceProviders;
|
||||
using Artemis.DeviceProviders.Corsair;
|
||||
using Artemis.DeviceProviders.Logitech;
|
||||
using Artemis.DeviceProviders.Razer;
|
||||
using Ninject.Modules;
|
||||
|
||||
namespace Artemis.InjectionModules
|
||||
{
|
||||
public class DeviceModules : NinjectModule
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
// Keyboards
|
||||
Bind<DeviceProvider>().To<CorsairKeyboards>().InSingletonScope();
|
||||
Bind<DeviceProvider>().To<G910>().InSingletonScope();
|
||||
Bind<DeviceProvider>().To<G810>().InSingletonScope();
|
||||
Bind<DeviceProvider>().To<BlackWidow>().InSingletonScope();
|
||||
|
||||
// Mice
|
||||
Bind<DeviceProvider>().To<CorsairMice>().InSingletonScope();
|
||||
|
||||
// Headsets
|
||||
Bind<DeviceProvider>().To<CorsairHeadsets>().InSingletonScope();
|
||||
|
||||
// Other
|
||||
Bind<DeviceProvider>().To<LogitechGeneric>().InSingletonScope();
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Artemis/Artemis/InjectionModules/EffectModules.cs
Normal file
70
Artemis/Artemis/InjectionModules/EffectModules.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Ninject.Extensions.Conventions;
|
||||
using Ninject.Modules;
|
||||
|
||||
namespace Artemis.InjectionModules
|
||||
{
|
||||
public class EffectModules : NinjectModule
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
// Effects
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<EffectModel>()
|
||||
.BindBase()
|
||||
.Configure(b => b.InSingletonScope());
|
||||
});
|
||||
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<EffectViewModel>()
|
||||
.BindBase()
|
||||
.Configure(b => b.InSingletonScope());
|
||||
});
|
||||
|
||||
// Games
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<GameModel>()
|
||||
.BindBase()
|
||||
.Configure(b => b.InSingletonScope());
|
||||
});
|
||||
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<GameViewModel>()
|
||||
.BindBase()
|
||||
.Configure(b => b.InSingletonScope());
|
||||
});
|
||||
|
||||
// Overlays
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<OverlayModel>()
|
||||
.BindBase()
|
||||
.Configure(b => b.InSingletonScope());
|
||||
});
|
||||
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromThisAssembly()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<OverlayViewModel>()
|
||||
.BindBase()
|
||||
.Configure(b => b.InSingletonScope());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Artemis/Artemis/InjectionModules/ProfileModules.cs
Normal file
48
Artemis/Artemis/InjectionModules/ProfileModules.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Artemis.Profiles.Layers.Animations;
|
||||
using Artemis.Profiles.Layers.Conditions;
|
||||
using Artemis.Profiles.Layers.Interfaces;
|
||||
using Artemis.Profiles.Layers.Types.Audio;
|
||||
using Artemis.Profiles.Layers.Types.Folder;
|
||||
using Artemis.Profiles.Layers.Types.Generic;
|
||||
using Artemis.Profiles.Layers.Types.Headset;
|
||||
using Artemis.Profiles.Layers.Types.Keyboard;
|
||||
using Artemis.Profiles.Layers.Types.KeyboardGif;
|
||||
using Artemis.Profiles.Layers.Types.KeyPress;
|
||||
using Artemis.Profiles.Layers.Types.Mouse;
|
||||
using Ninject.Modules;
|
||||
|
||||
namespace Artemis.InjectionModules
|
||||
{
|
||||
public class ProfileModules : NinjectModule
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
// Animations
|
||||
Bind<ILayerAnimation>().To<NoneAnimation>();
|
||||
Bind<ILayerAnimation>().To<GrowAnimation>();
|
||||
Bind<ILayerAnimation>().To<PulseAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideDownAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideLeftAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideRightAnimation>();
|
||||
Bind<ILayerAnimation>().To<SlideUpAnimation>();
|
||||
|
||||
// Conditions
|
||||
Bind<ILayerCondition>().To<DataModelCondition>();
|
||||
Bind<ILayerCondition>().To<EventCondition>();
|
||||
|
||||
// Types
|
||||
Bind<ILayerType>().To<FolderType>();
|
||||
Bind<ILayerType>().To<HeadsetType>();
|
||||
Bind<ILayerType>().To<KeyboardType>();
|
||||
Bind<ILayerType>().To<KeyboardGifType>();
|
||||
Bind<ILayerType>().To<MouseType>();
|
||||
Bind<ILayerType>().To<GenericType>();
|
||||
Bind<ILayerType>().To<KeyPressType>();
|
||||
Bind<ILayerType>().To<AudioType>();
|
||||
|
||||
// Bind some Layer Types to self as well in order to allow JSON.NET injection
|
||||
Bind<KeyPressType>().ToSelf();
|
||||
Bind<AudioType>().ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,13 +18,12 @@ namespace Artemis.Managers
|
||||
/// </summary>
|
||||
public class DeviceManager
|
||||
{
|
||||
private readonly IEventAggregator _events;
|
||||
private readonly ILogger _logger;
|
||||
public event EventHandler<KeyboardChangedEventArgs> OnKeyboardChangedEvent;
|
||||
|
||||
public DeviceManager(IEventAggregator events, ILogger logger, List<DeviceProvider> deviceProviders)
|
||||
public DeviceManager(ILogger logger, List<DeviceProvider> deviceProviders)
|
||||
{
|
||||
_logger = logger;
|
||||
_events = events;
|
||||
|
||||
KeyboardProviders = deviceProviders.Where(d => d.Type == DeviceType.Keyboard)
|
||||
.Cast<KeyboardProvider>().ToList();
|
||||
@ -119,7 +118,7 @@ namespace Artemis.Managers
|
||||
General.Default.LastKeyboard = ActiveKeyboard.Name;
|
||||
General.Default.Save();
|
||||
|
||||
await _events.PublishOnUIThreadAsync(new ActiveKeyboardChanged(oldKeyboard, ActiveKeyboard));
|
||||
RaiseKeyboardChangedEvent(new KeyboardChangedEventArgs(oldKeyboard, ActiveKeyboard));
|
||||
_logger.Debug("Enabled keyboard: {0}", keyboardProvider.Name);
|
||||
|
||||
if (dialog != null)
|
||||
@ -162,9 +161,17 @@ namespace Artemis.Managers
|
||||
General.Default.Save();
|
||||
}
|
||||
|
||||
_events.PublishOnUIThread(new ActiveKeyboardChanged(oldKeyboard, null));
|
||||
RaiseKeyboardChangedEvent(new KeyboardChangedEventArgs(oldKeyboard, null));
|
||||
_logger.Debug("Released keyboard: {0}", releaseName);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void RaiseKeyboardChangedEvent(KeyboardChangedEventArgs e)
|
||||
{
|
||||
// I do this in all to avoid a possible race condition
|
||||
// https://msdn.microsoft.com/en-us/library/w369ty8x.aspx
|
||||
var handler = OnKeyboardChangedEvent;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,6 @@ using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.Settings;
|
||||
using Caliburn.Micro;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Managers
|
||||
@ -16,18 +15,18 @@ namespace Artemis.Managers
|
||||
public class EffectManager
|
||||
{
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly IEventAggregator _events;
|
||||
private readonly ILogger _logger;
|
||||
private EffectModel _activeEffect;
|
||||
private LoopManager _waitLoopManager;
|
||||
private EffectModel _waitEffect;
|
||||
|
||||
public EffectManager(ILogger logger, IEventAggregator events, DeviceManager deviceManager)
|
||||
public EffectManager(ILogger logger, DeviceManager deviceManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_events = events;
|
||||
_deviceManager = deviceManager;
|
||||
|
||||
EffectModels = new List<EffectModel>();
|
||||
|
||||
_logger = logger;
|
||||
_deviceManager = deviceManager;
|
||||
|
||||
_logger.Info("Intialized EffectManager");
|
||||
}
|
||||
|
||||
@ -44,7 +43,7 @@ namespace Artemis.Managers
|
||||
private set
|
||||
{
|
||||
_activeEffect = value;
|
||||
_events.PublishOnUIThread(new ActiveEffectChanged(value?.Name));
|
||||
RaiseEffectChangedEvent(new EffectChangedEventArgs(value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +63,8 @@ namespace Artemis.Managers
|
||||
get { return EffectModels.OfType<GameModel>().Where(g => g.Enabled); }
|
||||
}
|
||||
|
||||
public event EventHandler<EffectChangedEventArgs> OnEffectChangedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the last active effect from settings and enables it.
|
||||
/// </summary>
|
||||
@ -83,17 +84,24 @@ namespace Artemis.Managers
|
||||
/// <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)
|
||||
_deviceManager.EnableLastKeyboard();
|
||||
// If still null, no last keyboard, so stop.
|
||||
if (_deviceManager.ActiveKeyboard == null)
|
||||
{
|
||||
_logger.Debug("Cancelling effect change, no LastKeyboard");
|
||||
_logger.Debug("Stopping effect change until keyboard is enabled");
|
||||
_waitEffect = effectModel;
|
||||
_waitLoopManager = loopManager;
|
||||
_deviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
||||
_deviceManager.EnableLastKeyboard();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -145,6 +153,19 @@ namespace Artemis.Managers
|
||||
General.Default.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
|
||||
@ -192,5 +213,11 @@ namespace Artemis.Managers
|
||||
|
||||
DisableGame(ActiveEffect);
|
||||
}
|
||||
|
||||
protected virtual void RaiseEffectChangedEvent(EffectChangedEventArgs e)
|
||||
{
|
||||
var handler = OnEffectChangedEvent;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -21,10 +21,8 @@ namespace Artemis.Managers
|
||||
private readonly ILogger _logger;
|
||||
private readonly Timer _loopTimer;
|
||||
|
||||
public LoopManager(IEventAggregator events, ILogger logger, EffectManager effectManager,
|
||||
DeviceManager deviceManager)
|
||||
public LoopManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager)
|
||||
{
|
||||
events.Subscribe(this);
|
||||
_logger = logger;
|
||||
_effectManager = effectManager;
|
||||
_deviceManager = deviceManager;
|
||||
|
||||
@ -6,15 +6,12 @@ using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Artemis.Events;
|
||||
using Artemis.Models;
|
||||
using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Artemis.Utilities.GameState;
|
||||
using Artemis.ViewModels;
|
||||
using Caliburn.Micro;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.Logging;
|
||||
using Squirrel;
|
||||
|
||||
namespace Artemis.Managers
|
||||
{
|
||||
@ -23,16 +20,11 @@ namespace Artemis.Managers
|
||||
/// </summary>
|
||||
public class MainManager : IDisposable
|
||||
{
|
||||
public delegate void PauseCallbackHandler();
|
||||
|
||||
private readonly IEventAggregator _events;
|
||||
private readonly Timer _processTimer;
|
||||
|
||||
public MainManager(IEventAggregator events, ILogger logger, LoopManager loopManager, DeviceManager deviceManager,
|
||||
public MainManager(ILogger logger, LoopManager loopManager, DeviceManager deviceManager,
|
||||
EffectManager effectManager, ProfileManager profileManager, PipeServer pipeServer)
|
||||
{
|
||||
_events = events;
|
||||
|
||||
Logger = logger;
|
||||
LoopManager = loopManager;
|
||||
DeviceManager = deviceManager;
|
||||
@ -88,6 +80,8 @@ namespace Artemis.Managers
|
||||
PipeServer?.Stop();
|
||||
}
|
||||
|
||||
public event EventHandler<EnabledChangedEventArgs> OnEnabledChangedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the last active effect and starts the program
|
||||
/// </summary>
|
||||
@ -96,7 +90,7 @@ namespace Artemis.Managers
|
||||
Logger.Debug("Enabling program");
|
||||
ProgramEnabled = true;
|
||||
LoopManager.StartAsync();
|
||||
_events.PublishOnUIThread(new ToggleEnabled(ProgramEnabled));
|
||||
RaiseEnabledChangedEvent(new EnabledChangedEventArgs(ProgramEnabled));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -107,7 +101,7 @@ namespace Artemis.Managers
|
||||
Logger.Debug("Disabling program");
|
||||
LoopManager.Stop();
|
||||
ProgramEnabled = false;
|
||||
_events.PublishOnUIThread(new ToggleEnabled(ProgramEnabled));
|
||||
RaiseEnabledChangedEvent(new EnabledChangedEventArgs(ProgramEnabled));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -148,5 +142,11 @@ namespace Artemis.Managers
|
||||
Logger.Info("Detected and enabling game: {0}", newGame.Name);
|
||||
EffectManager.ChangeEffect(newGame, LoopManager);
|
||||
}
|
||||
|
||||
protected virtual void RaiseEnabledChangedEvent(EnabledChangedEventArgs e)
|
||||
{
|
||||
var handler = OnEnabledChangedEvent;
|
||||
handler?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,14 +18,18 @@ namespace Artemis.Models
|
||||
|
||||
protected DateTime LastTrace;
|
||||
|
||||
protected EffectModel(MainManager mainManager, IDataModel dataModel)
|
||||
protected EffectModel(MainManager mainManager, EffectSettings settings, IDataModel dataModel)
|
||||
{
|
||||
MainManager = mainManager;
|
||||
Settings = settings;
|
||||
DataModel = dataModel;
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(this);
|
||||
}
|
||||
|
||||
public bool Initialized { get; set; }
|
||||
public MainManager MainManager { get; set; }
|
||||
public EffectSettings Settings { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int KeyboardScale { get; set; } = 4;
|
||||
|
||||
|
||||
@ -5,13 +5,13 @@ namespace Artemis.Models
|
||||
{
|
||||
public abstract class GameModel : EffectModel
|
||||
{
|
||||
protected GameModel(MainManager mainManager, GameSettings settings, IDataModel dataModel)
|
||||
: base(mainManager, dataModel)
|
||||
protected GameModel(MainManager mainManager, GameSettings settings, IDataModel dataModel): base(mainManager, settings, dataModel)
|
||||
{
|
||||
// Override settings to the GameSettings type
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
public GameSettings Settings { get; set; }
|
||||
public new GameSettings Settings { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string ProcessName { get; set; }
|
||||
}
|
||||
|
||||
@ -7,8 +7,10 @@ namespace Artemis.Models
|
||||
private bool _enabled;
|
||||
public string ProcessName;
|
||||
|
||||
protected OverlayModel(MainManager mainManager) : base(mainManager, null)
|
||||
protected OverlayModel(MainManager mainManager, OverlaySettings settings) : base(mainManager, settings, null)
|
||||
{
|
||||
Settings = settings;
|
||||
Enabled = settings.Enabled;
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
@ -27,6 +29,7 @@ namespace Artemis.Models
|
||||
}
|
||||
}
|
||||
|
||||
public new OverlaySettings Settings { get; set; }
|
||||
public abstract void RenderOverlay(RenderFrame frame, bool keyboardOnly);
|
||||
}
|
||||
}
|
||||
@ -23,18 +23,18 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
private int _sensitivity;
|
||||
private IWaveIn _waveIn;
|
||||
|
||||
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager, null)
|
||||
public AudioVisualizerModel(MainManager mainManager) : base(mainManager, new AudioVisualizerSettings(), null)
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "Audiovisualizer";
|
||||
DeviceIds = new List<string>();
|
||||
SpectrumData = new List<byte>();
|
||||
Initialized = false;
|
||||
Settings = (AudioVisualizerSettings) base.Settings;
|
||||
}
|
||||
|
||||
public int Lines { get; set; }
|
||||
|
||||
public AudioVisualizerSettings Settings { get; set; }
|
||||
public new AudioVisualizerSettings Settings { get; set; }
|
||||
public List<byte> SpectrumData { get; set; }
|
||||
public List<KeyboardRectangle> SoundRectangles { get; set; }
|
||||
|
||||
@ -126,7 +126,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
if (keyboardHeight > SoundRectangles[i].Height)
|
||||
SoundRectangles[i].Height = keyboardHeight;
|
||||
else
|
||||
SoundRectangles[i].Height = SoundRectangles[i].Height - Settings.FadeSpeed;
|
||||
SoundRectangles[i].Height = SoundRectangles[i].Height -
|
||||
Settings.FadeSpeed;
|
||||
// Apply Bars setting
|
||||
SoundRectangles[i].X = i*KeyboardScale;
|
||||
SoundRectangles[i].Width = KeyboardScale;
|
||||
|
||||
@ -1,25 +1,13 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||
{
|
||||
public sealed class AudioVisualizerViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
public sealed class AudioVisualizerViewModel : EffectViewModel
|
||||
{
|
||||
public AudioVisualizerViewModel(MainManager main, IEventAggregator events)
|
||||
: base(main, new AudioVisualizerModel(main, new AudioVisualizerSettings()))
|
||||
public AudioVisualizerViewModel(MainManager main, AudioVisualizerModel model) : base(main, model)
|
||||
{
|
||||
DisplayName = "Audio Visualization";
|
||||
events.Subscribe(this);
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||
EffectSettings = ((AudioVisualizerModel) EffectModel).Settings;
|
||||
}
|
||||
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,12 +14,11 @@ namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public BubblesModel(MainManager mainManager, BubblesSettings settings)
|
||||
: base(mainManager, null)
|
||||
public BubblesModel(MainManager mainManager) : base(mainManager, new BubblesSettings(), null)
|
||||
{
|
||||
Name = "Bubbles";
|
||||
Settings = settings;
|
||||
Initialized = false;
|
||||
Settings = (BubblesSettings) base.Settings;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -30,7 +29,7 @@ namespace Artemis.Modules.Effects.Bubbles
|
||||
|
||||
private readonly List<Bubble> _bubbles = new List<Bubble>();
|
||||
|
||||
public BubblesSettings Settings { get; }
|
||||
public new BubblesSettings Settings { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -1,25 +1,13 @@
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Effects.Bubbles
|
||||
{
|
||||
public class BubblesViewModel : EffectViewModel, IHandle<ActiveEffectChanged>
|
||||
public sealed class BubblesViewModel : EffectViewModel
|
||||
{
|
||||
public BubblesViewModel(MainManager main, IEventAggregator events)
|
||||
: base(main, new BubblesModel(main, new BubblesSettings()))
|
||||
public BubblesViewModel(MainManager main, BubblesModel model) : base(main, model)
|
||||
{
|
||||
DisplayName = "Bubbles";
|
||||
events.Subscribe(this);
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||
EffectSettings = ((BubblesModel) EffectModel).Settings;
|
||||
}
|
||||
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ namespace Artemis.Modules.Effects.ProfilePreview
|
||||
{
|
||||
public class ProfilePreviewModel : EffectModel
|
||||
{
|
||||
public ProfilePreviewModel(MainManager mainManager) : base(mainManager, new ProfilePreviewDataModel())
|
||||
public ProfilePreviewModel(MainManager mainManager) : base(mainManager, null, new ProfilePreviewDataModel())
|
||||
{
|
||||
Name = "Profile Preview";
|
||||
}
|
||||
|
||||
@ -69,16 +69,13 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
private SpotifyLocalAPI _spotify;
|
||||
private bool _spotifySetupBusy;
|
||||
|
||||
public WindowsProfileModel(ILogger logger, MainManager mainManager, WindowsProfileSettings settings)
|
||||
: base(mainManager, new WindowsProfileDataModel())
|
||||
public WindowsProfileModel(ILogger logger, MainManager mainManager)
|
||||
: base(mainManager, new WindowsProfileSettings(), new WindowsProfileDataModel())
|
||||
{
|
||||
_logger = logger;
|
||||
Name = "WindowsProfile";
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
public WindowsProfileSettings Settings { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
@ -1,31 +1,25 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.Events;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Caliburn.Micro;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
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, IHandle<ActiveEffectChanged>
|
||||
public sealed class WindowsProfileViewModel : EffectViewModel
|
||||
{
|
||||
public WindowsProfileViewModel(ILogger logger, MainManager main, IEventAggregator events,
|
||||
IProfileEditorVmFactory pFactory, ProfilePreviewModel profilePreviewModel)
|
||||
: base(main, new WindowsProfileModel(logger, main, new WindowsProfileSettings()))
|
||||
public WindowsProfileViewModel(MainManager main, IProfileEditorVmFactory pFactory,
|
||||
ProfilePreviewModel profilePreviewModel, WindowsProfileModel model) : base(main, model)
|
||||
{
|
||||
DisplayName = "Windows Profile";
|
||||
PFactory = pFactory;
|
||||
ProfilePreviewModel = profilePreviewModel;
|
||||
EffectSettings = ((WindowsProfileModel) EffectModel).Settings;
|
||||
ProfileEditor = PFactory.CreateProfileEditorVm(events, main, (WindowsProfileModel) EffectModel,
|
||||
ProfileEditor = PFactory.CreateProfileEditorVm(main, (WindowsProfileModel) EffectModel,
|
||||
((WindowsProfileSettings) EffectSettings).LastProfile);
|
||||
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
|
||||
|
||||
events.Subscribe(this);
|
||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||
MainManager.EffectManager.EffectModels.Add(EffectModel);
|
||||
}
|
||||
@ -35,11 +29,6 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
||||
public IProfileEditorVmFactory PFactory { get; set; }
|
||||
public ProfilePreviewModel ProfilePreviewModel { get; set; }
|
||||
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
|
||||
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != "SelectedProfile" && IsActive)
|
||||
|
||||
@ -11,8 +11,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public class CounterStrikeModel : GameModel
|
||||
{
|
||||
public CounterStrikeModel(MainManager mainManager, CounterStrikeSettings settings)
|
||||
: base(mainManager, settings, new CounterStrikeDataModel())
|
||||
public CounterStrikeModel(MainManager mainManager): base(mainManager, new CounterStrikeSettings(), new CounterStrikeDataModel())
|
||||
{
|
||||
Name = "CounterStrike";
|
||||
ProcessName = "csgo";
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="CS:GO Directory" />
|
||||
<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}"
|
||||
|
||||
@ -5,17 +5,15 @@ using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
public sealed class CounterStrikeViewModel : GameViewModel
|
||||
{
|
||||
public CounterStrikeViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new CounterStrikeModel(main, new CounterStrikeSettings()), events, pFactory)
|
||||
public CounterStrikeViewModel(MainManager main, IProfileEditorVmFactory pFactory, CounterStrikeModel model)
|
||||
: base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "CS:GO";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
FindGameDir();
|
||||
PlaceConfigFile();
|
||||
|
||||
@ -7,21 +7,18 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
internal class Dota2Model : GameModel
|
||||
public class Dota2Model : GameModel
|
||||
{
|
||||
public Dota2Model(MainManager mainManager, Dota2Settings settings)
|
||||
: base(mainManager, settings, new Dota2DataModel())
|
||||
public Dota2Model(MainManager mainManager): base(mainManager, new Dota2Settings(), new Dota2DataModel())
|
||||
{
|
||||
Name = "Dota2";
|
||||
ProcessName = "dota2";
|
||||
Settings = settings;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
Scale = 4;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
public new Dota2Settings Settings { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Dota 2 Directory" />
|
||||
<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}"
|
||||
|
||||
@ -5,17 +5,14 @@ using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.Dota2
|
||||
{
|
||||
public sealed class Dota2ViewModel : GameViewModel
|
||||
{
|
||||
public Dota2ViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new Dota2Model(main, new Dota2Settings()), events, pFactory)
|
||||
public Dota2ViewModel(MainManager main, IProfileEditorVmFactory pFactory, Dota2Model model) : base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "Dota 2";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
FindGameDir();
|
||||
PlaceConfigFile();
|
||||
|
||||
62
Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.Designer.cs
generated
Normal file
62
Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.Designer.cs
generated
Normal file
@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2 {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class EurotruckSimulator2 : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static EurotruckSimulator2 defaultInstance = ((EurotruckSimulator2)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new EurotruckSimulator2())));
|
||||
|
||||
public static EurotruckSimulator2 Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool Enabled {
|
||||
get {
|
||||
return ((bool)(this["Enabled"]));
|
||||
}
|
||||
set {
|
||||
this["Enabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Default")]
|
||||
public string LastProfile {
|
||||
get {
|
||||
return ((string)(this["LastProfile"]));
|
||||
}
|
||||
set {
|
||||
this["LastProfile"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string GameDirectory {
|
||||
get {
|
||||
return ((string)(this["GameDirectory"]));
|
||||
}
|
||||
set {
|
||||
this["GameDirectory"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.EurotruckSimulator2" GeneratedClassName="EurotruckSimulator2">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastProfile" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Default</Value>
|
||||
</Setting>
|
||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -0,0 +1,18 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
using Ets2SdkClient;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public class EurotruckSimulator2DataModel : IDataModel
|
||||
{
|
||||
public Ets2Telemetry._Axilliary Axilliary { get; set; }
|
||||
public Ets2Telemetry._Controls Controls { get; set; }
|
||||
public Ets2Telemetry._Damage Damage { get; set; }
|
||||
public Ets2Telemetry._Drivetrain Drivetrain { get; set; }
|
||||
public Ets2Telemetry._Job Job { get; set; }
|
||||
public Ets2Telemetry._Lights Lights { get; set; }
|
||||
public string Manufacturer { get; set; }
|
||||
public string ManufacturerId { get; set; }
|
||||
public Ets2Telemetry._Physics Physics { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Ets2SdkClient;
|
||||
using Ninject.Extensions.Logging;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public class EurotruckSimulator2Model : GameModel
|
||||
{
|
||||
public EurotruckSimulator2Model(MainManager mainManager)
|
||||
: base(mainManager, new EurotruckSimulator2Settings(), new EurotruckSimulator2DataModel())
|
||||
{
|
||||
Name = "EurotruckSimulator2";
|
||||
ProcessName = "eurotrucks2";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public int Scale { get; set; }
|
||||
|
||||
public Ets2SdkTelemetry Telemetry { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
|
||||
Telemetry.Data -= TelemetryOnData;
|
||||
Telemetry = null;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Telemetry = new Ets2SdkTelemetry();
|
||||
Telemetry.Data += TelemetryOnData;
|
||||
if (Telemetry.Error != null)
|
||||
MainManager.Logger.Error(Telemetry.Error, "Exception in the Eurotruck SDK");
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
private void TelemetryOnData(Ets2Telemetry data, bool newTimestamp)
|
||||
{
|
||||
((EurotruckSimulator2DataModel) DataModel).Axilliary = data.Axilliary;
|
||||
((EurotruckSimulator2DataModel) DataModel).Controls = data.Controls;
|
||||
((EurotruckSimulator2DataModel) DataModel).Damage = data.Damage;
|
||||
((EurotruckSimulator2DataModel) DataModel).Drivetrain = data.Drivetrain;
|
||||
((EurotruckSimulator2DataModel) DataModel).Job = data.Job;
|
||||
((EurotruckSimulator2DataModel) DataModel).Lights = data.Lights;
|
||||
((EurotruckSimulator2DataModel) DataModel).Manufacturer = data.Manufacturer;
|
||||
((EurotruckSimulator2DataModel) DataModel).ManufacturerId = data.ManufacturerId;
|
||||
((EurotruckSimulator2DataModel) DataModel).Physics = data.Physics;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Updating is handled in the TelemetryOnData event
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
using Artemis.Models;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public class EurotruckSimulator2Settings : GameSettings
|
||||
{
|
||||
public EurotruckSimulator2Settings()
|
||||
{
|
||||
Load();
|
||||
}
|
||||
|
||||
public string GameDirectory { get; set; }
|
||||
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = EurotruckSimulator2.Default.Enabled;
|
||||
LastProfile = EurotruckSimulator2.Default.LastProfile;
|
||||
GameDirectory = EurotruckSimulator2.Default.GameDirectory;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
EurotruckSimulator2.Default.Enabled = Enabled;
|
||||
EurotruckSimulator2.Default.GameDirectory = GameDirectory;
|
||||
|
||||
EurotruckSimulator2.Default.Save();
|
||||
}
|
||||
|
||||
public sealed override void ToDefault()
|
||||
{
|
||||
Enabled = true;
|
||||
GameDirectory = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<UserControl x:Class="Artemis.Modules.Games.EurotruckSimulator2.EurotruckSimulator2View"
|
||||
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:cal="http://www.caliburnproject.org"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="476.986" d:DesignWidth="538.772">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<Grid Margin="15,5,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default shows indicator lights, speed and engine RPM on the keyboard" />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
|
||||
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
|
||||
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Eurotruck Simulator 2 directory" />
|
||||
<Grid>
|
||||
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
|
||||
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
|
||||
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
|
||||
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
|
||||
HorizontalAlignment="Right" Width="25"
|
||||
Style="{DynamicResource SquareButtonStyle}" Height="26" Margin="0,-2,0,0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Profile editor -->
|
||||
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
Margin="10,0,0,0"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CounterStrikeView.xaml
|
||||
/// </summary>
|
||||
public partial class EurotruckSimulator2View : UserControl
|
||||
{
|
||||
public EurotruckSimulator2View()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
|
||||
namespace Artemis.Modules.Games.EurotruckSimulator2
|
||||
{
|
||||
public sealed class EurotruckSimulator2ViewModel : GameViewModel
|
||||
{
|
||||
public EurotruckSimulator2ViewModel(MainManager main, IProfileEditorVmFactory pFactory, EurotruckSimulator2Model model): base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "ETS 2";
|
||||
|
||||
FindGameDir();
|
||||
PlacePlugin();
|
||||
}
|
||||
|
||||
public void FindGameDir()
|
||||
{
|
||||
var gameSettings = (EurotruckSimulator2Settings) GameSettings;
|
||||
// If already propertly set up, don't do anything
|
||||
//if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
|
||||
// File.Exists(gameSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg"))
|
||||
// return;
|
||||
|
||||
// Demo is also supported but resides in a different directory
|
||||
var dir = GeneralHelpers.FindSteamGame(@"\Euro Truck Simulator 2\bin\win_x86\eurotrucks2.exe") ??
|
||||
GeneralHelpers.FindSteamGame(@"\Euro Truck Simulator 2 Demo\bin\win_x86\eurotrucks2.exe");
|
||||
|
||||
gameSettings.GameDirectory = dir ?? string.Empty;
|
||||
gameSettings.Save();
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog
|
||||
{
|
||||
SelectedPath = ((EurotruckSimulator2Settings) GameSettings).GameDirectory
|
||||
};
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((EurotruckSimulator2Settings) GameSettings).GameDirectory = Path.GetDirectoryName(dialog.SelectedPath);
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
|
||||
GameSettings.Save();
|
||||
PlacePlugin();
|
||||
}
|
||||
|
||||
public void PlacePlugin()
|
||||
{
|
||||
if (((EurotruckSimulator2Settings) GameSettings).GameDirectory == string.Empty)
|
||||
return;
|
||||
|
||||
var path = ((EurotruckSimulator2Settings) GameSettings).GameDirectory;
|
||||
//if (Directory.Exists(path + "/csgo/cfg"))
|
||||
//{
|
||||
// var cfgFile = Resources.csgoGamestateConfiguration.Replace("{{port}}",
|
||||
// MainManager.GameStateWebServer.Port.ToString());
|
||||
// File.WriteAllText(path + "/csgo/cfg/gamestate_integration_artemis.cfg", cfgFile);
|
||||
|
||||
// return;
|
||||
//}
|
||||
|
||||
//DialogService.ShowErrorMessageBox("Please select a valid CS:GO directory\n\n" +
|
||||
// @"By default CS:GO is in \SteamApps\common\Counter-Strike Global Offensive");
|
||||
|
||||
//((EurotruckSimulator2Settings) GameSettings).GameDirectory = string.Empty;
|
||||
//NotifyOfPropertyChange(() => GameSettings);
|
||||
//GameSettings.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,19 +2,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Models.Interfaces;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Utilities;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
public class OverwatchModel : GameModel
|
||||
{
|
||||
private readonly IEventAggregator _events;
|
||||
private DateTime _characterChange;
|
||||
private string _lastMessage;
|
||||
// Using sticky values on these since they can cause flickering
|
||||
@ -24,10 +21,8 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
private DateTime _ultimateReady;
|
||||
private DateTime _ultimateUsed;
|
||||
|
||||
public OverwatchModel(IEventAggregator events, MainManager mainManager, OverwatchSettings settings)
|
||||
: base(mainManager, settings, new OverwatchDataModel())
|
||||
public OverwatchModel(MainManager mainManager): base(mainManager, new OverwatchSettings(), new OverwatchDataModel())
|
||||
{
|
||||
_events = events;
|
||||
Name = "Overwatch";
|
||||
ProcessName = "Overwatch";
|
||||
Scale = 4;
|
||||
@ -126,7 +121,8 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
if (colors == null)
|
||||
return;
|
||||
|
||||
_events.PublishOnUIThread(new RazerColorArrayChanged(colors));
|
||||
// TODO: Get the debug viewmodel and update the color array
|
||||
//_events.PublishOnUIThread(new RazerColorArrayChanged(colors));
|
||||
|
||||
// Determine general game state
|
||||
ParseGameSate(gameDataModel, colors);
|
||||
|
||||
@ -4,18 +4,16 @@ using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Utilities.DataReaders;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
public sealed class OverwatchViewModel : GameViewModel
|
||||
{
|
||||
public OverwatchViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new OverwatchModel(events, main, new OverwatchSettings()), events, pFactory)
|
||||
public OverwatchViewModel(MainManager main, IProfileEditorVmFactory pFactory, OverwatchModel model)
|
||||
: base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "Overwatch";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
FindOverwatch();
|
||||
}
|
||||
|
||||
@ -15,8 +15,8 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
private Memory _memory;
|
||||
private GamePointersCollection _pointer;
|
||||
|
||||
public RocketLeagueModel(MainManager mainManager, RocketLeagueSettings settings)
|
||||
: base(mainManager, settings, new RocketLeagueDataModel())
|
||||
public RocketLeagueModel(MainManager mainManager)
|
||||
: base(mainManager, new RocketLeagueSettings(), new RocketLeagueDataModel())
|
||||
{
|
||||
Name = "RocketLeague";
|
||||
ProcessName = "RocketLeague";
|
||||
|
||||
@ -4,7 +4,6 @@ using Artemis.Settings;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.Utilities.Memory;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.Modules.Games.RocketLeague
|
||||
@ -13,12 +12,9 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
{
|
||||
private string _versionText;
|
||||
|
||||
public RocketLeagueViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new RocketLeagueModel(main, new RocketLeagueSettings()), events, pFactory)
|
||||
public RocketLeagueViewModel(MainManager main, IProfileEditorVmFactory pFactory, RocketLeagueModel model) : base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "Rocket League";
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
SetVersionText();
|
||||
}
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
private StickyValue<bool> _stickyAmmo;
|
||||
private StickyValue<bool> _stickyHp;
|
||||
|
||||
public TheDivisionModel(MainManager mainManager, TheDivisionSettings settings)
|
||||
: base(mainManager, settings, new TheDivisionDataModel())
|
||||
public TheDivisionModel(MainManager mainManager)
|
||||
: base(mainManager, new TheDivisionSettings(), new TheDivisionDataModel())
|
||||
{
|
||||
Name = "TheDivision";
|
||||
ProcessName = "TheDivision";
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.TheDivision
|
||||
{
|
||||
public sealed class TheDivisionViewModel : GameViewModel
|
||||
{
|
||||
public TheDivisionViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new TheDivisionModel(main, new TheDivisionSettings()), events, pFactory)
|
||||
public TheDivisionViewModel(MainManager main, IProfileEditorVmFactory pFactory, TheDivisionModel model)
|
||||
: base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "The Division";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,6 @@ using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@ -18,8 +17,8 @@ namespace Artemis.Modules.Games.UnrealTournament
|
||||
{
|
||||
public sealed class UnrealTournamentViewModel : GameViewModel
|
||||
{
|
||||
public UnrealTournamentViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new UnrealTournamentModel(main, new UnrealTournamentSettings()), events, pFactory)
|
||||
public UnrealTournamentViewModel(MainManager main, IProfileEditorVmFactory pFactory, UnrealTournamentModel model)
|
||||
: base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "Unreal Tournament";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
@ -16,8 +16,8 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
private readonly Stopwatch _updateSw;
|
||||
private string _witcherSettings;
|
||||
|
||||
public Witcher3Model(MainManager mainManager, Witcher3Settings settings)
|
||||
: base(mainManager, settings, new Witcher3DataModel())
|
||||
public Witcher3Model(MainManager mainManager)
|
||||
: base(mainManager, new Witcher3Settings(), new Witcher3DataModel())
|
||||
{
|
||||
Name = "Witcher3";
|
||||
ProcessName = "witcher3";
|
||||
|
||||
@ -9,17 +9,15 @@ using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public sealed class Witcher3ViewModel : GameViewModel
|
||||
{
|
||||
public Witcher3ViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new Witcher3Model(main, new Witcher3Settings()), events, pFactory)
|
||||
public Witcher3ViewModel(MainManager main, IProfileEditorVmFactory pFactory, Witcher3Model model)
|
||||
: base(main, model, pFactory)
|
||||
{
|
||||
DisplayName = "The Witcher 3";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
}
|
||||
|
||||
public async void AutoInstall()
|
||||
@ -80,7 +78,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
|
||||
archive.ExtractToDirectory(folder + @"witcher3-mod", true);
|
||||
|
||||
System.Diagnostics.Process.Start(
|
||||
Process.Start(
|
||||
new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,54 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Profiles.Layers.Models;
|
||||
using Artemis.Utilities.Memory;
|
||||
|
||||
namespace Artemis.Modules.Games.WorldofWarcraft
|
||||
{
|
||||
public class WoWModel : GameModel
|
||||
{
|
||||
private Memory _memory;
|
||||
|
||||
public WoWModel(MainManager mainManager, WoWSettings settings)
|
||||
: base(mainManager, settings, new WoWDataModel())
|
||||
{
|
||||
Name = "WoW";
|
||||
ProcessName = "Wow-64";
|
||||
Scale = 4;
|
||||
Enabled = Settings.Enabled;
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public int Scale { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Initialized = false;
|
||||
}
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
if (tempProcess == null)
|
||||
return;
|
||||
|
||||
_memory = new Memory(tempProcess);
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (Profile == null || DataModel == null || _memory == null)
|
||||
return;
|
||||
|
||||
// _memory.ReadMemory();
|
||||
}
|
||||
|
||||
public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
{
|
||||
return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
//using System.Collections.Generic;
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.Models;
|
||||
//using Artemis.Profiles.Layers.Models;
|
||||
//using Artemis.Utilities.Memory;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.WorldofWarcraft
|
||||
//{
|
||||
// public class WoWModel : GameModel
|
||||
// {
|
||||
// private Memory _memory;
|
||||
//
|
||||
// public WoWModel(MainManager mainManager): base(mainManager, new WoWSettings(), new WoWDataModel())
|
||||
// {
|
||||
// Name = "WoW";
|
||||
// ProcessName = "Wow-64";
|
||||
// Scale = 4;
|
||||
// Enabled = Settings.Enabled;
|
||||
// Initialized = false;
|
||||
// }
|
||||
//
|
||||
// public int Scale { get; set; }
|
||||
//
|
||||
// public override void Dispose()
|
||||
// {
|
||||
// Initialized = false;
|
||||
// }
|
||||
//
|
||||
// public override void Enable()
|
||||
// {
|
||||
// var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
|
||||
// if (tempProcess == null)
|
||||
// return;
|
||||
//
|
||||
// _memory = new Memory(tempProcess);
|
||||
//
|
||||
// Initialized = true;
|
||||
// }
|
||||
//
|
||||
// public override void Update()
|
||||
// {
|
||||
// if (Profile == null || DataModel == null || _memory == null)
|
||||
// return;
|
||||
//
|
||||
//// _memory.ReadMemory();
|
||||
// }
|
||||
//
|
||||
// public override List<LayerModel> GetRenderLayers(bool keyboardOnly)
|
||||
// {
|
||||
// return Profile.GetRenderLayers(DataModel, keyboardOnly);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,17 +1,14 @@
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.Modules.Games.WorldofWarcraft
|
||||
{
|
||||
public sealed class WoWViewModel : GameViewModel
|
||||
{
|
||||
public WoWViewModel(MainManager main, IEventAggregator events, IProfileEditorVmFactory pFactory)
|
||||
: base(main, new WoWModel(main, new WoWSettings()), events, pFactory)
|
||||
{
|
||||
DisplayName = "World of Warcraft";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
//using Artemis.InjectionFactories;
|
||||
//using Artemis.Managers;
|
||||
//using Artemis.ViewModels.Abstract;
|
||||
//
|
||||
//namespace Artemis.Modules.Games.WorldofWarcraft
|
||||
//{
|
||||
// public sealed class WoWViewModel : GameViewModel
|
||||
// {
|
||||
// public WoWViewModel(MainManager main, IProfileEditorVmFactory pFactory, WoWModel model): base(main, model, pFactory)
|
||||
// {
|
||||
// DisplayName = "WoW";
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -12,19 +12,15 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
{
|
||||
public class VolumeDisplayModel : OverlayModel
|
||||
{
|
||||
public VolumeDisplayModel(MainManager mainManager, VolumeDisplaySettings settings) : base(mainManager)
|
||||
public VolumeDisplayModel(MainManager mainManager) : base(mainManager, new VolumeDisplaySettings())
|
||||
{
|
||||
Settings = settings;
|
||||
Name = "VolumeDisplay";
|
||||
Enabled = Settings.Enabled;
|
||||
|
||||
VolumeDisplay = new VolumeBar(MainManager.DeviceManager, settings);
|
||||
VolumeDisplay = new VolumeBar(MainManager.DeviceManager, (VolumeDisplaySettings) Settings);
|
||||
}
|
||||
|
||||
public VolumeBar VolumeDisplay { get; set; }
|
||||
|
||||
public VolumeDisplaySettings Settings { get; set; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
KeyboardHook.KeyDownCallback -= KeyPressTask;
|
||||
|
||||
@ -5,16 +5,9 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||
{
|
||||
public sealed class VolumeDisplayViewModel : OverlayViewModel
|
||||
{
|
||||
public VolumeDisplayViewModel(MainManager mainManager) : base(mainManager)
|
||||
public VolumeDisplayViewModel(MainManager mainManager, VolumeDisplayModel model) : base(mainManager, model)
|
||||
{
|
||||
DisplayName = "Volume Display";
|
||||
|
||||
// Settings are loaded from file by class
|
||||
OverlaySettings = new VolumeDisplaySettings();
|
||||
|
||||
// Create effect model and add it to MainManager
|
||||
OverlayModel = new VolumeDisplayModel(mainManager, (VolumeDisplaySettings) OverlaySettings);
|
||||
MainManager.EffectManager.EffectModels.Add(OverlayModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
/// <summary>
|
||||
/// Percentage source, the number that defines 100%
|
||||
/// </summary>
|
||||
public double PercentageSource { get; set; }
|
||||
public float PercentageSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Percentage source property, the property that defines 100%
|
||||
@ -44,13 +44,13 @@ namespace Artemis.Profiles.Layers.Models
|
||||
ApplyPercentageOfProperty(dataModel, properties);
|
||||
}
|
||||
|
||||
private void ApplyPercentageOf(IDataModel dataModel, LayerPropertiesModel properties, double src)
|
||||
private void ApplyPercentageOf(IDataModel dataModel, LayerPropertiesModel properties, float src)
|
||||
{
|
||||
if (GameProperty == null)
|
||||
return;
|
||||
|
||||
var gameProperty = dataModel.GetPropValue<int>(GameProperty);
|
||||
var percentage = decimal.ToDouble(gameProperty)/src;
|
||||
var gameProperty = dataModel.GetPropValue<float>(GameProperty);
|
||||
var percentage = gameProperty/src;
|
||||
|
||||
if (LayerProperty == "Width")
|
||||
ApplyWidth(properties, percentage);
|
||||
@ -60,9 +60,9 @@ namespace Artemis.Profiles.Layers.Models
|
||||
ApplyOpacity(properties, percentage);
|
||||
}
|
||||
|
||||
private void ApplyWidth(LayerPropertiesModel properties, double percentage)
|
||||
private void ApplyWidth(LayerPropertiesModel properties, float percentage)
|
||||
{
|
||||
var newWidth = percentage*properties.Width;
|
||||
var newWidth = percentage*(float) properties.Width;
|
||||
var difference = properties.Width - newWidth;
|
||||
properties.Width = newWidth;
|
||||
|
||||
@ -71,9 +71,9 @@ namespace Artemis.Profiles.Layers.Models
|
||||
properties.X = properties.X + difference;
|
||||
}
|
||||
|
||||
private void ApplyHeight(LayerPropertiesModel properties, double percentage)
|
||||
private void ApplyHeight(LayerPropertiesModel properties, float percentage)
|
||||
{
|
||||
var newHeight = percentage*properties.Height;
|
||||
var newHeight = percentage*(float) properties.Height;
|
||||
var difference = properties.Height - newHeight;
|
||||
properties.Height = newHeight;
|
||||
|
||||
@ -81,9 +81,9 @@ namespace Artemis.Profiles.Layers.Models
|
||||
properties.Y = properties.Y + difference;
|
||||
}
|
||||
|
||||
private void ApplyOpacity(LayerPropertiesModel properties, double percentage)
|
||||
private void ApplyOpacity(LayerPropertiesModel properties, float percentage)
|
||||
{
|
||||
properties.Opacity = percentage*properties.Opacity;
|
||||
properties.Opacity = percentage*(float) properties.Opacity;
|
||||
if (properties.Opacity < 0.0)
|
||||
properties.Opacity = 0.0;
|
||||
if (properties.Opacity > 1.0)
|
||||
@ -100,7 +100,7 @@ namespace Artemis.Profiles.Layers.Models
|
||||
|
||||
private void ApplyPercentageOfProperty(IDataModel dataModel, LayerPropertiesModel properties)
|
||||
{
|
||||
var value = dataModel.GetPropValue<int>(PercentageProperty);
|
||||
var value = dataModel.GetPropValue<float>(PercentageProperty);
|
||||
ApplyPercentageOf(dataModel, properties, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +92,9 @@ namespace Artemis.Utilities
|
||||
var retVal = GetPropValue(obj, name);
|
||||
if (retVal == null)
|
||||
return default(T);
|
||||
|
||||
if (typeof(T) == typeof(float) && retVal.GetType() != typeof(float))
|
||||
retVal = float.Parse(retVal.ToString());
|
||||
|
||||
// throws InvalidCastException if types are incompatible
|
||||
return (T) retVal;
|
||||
|
||||
@ -77,6 +77,8 @@ namespace Artemis.Utilities
|
||||
var friendlyName = Empty;
|
||||
if (propertyInfo.PropertyType.Name == "Int32")
|
||||
friendlyName = "(Number)";
|
||||
else if (propertyInfo.PropertyType.Name == "Single")
|
||||
friendlyName = "(Decimal)";
|
||||
else if (propertyInfo.PropertyType.Name == "String")
|
||||
friendlyName = "(Text)";
|
||||
else if (propertyInfo.PropertyType.Name == "Boolean")
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using Artemis.Managers;
|
||||
using System;
|
||||
using Artemis.Events;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.Services;
|
||||
using Caliburn.Micro;
|
||||
@ -17,6 +19,14 @@ namespace Artemis.ViewModels.Abstract
|
||||
{
|
||||
MainManager = mainManager;
|
||||
EffectModel = effectModel;
|
||||
EffectSettings = effectModel.Settings;
|
||||
|
||||
MainManager.OnEnabledChangedEvent += MainManagerOnOnEnabledChangedEvent;
|
||||
}
|
||||
|
||||
private void MainManagerOnOnEnabledChangedEvent(object sender, EnabledChangedEventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(() => EffectEnabled);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
|
||||
@ -15,20 +15,16 @@ namespace Artemis.ViewModels.Abstract
|
||||
{
|
||||
private GameSettings _gameSettings;
|
||||
|
||||
protected GameViewModel(MainManager mainManager, GameModel gameModel, IEventAggregator events,
|
||||
IProfileEditorVmFactory pFactory)
|
||||
protected GameViewModel(MainManager mainManager, GameModel gameModel, IProfileEditorVmFactory pFactory)
|
||||
{
|
||||
MainManager = mainManager;
|
||||
GameModel = gameModel;
|
||||
Events = events;
|
||||
PFactory = pFactory;
|
||||
GameSettings = gameModel.Settings;
|
||||
|
||||
ProfileEditor = PFactory.CreateProfileEditorVm(Events, mainManager, gameModel,
|
||||
GameSettings.LastProfile);
|
||||
ProfileEditor = PFactory.CreateProfileEditorVm(mainManager, gameModel, GameSettings.LastProfile);
|
||||
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||
Events.Subscribe(this);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
@ -40,7 +36,6 @@ namespace Artemis.ViewModels.Abstract
|
||||
[Inject]
|
||||
public MetroDialogService DialogService { get; set; }
|
||||
|
||||
public IEventAggregator Events { get; set; }
|
||||
public IProfileEditorVmFactory PFactory { get; set; }
|
||||
|
||||
public ProfileEditorViewModel ProfileEditor { get; set; }
|
||||
|
||||
@ -11,9 +11,11 @@ namespace Artemis.ViewModels.Abstract
|
||||
protected readonly MainManager MainManager;
|
||||
private OverlaySettings _overlaySettings;
|
||||
|
||||
protected OverlayViewModel(MainManager mainManager)
|
||||
protected OverlayViewModel(MainManager mainManager, OverlayModel overlayModel)
|
||||
{
|
||||
MainManager = mainManager;
|
||||
OverlayModel = overlayModel;
|
||||
OverlaySettings = overlayModel.Settings;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
|
||||
@ -1,19 +1,13 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Events;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.ViewModels
|
||||
{
|
||||
public class DebugViewModel : Screen, IHandle<RazerColorArrayChanged>
|
||||
public class DebugViewModel : Screen
|
||||
{
|
||||
private readonly IEventAggregator _events;
|
||||
private DrawingImage _razerDisplay;
|
||||
|
||||
public DebugViewModel(IEventAggregator events)
|
||||
{
|
||||
_events = events;
|
||||
}
|
||||
private DrawingImage _razerDisplay;
|
||||
|
||||
public DrawingImage RazerDisplay
|
||||
{
|
||||
@ -26,8 +20,12 @@ namespace Artemis.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(RazerColorArrayChanged message)
|
||||
public void UpdateRazerDisplay(Color[,] colors)
|
||||
{
|
||||
// No point updating the display if the view isn't visible
|
||||
if (!IsActive)
|
||||
return;
|
||||
|
||||
var visual = new DrawingVisual();
|
||||
using (var dc = visual.RenderOpen())
|
||||
{
|
||||
@ -35,24 +33,12 @@ namespace Artemis.ViewModels
|
||||
for (var y = 0; y < 6; y++)
|
||||
{
|
||||
for (var x = 0; x < 22; x++)
|
||||
dc.DrawRectangle(new SolidColorBrush(message.Colors[y, x]), null, new Rect(x, y, 1, 1));
|
||||
dc.DrawRectangle(new SolidColorBrush(colors[y, x]), null, new Rect(x, y, 1, 1));
|
||||
}
|
||||
}
|
||||
var drawnDisplay = new DrawingImage(visual.Drawing);
|
||||
drawnDisplay.Freeze();
|
||||
RazerDisplay = drawnDisplay;
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
_events.Subscribe(this);
|
||||
base.OnActivate();
|
||||
}
|
||||
|
||||
protected override void OnDeactivate(bool close)
|
||||
{
|
||||
_events.Unsubscribe(this);
|
||||
base.OnDeactivate(close);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using System.Linq;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
|
||||
namespace Artemis.ViewModels
|
||||
{
|
||||
@ -16,7 +17,7 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
base.OnActivate();
|
||||
|
||||
foreach (var effectViewModel in _effectViewModels)
|
||||
foreach (var effectViewModel in _effectViewModels.OrderBy(e => e.DisplayName))
|
||||
ActivateItem(effectViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,8 +14,7 @@ using ILogger = Ninject.Extensions.Logging.ILogger;
|
||||
|
||||
namespace Artemis.ViewModels.Flyouts
|
||||
{
|
||||
public sealed class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled>,
|
||||
IHandle<ActiveEffectChanged>
|
||||
public sealed class FlyoutSettingsViewModel : FlyoutBaseViewModel
|
||||
{
|
||||
private readonly DebugViewModel _debugViewModel;
|
||||
private readonly ILogger _logger;
|
||||
@ -24,8 +23,7 @@ namespace Artemis.ViewModels.Flyouts
|
||||
private GeneralSettings _generalSettings;
|
||||
private string _selectedKeyboardProvider;
|
||||
|
||||
public FlyoutSettingsViewModel(MainManager mainManager, IEventAggregator events, ILogger logger,
|
||||
DebugViewModel debugViewModel)
|
||||
public FlyoutSettingsViewModel(MainManager mainManager, ILogger logger, DebugViewModel debugViewModel)
|
||||
{
|
||||
_logger = logger;
|
||||
_debugViewModel = debugViewModel;
|
||||
@ -39,7 +37,8 @@ namespace Artemis.ViewModels.Flyouts
|
||||
LogLevels.AddRange(LogLevel.AllLoggingLevels.Select(l => l.Name));
|
||||
|
||||
PropertyChanged += KeyboardUpdater;
|
||||
events.Subscribe(this);
|
||||
mainManager.OnEnabledChangedEvent += MainManagerOnOnEnabledChangedEvent;
|
||||
mainManager.EffectManager.OnEffectChangedEvent += EffectManagerOnOnEffectChangedEvent;
|
||||
}
|
||||
|
||||
public MainManager MainManager { get; set; }
|
||||
@ -70,8 +69,9 @@ namespace Artemis.ViewModels.Flyouts
|
||||
{
|
||||
get
|
||||
{
|
||||
var collection =
|
||||
new BindableCollection<string>(MainManager.DeviceManager.KeyboardProviders.Select(k => k.Name));
|
||||
var collection = new BindableCollection<string>
|
||||
(MainManager.DeviceManager.KeyboardProviders.Select(k => k.Name));
|
||||
|
||||
collection.Insert(0, "None");
|
||||
return collection;
|
||||
}
|
||||
@ -145,17 +145,17 @@ namespace Artemis.ViewModels.Flyouts
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ActiveEffectChanged message)
|
||||
{
|
||||
var effectDisplay = string.IsNullOrEmpty(message.ActiveEffect) ? message.ActiveEffect : "none";
|
||||
ActiveEffectName = $"Active effect: {effectDisplay}";
|
||||
}
|
||||
|
||||
public void Handle(ToggleEnabled message)
|
||||
private void MainManagerOnOnEnabledChangedEvent(object sender, EnabledChangedEventArgs enabledChangedEventArgs)
|
||||
{
|
||||
NotifyOfPropertyChange(() => Enabled);
|
||||
}
|
||||
|
||||
private void EffectManagerOnOnEffectChangedEvent(object sender, EffectChangedEventArgs e)
|
||||
{
|
||||
var effectDisplay = string.IsNullOrEmpty(e.Effect?.Name) ? "none" : e.Effect.Name;
|
||||
ActiveEffectName = $"Active effect: {effectDisplay}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes proper action when the selected keyboard is changed in the UI
|
||||
/// </summary>
|
||||
@ -211,7 +211,7 @@ namespace Artemis.ViewModels.Flyouts
|
||||
|
||||
public void NavigateTo(string url)
|
||||
{
|
||||
System.Diagnostics.Process.Start(new ProcessStartInfo(url));
|
||||
Process.Start(new ProcessStartInfo(url));
|
||||
}
|
||||
|
||||
protected override void HandleOpen()
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Artemis.Managers;
|
||||
using System.Linq;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Modules.Effects.ProfilePreview;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
|
||||
@ -22,7 +23,7 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
base.OnActivate();
|
||||
|
||||
foreach (var gameViewModel in _gameViewModels)
|
||||
foreach (var gameViewModel in _gameViewModels.OrderBy(g => g.DisplayName))
|
||||
ActivateItem(gameViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,6 +156,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
switch (SelectedDataModelProp.Type)
|
||||
{
|
||||
case "Int32":
|
||||
case "Single":
|
||||
Operators.AddRange(_int32Operators);
|
||||
UserValueIsVisible = true;
|
||||
break;
|
||||
|
||||
@ -144,11 +144,11 @@ namespace Artemis.ViewModels.Profiles
|
||||
{
|
||||
new GeneralHelpers.PropertyCollection {Display = "None"}
|
||||
};
|
||||
Targets.AddRange(dataModelProps.Where(p => p.Type == "Int32"));
|
||||
Targets.AddRange(dataModelProps.Where(p => p.Type == "Int32" || p.Type == "Single"));
|
||||
|
||||
// Populate sources combobox
|
||||
Sources = new BindableCollection<GeneralHelpers.PropertyCollection>();
|
||||
Sources.AddRange(dataModelProps.Where(p => p.Type == "Int32"));
|
||||
Sources.AddRange(dataModelProps.Where(p => p.Type == "Int32" || p.Type == "Single"));
|
||||
|
||||
// Preselect according to the model
|
||||
SelectedTarget = dataModelProps.FirstOrDefault(p => p.Path == Proposed.GameProperty);
|
||||
|
||||
@ -32,7 +32,7 @@ using Timer = System.Timers.Timer;
|
||||
|
||||
namespace Artemis.ViewModels.Profiles
|
||||
{
|
||||
public sealed class ProfileEditorViewModel : Screen, IHandle<ActiveKeyboardChanged>, IDropTarget
|
||||
public sealed class ProfileEditorViewModel : Screen, IDropTarget
|
||||
{
|
||||
private readonly EffectModel _gameModel;
|
||||
private readonly ILayerEditorVmFactory _layerEditorVmFactory;
|
||||
@ -44,9 +44,8 @@ namespace Artemis.ViewModels.Profiles
|
||||
private bool _saving;
|
||||
private ProfileModel _selectedProfile;
|
||||
|
||||
public ProfileEditorViewModel(IEventAggregator events, MainManager mainManager, EffectModel gameModel,
|
||||
ProfileViewModel profileViewModel, MetroDialogService dialogService, string lastProfile,
|
||||
ILayerEditorVmFactory layerEditorVmFactory)
|
||||
public ProfileEditorViewModel(MainManager mainManager, EffectModel gameModel, ProfileViewModel profileViewModel,
|
||||
MetroDialogService dialogService, string lastProfile, ILayerEditorVmFactory layerEditorVmFactory)
|
||||
{
|
||||
_mainManager = mainManager;
|
||||
_gameModel = gameModel;
|
||||
@ -58,11 +57,9 @@ namespace Artemis.ViewModels.Profiles
|
||||
DialogService = dialogService;
|
||||
LastProfile = lastProfile;
|
||||
|
||||
events.Subscribe(this);
|
||||
|
||||
|
||||
PropertyChanged += EditorStateHandler;
|
||||
ProfileViewModel.PropertyChanged += LayerSelectedHandler;
|
||||
mainManager.DeviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
||||
|
||||
_saveTimer = new Timer(5000);
|
||||
_saveTimer.Elapsed += ProfileSaveHandler;
|
||||
@ -199,12 +196,10 @@ namespace Artemis.ViewModels.Profiles
|
||||
UpdateLayerList(source);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles chaning the active keyboard, updating the preview image and profiles collection
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public void Handle(ActiveKeyboardChanged message)
|
||||
private void DeviceManagerOnOnKeyboardChangedEvent(object sender, KeyboardChangedEventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(() => PreviewSettings);
|
||||
LoadProfiles();
|
||||
@ -518,7 +513,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
{
|
||||
if (SelectedProfile == null)
|
||||
return;
|
||||
|
||||
|
||||
var name = await DialogService.ShowInputDialog("Rename profile", "Please enter a unique new profile name");
|
||||
|
||||
// Null when the user cancelled
|
||||
@ -529,7 +524,8 @@ namespace Artemis.ViewModels.Profiles
|
||||
while (ProfileProvider.GetAll().Any(p => p.Name == name && p.GameName == SelectedProfile.GameName &&
|
||||
p.KeyboardSlug == SelectedProfile.KeyboardSlug))
|
||||
{
|
||||
name = await DialogService.ShowInputDialog("Name already in use", "Please enter a unique new profile name");
|
||||
name =
|
||||
await DialogService.ShowInputDialog("Name already in use", "Please enter a unique new profile name");
|
||||
|
||||
// Null when the user cancelled
|
||||
if (string.IsNullOrEmpty(name) || name.Length < 2)
|
||||
@ -539,7 +535,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
var profile = SelectedProfile;
|
||||
SelectedProfile = null;
|
||||
ProfileProvider.RenameProfile(profile, name);
|
||||
|
||||
|
||||
LastProfile = name;
|
||||
LoadProfiles();
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ using MahApps.Metro;
|
||||
|
||||
namespace Artemis.ViewModels.Profiles
|
||||
{
|
||||
public class ProfileViewModel : PropertyChangedBase, IHandle<ActiveKeyboardChanged>
|
||||
public class ProfileViewModel : PropertyChangedBase
|
||||
{
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private double _blurProgress;
|
||||
@ -34,15 +34,15 @@ namespace Artemis.ViewModels.Profiles
|
||||
private LayerModel _selectedLayer;
|
||||
private bool _showAll;
|
||||
|
||||
public ProfileViewModel(IEventAggregator events, DeviceManager deviceManager)
|
||||
public ProfileViewModel(DeviceManager deviceManager)
|
||||
{
|
||||
events.Subscribe(this);
|
||||
_deviceManager = deviceManager;
|
||||
|
||||
PreviewTimer = new Timer(40);
|
||||
ShowAll = false;
|
||||
|
||||
PreviewTimer.Elapsed += InvokeUpdateKeyboardPreview;
|
||||
deviceManager.OnKeyboardChangedEvent += DeviceManagerOnOnKeyboardChangedEvent;
|
||||
}
|
||||
|
||||
public ProfileModel SelectedProfile { get; set; }
|
||||
@ -97,7 +97,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
|
||||
public bool Activated { get; set; }
|
||||
|
||||
public void Handle(ActiveKeyboardChanged message)
|
||||
private void DeviceManagerOnOnKeyboardChangedEvent(object sender, KeyboardChangedEventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(() => KeyboardImage);
|
||||
}
|
||||
@ -359,7 +359,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
else if (SelectedLayer.LayerType is FolderType)
|
||||
drawLayers = SelectedLayer.GetLayers().ToList();
|
||||
else
|
||||
drawLayers = new List<LayerModel> { SelectedLayer };
|
||||
drawLayers = new List<LayerModel> {SelectedLayer};
|
||||
|
||||
return drawLayers;
|
||||
}
|
||||
|
||||
@ -10,18 +10,11 @@ namespace Artemis.ViewModels
|
||||
{
|
||||
public sealed class ShellViewModel : Conductor<IScreen>.Collection.OneActive
|
||||
{
|
||||
private readonly DeviceManager _deviceManager;
|
||||
private readonly MetroDialogService _dialogService;
|
||||
private readonly BaseViewModel[] _viewModels;
|
||||
|
||||
public ShellViewModel(IKernel kernel, IEventAggregator events, BaseViewModel[] viewModels,
|
||||
DeviceManager deviceManager, MetroDialogService dialogService)
|
||||
public ShellViewModel(IKernel kernel, BaseViewModel[] viewModels)
|
||||
{
|
||||
_viewModels = viewModels;
|
||||
_deviceManager = deviceManager;
|
||||
_dialogService = dialogService;
|
||||
|
||||
events.Subscribe(this);
|
||||
|
||||
// Setup UI
|
||||
DisplayName = "Artemis";
|
||||
|
||||
@ -10,18 +10,17 @@ using Caliburn.Micro;
|
||||
|
||||
namespace Artemis.ViewModels
|
||||
{
|
||||
public class SystemTrayViewModel : Screen, IHandle<ToggleEnabled>
|
||||
public class SystemTrayViewModel : Screen
|
||||
{
|
||||
private readonly ShellViewModel _shellViewModel;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private string _activeIcon;
|
||||
private bool _checked;
|
||||
private bool _enabled;
|
||||
private string _toggleText;
|
||||
private bool _checked;
|
||||
|
||||
public SystemTrayViewModel(IWindowManager windowManager, IEventAggregator events,
|
||||
MetroDialogService dialogService, ShellViewModel shellViewModel,
|
||||
MainManager mainManager)
|
||||
public SystemTrayViewModel(IWindowManager windowManager, MetroDialogService dialogService,
|
||||
ShellViewModel shellViewModel, MainManager mainManager)
|
||||
{
|
||||
_windowManager = windowManager;
|
||||
_shellViewModel = shellViewModel;
|
||||
@ -29,9 +28,10 @@ namespace Artemis.ViewModels
|
||||
DialogService = dialogService;
|
||||
MainManager = mainManager;
|
||||
|
||||
events.Subscribe(this);
|
||||
MainManager.EnableProgram();
|
||||
MainManager.OnEnabledChangedEvent += MainManagerOnOnEnabledChangedEvent;
|
||||
|
||||
Enabled = !General.Default.Suspended;
|
||||
if (General.Default.ShowOnStartup)
|
||||
ShowWindow();
|
||||
}
|
||||
@ -41,7 +41,6 @@ namespace Artemis.ViewModels
|
||||
public MainManager MainManager { get; set; }
|
||||
|
||||
public bool CanShowWindow => !_shellViewModel.IsActive;
|
||||
|
||||
public bool CanHideWindow => _shellViewModel.IsActive && !MainManager.DeviceManager.ChangingKeyboard;
|
||||
public bool CanToggleEnabled => !MainManager.DeviceManager.ChangingKeyboard;
|
||||
|
||||
@ -82,9 +81,9 @@ namespace Artemis.ViewModels
|
||||
|
||||
public Mutex Mutex { get; set; }
|
||||
|
||||
public void Handle(ToggleEnabled message)
|
||||
private void MainManagerOnOnEnabledChangedEvent(object sender, EnabledChangedEventArgs e)
|
||||
{
|
||||
Enabled = message.Enabled;
|
||||
Enabled = e.Enabled;
|
||||
}
|
||||
|
||||
public void ToggleEnabled()
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
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:local="clr-namespace:Artemis.Views"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
|
||||
BIN
Artemis/Artemis/lib/Ets2SdkClient.dll
Normal file
BIN
Artemis/Artemis/lib/Ets2SdkClient.dll
Normal file
Binary file not shown.
@ -17,6 +17,7 @@
|
||||
<package id="NAudio" version="1.7.3" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
|
||||
<package id="Ninject" version="3.2.2.0" targetFramework="net452" />
|
||||
<package id="Ninject.Extensions.Conventions" version="3.2.0.0" targetFramework="net461" />
|
||||
<package id="Ninject.Extensions.Factory" version="3.2.1.0" targetFramework="net452" />
|
||||
<package id="Ninject.Extensions.Logging" version="3.2.3.0" targetFramework="net452" />
|
||||
<package id="Ninject.Extensions.Logging.nlog4" version="3.2.3.0" targetFramework="net452" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user