mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Implemented CS:GO and Dota directory detection. Implemented last profile saving, implemented growth effect
This commit is contained in:
parent
67b87324c6
commit
da64c85a22
@ -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.Overwatch.Overwatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.TheDivision.TheDivision" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Games.Dota2.Dota2" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Artemis.Modules.Overlays.VolumeDisplay.VolumeDisplay" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
@ -24,6 +25,17 @@
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<Artemis.Modules.Games.Overwatch.Overwatch>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Artemis.Modules.Games.Overwatch.Overwatch>
|
||||
<Artemis.Modules.Games.TheDivision.TheDivision>
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
@ -82,14 +94,8 @@
|
||||
<setting name="Enabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="MainColor" serializeAs="String">
|
||||
<value>#FFFF5000</value>
|
||||
</setting>
|
||||
<setting name="SecondaryColor" serializeAs="String">
|
||||
<value>#FFFF0000</value>
|
||||
</setting>
|
||||
<setting name="ContextualColor" serializeAs="String">
|
||||
<value>False</value>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.RocketLeague.RocketLeague>
|
||||
<Artemis.Settings.Offsets>
|
||||
@ -156,6 +162,9 @@
|
||||
<setting name="LowHpEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="LastProfile" serializeAs="String">
|
||||
<value>Default</value>
|
||||
</setting>
|
||||
</Artemis.Modules.Games.CounterStrike.CounterStrike>
|
||||
<Artemis.Settings.CounterStrike>
|
||||
<setting name="GameDirectory" serializeAs="String">
|
||||
|
||||
@ -390,7 +390,6 @@
|
||||
<Compile Include="Modules\Games\Overwatch\OverwatchModel.cs" />
|
||||
<Compile Include="Modules\Games\Overwatch\OverwatchSettings.cs" />
|
||||
<Compile Include="Modules\Games\Overwatch\OverwatchViewModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\TheWitcherDataModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3DataModel.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
|
||||
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
|
||||
@ -635,6 +634,7 @@
|
||||
<None Include="Resources\gif.png" />
|
||||
<Resource Include="Resources\WindowsIcons-license.txt" />
|
||||
<Resource Include="Resources\Entypo-license.txt" />
|
||||
<None Include="Resources\RzChromaSDK64.dll" />
|
||||
<Content Include="Resources\Witcher3\playerWitcher.txt" />
|
||||
<Content Include="Resources\Witcher3\artemis.txt" />
|
||||
<None Include="Settings\Offsets.settings">
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
using Artemis.ViewModels;
|
||||
using Artemis.ViewModels.Profiles;
|
||||
using Caliburn.Micro;
|
||||
|
||||
@ -8,7 +7,6 @@ namespace Artemis.InjectionFactories
|
||||
{
|
||||
public interface IProfileEditorViewModelFactory
|
||||
{
|
||||
ProfileEditorViewModel CreateProfileEditorViewModel(IEventAggregator events, MainManager mainManager,
|
||||
GameModel gameModel);
|
||||
ProfileEditorViewModel CreateProfileEditorViewModel(IEventAggregator events, MainManager mainManager, GameModel gameModel, string lastProfile);
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,9 @@ namespace Artemis.Managers
|
||||
ProgramEnabled = false;
|
||||
Running = false;
|
||||
|
||||
KeyboardHook = new KeyboardHook(); // TODO: DI
|
||||
|
||||
// TODO: Dependency inject utilities?
|
||||
KeyboardHook = new KeyboardHook();
|
||||
|
||||
// Create and start the web server
|
||||
GameStateWebServer = new GameStateWebServer();
|
||||
|
||||
@ -3,5 +3,6 @@
|
||||
public abstract class GameSettings : EffectSettings
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
public string LastProfile { get; set; }
|
||||
}
|
||||
}
|
||||
@ -130,5 +130,17 @@ namespace Artemis.Modules.Games.CounterStrike {
|
||||
this["LowHpEnabled"] = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastProfile" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Default</Value>
|
||||
</Setting>
|
||||
<Setting Name="GameDirectory" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
@ -30,6 +31,6 @@
|
||||
</Setting>
|
||||
<Setting Name="LowHpEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -24,6 +24,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = CounterStrike.Default.Enabled;
|
||||
LastProfile = CounterStrike.Default.LastProfile;
|
||||
GameDirectory = CounterStrike.Default.GameDirectory;
|
||||
|
||||
AmmoEnabled = CounterStrike.Default.AmmoEnabled;
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Windows.Forms;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
@ -14,11 +15,25 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
: base(main, new CounterStrikeModel(main, new CounterStrikeSettings()), events, pFactory)
|
||||
{
|
||||
DisplayName = "CS:GO";
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
FindGameDir();
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
public void FindGameDir()
|
||||
{
|
||||
var gameSettings = (CounterStrikeSettings) 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;
|
||||
|
||||
var dir = GeneralHelpers.FindSteamGame(@"\Counter-Strike Global Offensive\csgo.exe");
|
||||
gameSettings.GameDirectory = dir ?? string.Empty;
|
||||
gameSettings.Save();
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((CounterStrikeSettings) GameSettings).GameDirectory};
|
||||
@ -26,7 +41,7 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((CounterStrikeSettings) GameSettings).GameDirectory = dialog.SelectedPath;
|
||||
((CounterStrikeSettings) GameSettings).GameDirectory = Path.GetDirectoryName(dialog.SelectedPath);
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
|
||||
GameSettings.Save();
|
||||
@ -37,22 +52,22 @@ namespace Artemis.Modules.Games.CounterStrike
|
||||
{
|
||||
if (((CounterStrikeSettings) GameSettings).GameDirectory == string.Empty)
|
||||
return;
|
||||
if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
|
||||
|
||||
var path = ((CounterStrikeSettings) GameSettings).GameDirectory;
|
||||
if (Directory.Exists(path + "/csgo/cfg"))
|
||||
{
|
||||
var cfgFile = Resources.csgoGamestateConfiguration.Replace("{{port}}",
|
||||
MainManager.GameStateWebServer.Port.ToString());
|
||||
File.WriteAllText(
|
||||
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
|
||||
cfgFile);
|
||||
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");
|
||||
@"By default CS:GO is in \SteamApps\common\Counter-Strike Global Offensive");
|
||||
|
||||
((CounterStrikeSettings) GameSettings).GameDirectory = string.Empty;
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
|
||||
GameSettings.Save();
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,18 @@ namespace Artemis.Modules.Games.Dota2 {
|
||||
}
|
||||
}
|
||||
|
||||
[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("")]
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
<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>
|
||||
|
||||
@ -29,14 +29,16 @@ namespace Artemis.Modules.Games.Dota2
|
||||
|
||||
public override void Save()
|
||||
{
|
||||
Dota2.Default.Enabled = Enabled;
|
||||
Dota2.Default.LastProfile = LastProfile;
|
||||
Dota2.Default.GameDirectory = GameDirectory;
|
||||
|
||||
Dota2.Default.KeyboardLayout = KeyboardLayout;
|
||||
Dota2.Default.MainColor = MainColor;
|
||||
Dota2.Default.ManaColor = ManaColor;
|
||||
Dota2.Default.ShowDayCycle = ShowDayCycle;
|
||||
Dota2.Default.ShowHealth = ShowHealth;
|
||||
Dota2.Default.CanCastAbility = CanCastAbility;
|
||||
Dota2.Default.Enabled = Enabled;
|
||||
Dota2.Default.GameDirectory = GameDirectory;
|
||||
Dota2.Default.ShowMana = ShowMana;
|
||||
Dota2.Default.ShowEvents = ShowEvents;
|
||||
Dota2.Default.AbilityCooldownColor = AbilityCooldownColor;
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Windows.Forms;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Artemis.Utilities;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
|
||||
@ -14,11 +15,28 @@ namespace Artemis.Modules.Games.Dota2
|
||||
: base(main, new Dota2Model(main, new Dota2Settings()), events, pFactory)
|
||||
{
|
||||
DisplayName = "Dota 2";
|
||||
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
FindGameDir();
|
||||
PlaceConfigFile();
|
||||
}
|
||||
|
||||
|
||||
public void FindGameDir()
|
||||
{
|
||||
var gameSettings = (Dota2Settings)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;
|
||||
|
||||
var dir = GeneralHelpers.FindSteamGame(@"\dota 2 beta\game\bin\win32\dota2.exe");
|
||||
// Remove subdirectories where they stuck the executable
|
||||
dir = dir?.Substring(0, dir.Length - 15);
|
||||
|
||||
gameSettings.GameDirectory = dir ?? string.Empty;
|
||||
gameSettings.Save();
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((Dota2Settings) GameSettings).GameDirectory};
|
||||
|
||||
@ -34,5 +34,29 @@ namespace Artemis.Modules.Games.Overwatch {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +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.Witcher3" GeneratedClassName="Witcher3">
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Overwatch" GeneratedClassName="Overwatch">
|
||||
<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>
|
||||
@ -12,18 +12,25 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = Overwatch.Default.Enabled;
|
||||
LastProfile = Overwatch.Default.LastProfile;
|
||||
GameDirectory = Overwatch.Default.GameDirectory;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
Overwatch.Default.Enabled = Enabled;
|
||||
Overwatch.Default.LastProfile = LastProfile;
|
||||
Overwatch.Default.GameDirectory = GameDirectory;
|
||||
|
||||
Overwatch.Default.Save();
|
||||
}
|
||||
|
||||
public string GameDirectory { get; set; }
|
||||
|
||||
public sealed override void ToDefault()
|
||||
{
|
||||
Enabled = true;
|
||||
GameDirectory = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,13 +13,10 @@
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
@ -38,11 +35,26 @@
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2" Margin="0,0,1,0">
|
||||
|
||||
<Label FontSize="20" HorizontalAlignment="Left" Content="Overwatch 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 PlaceDll]" />
|
||||
<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,-30,0" />
|
||||
<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<StackPanel Grid.Column="0" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Bottom">
|
||||
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
|
||||
Style="{DynamicResource SquareButtonStyle}" />
|
||||
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
using Artemis.InjectionFactories;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Properties;
|
||||
using Artemis.ViewModels.Abstract;
|
||||
using Caliburn.Micro;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
@ -12,6 +17,70 @@ namespace Artemis.Modules.Games.Overwatch
|
||||
{
|
||||
DisplayName = "Overwatch";
|
||||
MainManager.EffectManager.EffectModels.Add(GameModel);
|
||||
|
||||
FindOverwatch();
|
||||
}
|
||||
|
||||
public void FindOverwatch()
|
||||
{
|
||||
var gameSettings = (OverwatchSettings) GameSettings;
|
||||
// If already propertly set up, don't do anything
|
||||
if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "Overwatch.exe") &&
|
||||
File.Exists(gameSettings.GameDirectory + "RzChromaSDK64.dll"))
|
||||
return;
|
||||
|
||||
var key = Registry.LocalMachine.OpenSubKey(
|
||||
@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Overwatch");
|
||||
if (key == null)
|
||||
return;
|
||||
|
||||
var path = key.GetValue("DisplayIcon").ToString();
|
||||
if (!File.Exists(path))
|
||||
return;
|
||||
|
||||
gameSettings.GameDirectory = path.Substring(0, path.Length - 14);
|
||||
gameSettings.Save();
|
||||
PlaceDll();
|
||||
}
|
||||
|
||||
public void BrowseDirectory()
|
||||
{
|
||||
var dialog = new FolderBrowserDialog {SelectedPath = ((OverwatchSettings) GameSettings).GameDirectory};
|
||||
var result = dialog.ShowDialog();
|
||||
if (result != DialogResult.OK)
|
||||
return;
|
||||
|
||||
((OverwatchSettings) GameSettings).GameDirectory = dialog.SelectedPath;
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
GameSettings.Save();
|
||||
|
||||
PlaceDll();
|
||||
}
|
||||
|
||||
public void PlaceDll()
|
||||
{
|
||||
var path = ((OverwatchSettings) GameSettings).GameDirectory;
|
||||
|
||||
if (!File.Exists(path + @"\Overwatch.exe"))
|
||||
{
|
||||
DialogService.ShowErrorMessageBox("Please select a valid Overwatch directory\n\n" +
|
||||
@"By default Overwatch is in C:\Program Files (x86)\Overwatch");
|
||||
|
||||
((OverwatchSettings) GameSettings).GameDirectory = string.Empty;
|
||||
NotifyOfPropertyChange(() => GameSettings);
|
||||
GameSettings.Save();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllBytes(path + @"\RzChromaSDK64.dll", Resources.RzChromaSDK64);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Couldn't place Overwatch DLL, Overwatch support won't work.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,37 +37,13 @@ namespace Artemis.Modules.Games.RocketLeague {
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF5000")]
|
||||
public global::System.Windows.Media.Color MainColor {
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Default")]
|
||||
public string LastProfile {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["MainColor"]));
|
||||
return ((string)(this["LastProfile"]));
|
||||
}
|
||||
set {
|
||||
this["MainColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
|
||||
public global::System.Windows.Media.Color SecondaryColor {
|
||||
get {
|
||||
return ((global::System.Windows.Media.Color)(this["SecondaryColor"]));
|
||||
}
|
||||
set {
|
||||
this["SecondaryColor"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool ContextualColor {
|
||||
get {
|
||||
return ((bool)(this["ContextualColor"]));
|
||||
}
|
||||
set {
|
||||
this["ContextualColor"] = value;
|
||||
this["LastProfile"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +1,12 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
|
||||
GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Enabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="MainColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF5000</Value>
|
||||
</Setting>
|
||||
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
|
||||
<Value Profile="(Default)">#FFFF0000</Value>
|
||||
</Setting>
|
||||
<Setting Name="ContextualColor" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
<Setting Name="LastProfile" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Default</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -10,24 +10,16 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
Load();
|
||||
}
|
||||
|
||||
public Color MainColor { get; set; }
|
||||
public Color SecondaryColor { get; set; }
|
||||
public bool ContextualColor { get; set; }
|
||||
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = RocketLeague.Default.Enabled;
|
||||
MainColor = RocketLeague.Default.MainColor;
|
||||
SecondaryColor = RocketLeague.Default.SecondaryColor;
|
||||
ContextualColor = RocketLeague.Default.ContextualColor;
|
||||
LastProfile = RocketLeague.Default.LastProfile;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
RocketLeague.Default.Enabled = Enabled;
|
||||
RocketLeague.Default.MainColor = MainColor;
|
||||
RocketLeague.Default.SecondaryColor = SecondaryColor;
|
||||
RocketLeague.Default.ContextualColor = ContextualColor;
|
||||
RocketLeague.Default.LastProfile = LastProfile;
|
||||
|
||||
RocketLeague.Default.Save();
|
||||
}
|
||||
@ -35,9 +27,6 @@ namespace Artemis.Modules.Games.RocketLeague
|
||||
public sealed override void ToDefault()
|
||||
{
|
||||
Enabled = true;
|
||||
MainColor = Color.FromArgb(255, 255, 80, 0);
|
||||
SecondaryColor = Color.FromArgb(255, 255, 0, 0);
|
||||
ContextualColor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,5 +34,17 @@ namespace Artemis.Modules.Games.TheDivision {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,5 +7,8 @@
|
||||
<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>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -12,11 +12,13 @@ namespace Artemis.Modules.Games.TheDivision
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = TheDivision.Default.Enabled;
|
||||
LastProfile = TheDivision.Default.LastProfile;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
TheDivision.Default.Enabled = Enabled;
|
||||
TheDivision.Default.LastProfile = LastProfile;
|
||||
|
||||
TheDivision.Default.Save();
|
||||
}
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
using Artemis.Models.Interfaces;
|
||||
|
||||
namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class TheWitcherDataModel : IGameDataModel
|
||||
{
|
||||
public WitcherSign WitcherSign { get; set; }
|
||||
}
|
||||
|
||||
public enum WitcherSign
|
||||
{
|
||||
Aard,
|
||||
Yrden,
|
||||
Igni,
|
||||
Quen,
|
||||
Axii
|
||||
}
|
||||
}
|
||||
@ -34,5 +34,17 @@ namespace Artemis.Modules.Games.Witcher3 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,5 +7,8 @@
|
||||
<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>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -4,5 +4,15 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
{
|
||||
public class Witcher3DataModel : IGameDataModel
|
||||
{
|
||||
public WitcherSign WitcherSign { get; set; }
|
||||
}
|
||||
|
||||
public enum WitcherSign
|
||||
{
|
||||
Aard,
|
||||
Yrden,
|
||||
Igni,
|
||||
Quen,
|
||||
Axii
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
private string _witcherSettings;
|
||||
|
||||
public Witcher3Model(MainManager mainManager, Witcher3Settings settings)
|
||||
: base(mainManager, settings, new TheWitcherDataModel())
|
||||
: base(mainManager, settings, new Witcher3DataModel())
|
||||
{
|
||||
Name = "Witcher3";
|
||||
ProcessName = "witcher3";
|
||||
@ -67,7 +67,7 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
var gameDataModel = (TheWitcherDataModel) GameDataModel;
|
||||
var gameDataModel = (Witcher3DataModel) GameDataModel;
|
||||
// Witcher effect is very static and reads from disk, don't want to update too often.
|
||||
if (_updateSw.ElapsedMilliseconds < 500)
|
||||
return;
|
||||
@ -112,17 +112,17 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
return null;
|
||||
|
||||
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||
return Profile.GenerateBitmap<TheWitcherDataModel>(keyboardRect, GameDataModel, false, true);
|
||||
return Profile.GenerateBitmap<Witcher3DataModel>(keyboardRect, GameDataModel, false, true);
|
||||
}
|
||||
|
||||
public override Brush GenerateMouseBrush()
|
||||
{
|
||||
return Profile.GenerateBrush<TheWitcherDataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||
return Profile.GenerateBrush<Witcher3DataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||
}
|
||||
|
||||
public override Brush GenerateHeadsetBrush()
|
||||
{
|
||||
return Profile.GenerateBrush<TheWitcherDataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||
return Profile.GenerateBrush<Witcher3DataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,11 +12,13 @@ namespace Artemis.Modules.Games.Witcher3
|
||||
public sealed override void Load()
|
||||
{
|
||||
Enabled = Witcher3.Default.Enabled;
|
||||
LastProfile = Witcher3.Default.LastProfile;
|
||||
}
|
||||
|
||||
public sealed override void Save()
|
||||
{
|
||||
Witcher3.Default.Enabled = Enabled;
|
||||
Witcher3.Default.LastProfile = LastProfile;
|
||||
|
||||
Witcher3.Default.Save();
|
||||
}
|
||||
|
||||
10
Artemis/Artemis/Properties/Resources.Designer.cs
generated
10
Artemis/Artemis/Properties/Resources.Designer.cs
generated
@ -269,6 +269,16 @@ namespace Artemis.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] RzChromaSDK64 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("RzChromaSDK64", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@ -169,4 +169,7 @@
|
||||
<data name="gif" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\gif.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="RzChromaSDK64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\RzChromaSDK64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Artemis/Artemis/Resources/RzChromaSDK64.dll
Normal file
BIN
Artemis/Artemis/Resources/RzChromaSDK64.dll
Normal file
Binary file not shown.
@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Security.Principal;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
using Microsoft.Win32;
|
||||
using static System.String;
|
||||
|
||||
namespace Artemis.Utilities
|
||||
@ -112,6 +112,33 @@ namespace Artemis.Utilities
|
||||
return list;
|
||||
}
|
||||
|
||||
public static string FindSteamGame(string relativePath)
|
||||
{
|
||||
var key = Registry.CurrentUser.OpenSubKey(@"Software\Valve\Steam");
|
||||
if (key == null)
|
||||
return null;
|
||||
var path = key.GetValue("SteamPath").ToString();
|
||||
var libFile = path + @"\steamapps\libraryfolders.vdf";
|
||||
if (!File.Exists(libFile))
|
||||
return null;
|
||||
|
||||
// Try the main SteamApps folder
|
||||
if (File.Exists(path + "\\SteamApps\\common" + relativePath))
|
||||
return Path.GetDirectoryName(path + "\\SteamApps\\common" + relativePath);
|
||||
|
||||
// If not found in the main folder, try all the libraries found in the vdf file.
|
||||
var content = File.ReadAllText(libFile);
|
||||
var matches = Regex.Matches(content, "\"\\d\"\\t\\t\"(.*)\"");
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
var library = match.Groups[1].Value;
|
||||
library = library.Replace("\\\\", "\\") + "\\SteamApps\\common";
|
||||
if (File.Exists(library + relativePath))
|
||||
return Path.GetDirectoryName(library + relativePath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public struct PropertyCollection
|
||||
{
|
||||
public string Display { get; set; }
|
||||
|
||||
@ -11,33 +11,31 @@ namespace Artemis.Utilities.Layers
|
||||
appliedProperties.AnimationProgress = properties.AnimationProgress;
|
||||
var progress = appliedProperties.AnimationProgress;
|
||||
|
||||
// Horizontal sliding
|
||||
if (animateProperties.Animation == LayerAnimation.SlideRight ||
|
||||
animateProperties.Animation == LayerAnimation.SlideLeft)
|
||||
switch (animateProperties.Animation)
|
||||
{
|
||||
if (progress + 1 >= animateProperties.Width*scale)
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
// Vertical sliding
|
||||
if (animateProperties.Animation == LayerAnimation.SlideDown ||
|
||||
animateProperties.Animation == LayerAnimation.SlideUp)
|
||||
{
|
||||
if (progress + 1 >= animateProperties.Height*scale)
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
// Pulse animation
|
||||
if (animateProperties.Animation == LayerAnimation.Pulse)
|
||||
{
|
||||
if (progress > 2)
|
||||
progress = 0;
|
||||
|
||||
progress = progress + animateProperties.AnimationSpeed/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
progress = progress + animateProperties.AnimationSpeed*2;
|
||||
case LayerAnimation.SlideRight:
|
||||
case LayerAnimation.SlideLeft:
|
||||
if (progress + 1 >= animateProperties.Width*scale)
|
||||
progress = 0;
|
||||
break;
|
||||
case LayerAnimation.SlideDown:
|
||||
case LayerAnimation.SlideUp:
|
||||
if (progress + 1 >= animateProperties.Height*scale)
|
||||
progress = 0;
|
||||
break;
|
||||
case LayerAnimation.Pulse:
|
||||
if (progress > 2)
|
||||
progress = 0;
|
||||
progress = progress + animateProperties.AnimationSpeed/2;
|
||||
break;
|
||||
case LayerAnimation.Grow:
|
||||
if (progress > 10)
|
||||
progress = 0;
|
||||
progress = progress + animateProperties.AnimationSpeed / 2.5;
|
||||
break;
|
||||
default:
|
||||
progress = progress + animateProperties.AnimationSpeed*2;
|
||||
break;
|
||||
}
|
||||
|
||||
appliedProperties.AnimationProgress = progress;
|
||||
|
||||
@ -59,14 +59,31 @@ namespace Artemis.Utilities.Layers
|
||||
Rect rectangle,
|
||||
Rect slide1, Rect slide2)
|
||||
{
|
||||
// Apply the pulse animation
|
||||
var brush = properties.Brush.CloneCurrentValue();
|
||||
brush.Opacity = properties.Opacity;
|
||||
|
||||
// Apply the pulse animation
|
||||
if (properties.Animation == LayerAnimation.Pulse)
|
||||
brush.Opacity = (Math.Sin(properties.AnimationProgress*Math.PI) + 1)*(properties.Opacity/2);
|
||||
else
|
||||
brush.Opacity = properties.Opacity;
|
||||
|
||||
if (properties.Animation == LayerAnimation.Grow)
|
||||
{
|
||||
// Take an offset of 4 to allow layers to slightly leave their bounds
|
||||
var progress = (6.0 - properties.AnimationProgress)*10.0;
|
||||
if (progress < 0)
|
||||
{
|
||||
brush.Opacity = 1 + (0.025*progress);
|
||||
if (brush.Opacity < 0)
|
||||
brush.Opacity = 0;
|
||||
if (brush.Opacity > 1)
|
||||
brush.Opacity = 1;
|
||||
}
|
||||
rectangle.Inflate(-rectangle.Width/100.0*progress, -rectangle.Height/100.0*progress);
|
||||
clip.Inflate(-clip.Width/100.0*progress, -clip.Height/100.0*progress);
|
||||
}
|
||||
|
||||
c.PushClip(new RectangleGeometry(clip));
|
||||
// Most animation types can be drawn regularly
|
||||
if (properties.Animation == LayerAnimation.None ||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.InjectionFactories;
|
||||
using Artemis.Managers;
|
||||
using Artemis.Models;
|
||||
@ -26,7 +24,8 @@ namespace Artemis.ViewModels.Abstract
|
||||
PFactory = pFactory;
|
||||
GameSettings = gameModel.Settings;
|
||||
|
||||
ProfileEditor = PFactory.CreateProfileEditorViewModel(Events, mainManager, gameModel);
|
||||
ProfileEditor = PFactory.CreateProfileEditorViewModel(Events, mainManager, gameModel,
|
||||
GameSettings.LastProfile);
|
||||
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||
Events.Subscribe(this);
|
||||
@ -91,14 +90,19 @@ namespace Artemis.ViewModels.Abstract
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != "SelectedProfile" && IsActive)
|
||||
return;
|
||||
|
||||
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||
ProfilePreviewModel.SelectedProfile = ProfileEditor.SelectedProfile;
|
||||
|
||||
if (e.PropertyName != "SelectedProfile" || !ProfileEditor.ProfileViewModel.Activated ||
|
||||
ProfileEditor.ProfileViewModel.SelectedProfile == null)
|
||||
return;
|
||||
GameSettings.LastProfile = ProfileEditor.ProfileViewModel.SelectedProfile.Name;
|
||||
GameSettings.Save();
|
||||
}
|
||||
|
||||
protected override void OnActivate()
|
||||
|
||||
@ -5,7 +5,6 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
@ -42,7 +41,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
private ProfileModel _selectedProfile;
|
||||
|
||||
public ProfileEditorViewModel(IEventAggregator events, MainManager mainManager, GameModel gameModel,
|
||||
ProfileViewModel profileViewModel, MetroDialogService dialogService)
|
||||
ProfileViewModel profileViewModel, MetroDialogService dialogService, string lastProfile)
|
||||
{
|
||||
_mainManager = mainManager;
|
||||
_gameModel = gameModel;
|
||||
@ -51,6 +50,7 @@ namespace Artemis.ViewModels.Profiles
|
||||
Layers = new BindableCollection<LayerModel>();
|
||||
ProfileViewModel = profileViewModel;
|
||||
DialogService = dialogService;
|
||||
LastProfile = lastProfile;
|
||||
|
||||
events.Subscribe(this);
|
||||
|
||||
@ -62,6 +62,8 @@ namespace Artemis.ViewModels.Profiles
|
||||
[Inject]
|
||||
public MetroDialogService DialogService { get; set; }
|
||||
|
||||
public string LastProfile { get; set; }
|
||||
|
||||
public ProfileViewModel ProfileViewModel { get; set; }
|
||||
|
||||
public bool EditorEnabled => SelectedProfile != null && !SelectedProfile.IsDefault;
|
||||
@ -233,7 +235,13 @@ namespace Artemis.ViewModels.Profiles
|
||||
return;
|
||||
|
||||
Profiles.AddRange(ProfileProvider.GetAll(_gameModel, _mainManager.DeviceManager.ActiveKeyboard));
|
||||
SelectedProfile = Profiles.FirstOrDefault();
|
||||
|
||||
// If a profile name was provided, try to load it
|
||||
ProfileModel lastProfileModel = null;
|
||||
if (!string.IsNullOrEmpty(LastProfile))
|
||||
lastProfileModel = Profiles.FirstOrDefault(p => p.Name == LastProfile);
|
||||
|
||||
SelectedProfile = lastProfileModel ?? Profiles.FirstOrDefault();
|
||||
}
|
||||
|
||||
public void EditLayer()
|
||||
|
||||
@ -64,10 +64,14 @@ namespace Artemis.ViewModels.Profiles
|
||||
|
||||
public ImageSource KeyboardImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return ImageUtilities.BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image);
|
||||
}
|
||||
get { return ImageUtilities.BitmapToBitmapImage(_deviceManager.ActiveKeyboard?.PreviewSettings.Image); }
|
||||
}
|
||||
|
||||
public bool Activated { get; set; }
|
||||
|
||||
public void Handle(ActiveKeyboardChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => KeyboardImage);
|
||||
}
|
||||
|
||||
private void InvokeUpdateKeyboardPreview(object sender, ElapsedEventArgs e)
|
||||
@ -77,11 +81,13 @@ namespace Artemis.ViewModels.Profiles
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
Activated = true;
|
||||
PreviewTimer.Start();
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
Activated = false;
|
||||
PreviewTimer.Stop();
|
||||
}
|
||||
|
||||
@ -300,10 +306,5 @@ namespace Artemis.ViewModels.Profiles
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Handle(ActiveKeyboardChanged message)
|
||||
{
|
||||
NotifyOfPropertyChange(() => KeyboardImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user