1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Merging some old code

This commit is contained in:
SpoinkyNL 2016-03-07 17:20:30 +01:00
commit 27660176a4
62 changed files with 6799 additions and 1185 deletions

View File

@ -199,7 +199,7 @@
<value>TypeWave</value>
</setting>
<setting name="LastKeyboard" serializeAs="String">
<value />
<value>Logitech G910 RGB</value>
</setting>
<setting name="EnablePointersUpdate" serializeAs="String">
<value>True</value>
@ -208,17 +208,11 @@
<value>51364</value>
</setting>
<setting name="Autorun" serializeAs="String">
<value>False</value>
<value>True</value>
</setting>
<setting name="Suspended" serializeAs="String">
<value>False</value>
</setting>
<setting name="ShowOnStartup" serializeAs="String">
<value>True</value>
</setting>
<setting name="CheckForUpdates" serializeAs="String">
<value>True</value>
</setting>
</Artemis.Settings.General>
</userSettings>
<runtime>

View File

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

View File

@ -16,8 +16,8 @@ namespace Artemis.KeyboardProviders.Corsair
public CorsairRGB()
{
Name = "Corsair RGB Keyboards";
CantEnableText = "Couldn't connect to your Corsair keyboard.\n" +
"Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n" +
CantEnableText = "Couldn't connect to your Corsair keyboard.\n " +
"Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " +
"If needed, you can select a different keyboard in Artemis under settings.";
KeyboardRegions = new List<KeyboardRegion>();
}
@ -103,6 +103,7 @@ namespace Artemis.KeyboardProviders.Corsair
/// <summary>
/// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap
/// size.
/// Does not reset the color each time. Uncomment line 48 for collor reset.
/// </summary>
/// <param name="bitmap"></param>
public override void DrawBitmap(Bitmap bitmap)

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using Artemis.KeyboardProviders.Logitech.Utilities;
namespace Artemis.KeyboardProviders.Logitech

View File

@ -10,10 +10,8 @@ namespace Artemis.Managers
{
public class EffectManager
{
private readonly IEventAggregator _events;
private readonly MainManager _mainManager;
private bool _clearing;
private EffectModel _pauseEffect;
private readonly IEventAggregator _events;
public EffectManager(MainManager mainManager, IEventAggregator events)
{
@ -25,6 +23,7 @@ namespace Artemis.Managers
public List<EffectModel> EffectModels { get; set; }
public EffectModel ActiveEffect { get; private set; }
public EffectModel PauseEffect { get; private set; }
public IEnumerable<OverlayModel> EnabledOverlays
{
@ -84,27 +83,27 @@ namespace Artemis.Managers
private void ChangeEffectWithPause(EffectModel effectModel)
{
if (_pauseEffect != null)
if (PauseEffect != null)
return;
_pauseEffect = effectModel;
PauseEffect = effectModel;
_mainManager.Pause();
_mainManager.PauseCallback += ChangeEffectPauseCallback;
_mainManager.PauseCallback += MainManagerOnPauseCallback;
}
private void ChangeEffectPauseCallback()
private void MainManagerOnPauseCallback()
{
// Change effect logic
ActiveEffect?.Dispose();
ActiveEffect = _pauseEffect;
ActiveEffect = PauseEffect;
ActiveEffect.Enable();
// Let the ViewModels know
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
PauseEffect = null;
_mainManager.Unpause();
_pauseEffect = null;
if (ActiveEffect is GameModel)
return;
@ -119,34 +118,18 @@ namespace Artemis.Managers
/// </summary>
public void ClearEffect()
{
if (_clearing)
return;
// Don't mess with the ActiveEffect if in the process of changing the effect.
if (_pauseEffect != null)
if (PauseEffect != null)
return;
if (ActiveEffect == null)
return;
_clearing = true;
_mainManager.Pause();
_mainManager.PauseCallback += ClearEffectPauseCallback;
}
private void ClearEffectPauseCallback()
{
ActiveEffect.Dispose();
ActiveEffect = null;
General.Default.LastEffect = null;
General.Default.Save();
_events.PublishOnUIThread(new ActiveEffectChanged(""));
_clearing = false;
_mainManager.Unpause();
}
/// <summary>

View File

@ -19,40 +19,29 @@ namespace Artemis.Managers
public List<KeyboardProvider> KeyboardProviders { get; set; }
public KeyboardProvider ActiveKeyboard { get; set; }
/// <summary>
/// Enables the last keyboard according to the settings file
/// </summary>
public void EnableLastKeyboard()
public bool LoadLastKeyboard()
{
if (General.Default.LastKeyboard == null)
return;
if (General.Default.LastKeyboard == "")
return;
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
EnableKeyboard(keyboard);
return ChangeKeyboard(keyboard ?? KeyboardProviders.First());
}
/// <summary>
/// Enables the given keyboard
/// </summary>
/// <param name="keyboardProvider"></param>
public void EnableKeyboard(KeyboardProvider keyboardProvider)
public bool ChangeKeyboard(KeyboardProvider keyboardProvider)
{
ReleaseActiveKeyboard();
if (keyboardProvider == null)
return;
return false;
if (ActiveKeyboard != null)
if (keyboardProvider.Name == ActiveKeyboard.Name)
return;
return true;
ReleaseActiveKeyboard();
// Disable everything if there's no active keyboard found
if (!keyboardProvider.CanEnable())
{
_mainManager.DialogService.ShowErrorMessageBox(keyboardProvider.CantEnableText);
return;
MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
ActiveKeyboard = keyboardProvider;
@ -60,11 +49,10 @@ namespace Artemis.Managers
General.Default.LastKeyboard = ActiveKeyboard.Name;
General.Default.Save();
return true;
}
/// <summary>
/// Releases the active keyboard
/// </summary>
public void ReleaseActiveKeyboard()
{
if (ActiveKeyboard == null)
@ -73,20 +61,5 @@ namespace Artemis.Managers
ActiveKeyboard.Disable();
ActiveKeyboard = null;
}
/// <summary>
/// Changes the active keyboard
/// </summary>
/// <param name="keyboardProvider"></param>
public void ChangeKeyboard(KeyboardProvider keyboardProvider)
{
if (keyboardProvider == ActiveKeyboard)
return;
General.Default.LastKeyboard = keyboardProvider?.Name;
General.Default.Save();
_mainManager.Restart();
}
}
}

View File

@ -2,9 +2,9 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using Artemis.Events;
using Artemis.Models;
using Artemis.Services;
using Artemis.Utilities.GameState;
using Artemis.Utilities.Keyboard;
using Caliburn.Micro;
@ -17,12 +17,10 @@ namespace Artemis.Managers
private readonly int _fps;
private bool _paused;
private bool _restarting;
public MainManager(IEventAggregator events, MetroDialogService dialogService)
public MainManager(IEventAggregator events)
{
Events = events;
DialogService = dialogService;
KeyboardManager = new KeyboardManager(this);
EffectManager = new EffectManager(this, Events);
@ -30,7 +28,7 @@ namespace Artemis.Managers
_fps = 25;
UpdateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
ProcessWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
ProcessWorker = new BackgroundWorker { WorkerSupportsCancellation = true };
UpdateWorker.DoWork += UpdateWorker_DoWork;
UpdateWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher;
@ -59,7 +57,6 @@ namespace Artemis.Managers
public GameStateWebServer GameStateWebServer { get; set; }
public IEventAggregator Events { get; set; }
public MetroDialogService DialogService { get; set; }
public bool ProgramEnabled { get; private set; }
public bool Suspended { get; set; }
@ -82,8 +79,7 @@ namespace Artemis.Managers
return true;
// Only continue if a keyboard was loaded
KeyboardManager.EnableLastKeyboard();
if (KeyboardManager.ActiveKeyboard == null)
if (!KeyboardManager.LoadLastKeyboard())
return false;
Running = true;
@ -133,41 +129,6 @@ namespace Artemis.Managers
PauseCallback = null;
}
public void Shutdown()
{
Stop();
ProcessWorker.CancelAsync();
GameStateWebServer.Stop();
}
public void Restart()
{
if (_restarting)
return;
if (!Running)
{
Start();
return;
}
_restarting = true;
UpdateWorker.RunWorkerCompleted += FinishRestart;
Stop();
}
public void FinishRestart(object sender, RunWorkerCompletedEventArgs e)
{
UpdateWorker.RunWorkerCompleted -= FinishRestart;
if (e.Error != null)
return;
Start();
_restarting = false;
}
/// <summary>
/// Loads the last active effect and starts the program
/// </summary>
@ -294,5 +255,12 @@ namespace Artemis.Managers
}
#endregion
public void Shutdown()
{
Stop();
ProcessWorker.CancelAsync();
GameStateWebServer.Stop();
}
}
}

View File

@ -8,10 +8,9 @@ namespace Artemis.Models
{
public delegate void SettingsUpdateHandler(EffectSettings settings);
public bool Initialized;
public MainManager MainManager;
public string Name;
public bool Initialized;
protected EffectModel(MainManager mainManager)
{

View File

@ -2,8 +2,15 @@
using System.Collections.Generic;
using System.Linq;
namespace Artemis.Utilities.Memory
namespace Artemis.Models
{
public class GamePointersCollectionModel
{
public string Game { get; set; }
public string GameVersion { get; set; }
public List<GamePointer> GameAddresses { get; set; }
}
public class GamePointer
{
public string Description { get; set; }
@ -16,11 +23,4 @@ namespace Artemis.Utilities.Memory
(current, offset) => current + $"+{offset.ToString("X")}");
}
}
public class GamePointersCollection
{
public string Game { get; set; }
public string GameVersion { get; set; }
public List<GamePointer> GameAddresses { get; set; }
}
}

View File

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

View File

@ -17,10 +17,10 @@ namespace Artemis.Modules.Effects.AudioVisualizer
{
private const int FftLength = 2048;
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
private bool _fromBottom;
private bool _generating;
private int _sensitivity;
private IWaveIn _waveIn;
private int _sensitivity;
private bool _fromBottom;
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
{
@ -118,7 +118,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
height = (int) Math.Round(SpectrumData[i]/2.55);
// Apply Sensitivity setting
height = height*_sensitivity;
height = height* _sensitivity;
var keyboardHeight =
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
if (keyboardHeight > SoundRectangles[i].Height)

View File

@ -38,7 +38,7 @@
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
ToolTip="Note: You can't enable an effect when Artemis is disabled" />
ToolTip="Note: You can't enable an effect when Artemis is disabled"/>
</StackPanel>
</StackPanel>
<!-- Top color -->

View File

@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
// Create effect model and add it to MainManager
EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add(EffectModel);
MainManager.EffectManager.EffectModels.Add((AudioVisualizerModel) EffectModel);
}
public static string Name => "Audio Visualizer";

View File

@ -37,7 +37,7 @@
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
ToolTip="Note: You can't enable an effect when Artemis is disabled"
ToolTipService.ShowOnDisabled="True" />
ToolTipService.ShowOnDisabled="True"/>
</StackPanel>
</StackPanel>

View File

@ -27,7 +27,7 @@ namespace Artemis.Modules.Effects.Debug
// Create effect model and add it to MainManager
EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add(EffectModel);
MainManager.EffectManager.EffectModels.Add((DebugEffectModel) EffectModel);
}

View File

@ -37,8 +37,7 @@
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
PopupAnimation="Fade" StaysOpen="False">
<Border Margin="1">
<TextBlock Background="{DynamicResource AccentColorBrush}"
Foreground="{DynamicResource IdealForegroundColorBrush}"
<TextBlock Background="{DynamicResource AccentColorBrush}" Foreground="{DynamicResource IdealForegroundColorBrush}"
Text="You can't enable an effect when Artemis is disabled" Padding="4" />
</Border>
</Popup>

View File

@ -15,7 +15,7 @@ namespace Artemis.Modules.Effects.TypeHole
// Create effect model and add it to MainManager
EffectModel = new TypeHoleModel(mainManager);
MainManager.EffectManager.EffectModels.Add(EffectModel);
MainManager.EffectManager.EffectModels.Add((TypeHoleModel) EffectModel);
}
public static string Name => "Type Holes (NYI)";

View File

@ -2,6 +2,7 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Artemis.KeyboardProviders.Corsair;
using Artemis.KeyboardProviders.Logitech.Utilities;
@ -23,33 +24,14 @@ namespace Artemis.Modules.Effects.TypeWave
_randomColor = Color.Red;
Settings = settings;
Initialized = false;
Scale = 4;
}
public int Scale { get; set; }
public TypeWaveSettings Settings { get; set; }
public override void Dispose()
{
Initialized = false;
MainManager.KeyboardHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback;
}
private void KeyboardHookOnKeyDownCallback(KeyEventArgs e)
{
// More than 25 waves is pointless
if (_waves.Count >= 25)
return;
var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode);
if (keyMatch == null)
return;
_waves.Add(Settings.IsRandomColors
? new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0, _randomColor)
: new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0,
ColorHelpers.ToDrawingColor(Settings.WaveColor)));
MainManager.KeyboardHook.Unsubscribe(HandleKeypress);
}
public override void Enable()
@ -57,7 +39,7 @@ namespace Artemis.Modules.Effects.TypeWave
Initialized = false;
// Listener won't start unless the effect is active
MainManager.KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
MainManager.KeyboardHook.Subscribe(HandleKeypress);
Initialized = true;
}
@ -72,7 +54,7 @@ namespace Artemis.Modules.Effects.TypeWave
// TODO: Get from settings
var fps = 25;
_waves[i].Size += Settings.SpreadSpeed * Scale;
_waves[i].Size += Settings.SpreadSpeed;
if (Settings.IsShiftColors)
_waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed);
@ -96,7 +78,7 @@ namespace Artemis.Modules.Effects.TypeWave
if (_waves.Count == 0)
return null;
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap();
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);
@ -134,6 +116,27 @@ namespace Artemis.Modules.Effects.TypeWave
}
return bitmap;
}
private void HandleKeypress(object sender, KeyEventArgs e)
{
Task.Factory.StartNew(() => KeyPressTask(e));
}
private void KeyPressTask(KeyEventArgs e)
{
// More than 25 waves is pointless
if (_waves.Count >= 25)
return;
var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode);
if (keyMatch == null)
return;
_waves.Add(Settings.IsRandomColors
? new Wave(new Point(keyMatch.PosX, keyMatch.PosY), 0, _randomColor)
: new Wave(new Point(keyMatch.PosX, keyMatch.PosY), 0,
ColorHelpers.ToDrawingColor(Settings.WaveColor)));
}
}
public class Wave

View File

@ -40,8 +40,7 @@
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
PopupAnimation="Fade" StaysOpen="False">
<Border Margin="1">
<TextBlock Background="{DynamicResource AccentColorBrush}"
Foreground="{DynamicResource IdealForegroundColorBrush}"
<TextBlock Background="{DynamicResource AccentColorBrush}" Foreground="{DynamicResource IdealForegroundColorBrush}"
Text="You can't enable an effect when Artemis is disabled" Padding="4" />
</Border>
</Popup>

View File

@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.TypeWave
// Create effect model and add it to MainManager
EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add(EffectModel);
MainManager.EffectManager.EffectModels.Add((TypeWaveModel) EffectModel);
}
public static string Name => "Type Waves";

View File

@ -1,7 +1,5 @@
<?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">

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,5 @@
<?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">

View File

@ -49,8 +49,6 @@ namespace Artemis.Modules.Games.RocketLeague
{
Initialized = false;
_contextualColor = Settings.ContextualColor;
_boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.MainColor),
@ -73,6 +71,7 @@ namespace Artemis.Modules.Games.RocketLeague
if (_memory == null)
return;
ContextualColor = Settings.ContextualColor;
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
var boostFloat = _memory.ReadFloat(boostAddress)*100/3;

View File

@ -3,13 +3,14 @@ using Artemis.Models;
namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueSettings : GameSettings
public class RocketLeagueSettings : EffectSettings
{
public RocketLeagueSettings()
{
Load();
}
public bool Enabled { get; set; }
public Color MainColor { get; set; }
public Color SecondaryColor { get; set; }
public bool ContextualColor { get; set; }

View File

@ -34,7 +34,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
IsChecked="{Binding Path=RocketLeagueSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
@ -46,7 +46,7 @@
Main boost display color
</TextBlock>
<xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=GameSettings.MainColor, Mode=TwoWay}"
SelectedColor="{Binding Path=RocketLeagueSettings.MainColor, Mode=TwoWay}"
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -56,7 +56,7 @@
Secondary boost display color
</TextBlock>
<xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=GameSettings.SecondaryColor, Mode=TwoWay}"
SelectedColor="{Binding Path=RocketLeagueSettings.SecondaryColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -65,7 +65,7 @@
Height="16" Margin="0,8">
Color bar according to boost amount
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ContextualColor, Mode=TwoWay}"
<controls:ToggleSwitch IsChecked="{Binding Path=RocketLeagueSettings.ContextualColor, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
@ -76,10 +76,9 @@
Tip: To find a color combination you like, start an exhibition match, pickup 100 boost and play around with the colors.
They'll appear on your keyboard immediately! Once you're satisfied don't forget to click save changes.
</TextBlock>
<TextBlock x:Name="VersionText" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
Margin="0,8"
<TextBlock x:Name="VersionText" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify" />
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify"/>
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">

View File

@ -1,14 +1,16 @@
using Artemis.Managers;
using Artemis.Models;
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
{
public class RocketLeagueViewModel : GameViewModel
public class RocketLeagueViewModel : Screen
{
private RocketLeagueSettings _rocketLeagueSettings;
private string _versionText;
public RocketLeagueViewModel(MainManager mainManager)
@ -16,17 +18,15 @@ namespace Artemis.Modules.Games.RocketLeague
MainManager = mainManager;
// Settings are loaded from file by class
GameSettings = new RocketLeagueSettings();
RocketLeagueSettings = new RocketLeagueSettings();
// Create effect model and add it to MainManager
GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
MainManager.EffectManager.EffectModels.Add(GameModel);
RocketLeagueModel = new RocketLeagueModel(mainManager, RocketLeagueSettings);
MainManager.EffectManager.EffectModels.Add(RocketLeagueModel);
SetVersionText();
}
public static string Name => "Rocket League";
public string VersionText
{
get { return _versionText; }
@ -38,8 +38,22 @@ namespace Artemis.Modules.Games.RocketLeague
}
}
public static string Name => "Rocket League";
public MainManager MainManager { get; set; }
public RocketLeagueModel RocketLeagueModel { get; set; }
public RocketLeagueSettings RocketLeagueSettings
{
get { return _rocketLeagueSettings; }
set
{
if (Equals(value, _rocketLeagueSettings)) return;
_rocketLeagueSettings = value;
NotifyOfPropertyChange(() => RocketLeagueSettings);
}
}
private void SetVersionText()
{
if (!General.Default.EnablePointersUpdate)
@ -51,10 +65,32 @@ namespace Artemis.Modules.Games.RocketLeague
Updater.GetPointers();
var version = JsonConvert
.DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague)
.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.RocketLeague)
.GameVersion;
VersionText = $"Note: Requires patch {version}. When a new patch is released Artemis downloads " +
"new pointers for the latest version (unless disabled in settings).";
}
public void SaveSettings()
{
if (RocketLeagueModel == null)
return;
RocketLeagueSettings.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
RocketLeagueSettings.ToDefault();
NotifyOfPropertyChange(() => RocketLeagueSettings);
SaveSettings();
}
public void ToggleEffect()
{
RocketLeagueModel.Enabled = _rocketLeagueSettings.Enabled;
}
}
}

View File

@ -1,7 +1,5 @@
<?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.Witcher3" GeneratedClassName="Witcher3">
<Profiles />
<Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

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

View File

@ -29,7 +29,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
IsChecked="{Binding Path=Witcher3Settings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>

View File

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

View File

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

View File

@ -1,5 +1,6 @@
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
using Artemis.Managers;
using Artemis.Models;
@ -24,13 +25,13 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public override void Dispose()
{
MainManager.KeyboardHook.KeyDownCallback -= KeyPressTask;
MainManager.KeyboardHook.Unsubscribe(HandleKeypress);
}
public override void Enable()
{
// Listener won't start unless the effect is active
MainManager.KeyboardHook.KeyDownCallback += KeyPressTask;
MainManager.KeyboardHook.Subscribe(HandleKeypress);
}
public override void Update()
@ -79,6 +80,11 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
return bitmap;
}
private void HandleKeypress(object sender, KeyEventArgs e)
{
Task.Factory.StartNew(() => KeyPressTask(e));
}
private void KeyPressTask(KeyEventArgs e)
{
if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown)

View File

@ -55,10 +55,10 @@
<xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=VolumeDisplaySettings.SecondaryColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22">
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" >
<xctk:ColorPicker.Template>
<ControlTemplate>
<Rectangle />
<Rectangle ></Rectangle>
</ControlTemplate>
</xctk:ColorPicker.Template>
</xctk:ColorPicker>

View File

@ -113,26 +113,6 @@ namespace Artemis.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon logo {
get {
object obj = ResourceManager.GetObject("logo", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon logo_disabled {
get {
object obj = ResourceManager.GetObject("logo_disabled", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /***********************************************************************/
////** © 2015 CD PROJEKT S.A. All rights reserved.

View File

@ -127,12 +127,6 @@
<data name="gamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo_disabled" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo-disabled.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="playerWitcherWs" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

View File

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

View File

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

View File

@ -37,7 +37,7 @@ namespace Artemis.Settings {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 RGB")]
public string LastKeyboard {
get {
return ((string)(this["LastKeyboard"]));
@ -73,7 +73,7 @@ namespace Artemis.Settings {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool Autorun {
get {
return ((bool)(this["Autorun"]));
@ -94,29 +94,5 @@ namespace Artemis.Settings {
this["Suspended"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ShowOnStartup {
get {
return ((bool)(this["ShowOnStartup"]));
}
set {
this["ShowOnStartup"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool CheckForUpdates {
get {
return ((bool)(this["CheckForUpdates"]));
}
set {
this["CheckForUpdates"] = value;
}
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using Artemis.Models;
using Artemis.Settings;
using Newtonsoft.Json;
namespace Artemis.Utilities.Memory
{

View File

@ -3,10 +3,9 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Artemis.Services;
using System.Windows.Forms;
using Artemis.Models;
using Artemis.Settings;
using Artemis.Utilities.Memory;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -14,27 +13,22 @@ namespace Artemis.Utilities
{
public static class Updater
{
public static int CurrentVersion = 102;
public static int CurrentVersion = 100;
public static async Task<Action> CheckForUpdate(MetroDialogService dialogService)
public static void CheckForUpdate()
{
if (!General.Default.CheckForUpdates)
return null;
var newRelease = IsUpdateAvailable();
if (newRelease == null)
return null;
return;
var viewUpdate = await
dialogService.ShowQuestionMessageBox("Update available",
var viewUpdate =
MessageBox.Show(
$"A new version of Artemis is available, version {newRelease["tag_name"].Value<string>()}.\n" +
"Do you wish to view the update on GitHub now?\n\n" +
"Note: You can disable update notifications in the settings menu");
if (viewUpdate.Value)
"Note: You can disable update notifications in the settings menu", "Artemis - Update available",
MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (viewUpdate == DialogResult.Yes)
Process.Start(new ProcessStartInfo(newRelease["html_url"].Value<string>()));
return null;
}
public static JObject IsUpdateAvailable()
@ -86,7 +80,7 @@ namespace Artemis.Utilities
"https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next());
// Get a list of pointers
var pointers = JsonConvert.DeserializeObject<List<GamePointersCollection>>(json);
var pointers = JsonConvert.DeserializeObject<List<GamePointersCollectionModel>>(json);
// Assign each pointer to the settings file
var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague"));
if (rlPointers != null)

View File

@ -61,15 +61,9 @@ namespace Artemis.ViewModels.Abstract
MainManager.EffectManager.ChangeEffect(EffectModel, true);
}
public async void ResetSettings()
public void ResetSettings()
{
var resetConfirm = await
MainManager.DialogService.ShowQuestionMessageBox("Reset effect settings",
"Are you sure you wish to reset this effect's settings? \nAny changes you made will be lost.");
if (!resetConfirm.Value)
return;
// TODO: Confirmation dialog (Generic MVVM approach)
EffectSettings.ToDefault();
NotifyOfPropertyChange(() => EffectSettings);

View File

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

View File

@ -8,9 +8,8 @@ using MahApps.Metro.Controls;
namespace Artemis.ViewModels.Flyouts
{
public class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled>, IHandle<ActiveEffectChanged>
public class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled>
{
private string _activeEffectName;
private bool _enabled;
private GeneralSettings _generalSettings;
private string _selectedKeyboardProvider;
@ -39,15 +38,7 @@ namespace Artemis.ViewModels.Flyouts
public MainManager MainManager { get; set; }
public BindableCollection<string> KeyboardProviders
{
get
{
var collection = new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders
.Select(k => k.Name));
collection.Insert(0, "None");
return collection;
}
}
=> new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders.Select(k => k.Name));
public string SelectedKeyboardProvider
{
@ -61,8 +52,7 @@ namespace Artemis.ViewModels.Flyouts
return;
MainManager.KeyboardManager.ChangeKeyboard(
MainManager.KeyboardManager.KeyboardProviders.FirstOrDefault(
k => k.Name == _selectedKeyboardProvider));
MainManager.KeyboardManager.KeyboardProviders.First(k => k.Name == _selectedKeyboardProvider));
}
}
@ -78,23 +68,6 @@ namespace Artemis.ViewModels.Flyouts
}
}
public string ActiveEffectName
{
get { return _activeEffectName; }
set
{
if (value == _activeEffectName) return;
_activeEffectName = value;
NotifyOfPropertyChange(() => ActiveEffectName);
}
}
public void Handle(ActiveEffectChanged message)
{
var effectDisplay = message.ActiveEffect.Length > 0 ? message.ActiveEffect : "none";
ActiveEffectName = $"Active effect: {effectDisplay}";
}
public void Handle(ToggleEnabled message)
{
NotifyOfPropertyChange(() => Enabled);
@ -126,9 +99,7 @@ namespace Artemis.ViewModels.Flyouts
protected override void HandleOpen()
{
SelectedKeyboardProvider = General.Default.LastKeyboard.Length > 0
? General.Default.LastKeyboard
: "None";
SelectedKeyboardProvider = MainManager.KeyboardManager.ActiveKeyboard?.Name;
}
}
}

View File

@ -1,6 +1,7 @@
using System.Linq;
using System;
using System.Linq;
using System.Windows;
using Artemis.Managers;
using Artemis.Services;
using Artemis.ViewModels.Flyouts;
using Caliburn.Micro;
@ -15,10 +16,8 @@ namespace Artemis.ViewModels
public ShellViewModel()
{
var dialogService = new MetroDialogService(this);
IEventAggregator events = new EventAggregator();
MainManager = new MainManager(events, dialogService);
MainManager = new MainManager(events);
DisplayName = "Artemis";
_welcomeVm = new WelcomeViewModel {DisplayName = "Welcome"};
@ -50,10 +49,5 @@ namespace Artemis.ViewModels
{
Flyouts.First().IsOpen = !Flyouts.First().IsOpen;
}
public void CloseSettings()
{
Flyouts.First().IsOpen = false;
}
}
}

View File

@ -1,10 +1,13 @@
using System;
using System.Windows;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Forms;
using Artemis.Events;
using Artemis.Properties;
using Artemis.Settings;
using Artemis.Utilities;
using Caliburn.Micro;
using Newtonsoft.Json.Linq;
using Application = System.Windows.Application;
using Screen = Caliburn.Micro.Screen;
namespace Artemis.ViewModels
{
@ -13,10 +16,17 @@ namespace Artemis.ViewModels
private readonly ShellViewModel _shellViewModel;
private readonly IWindowManager _windowManager;
private string _activeIcon;
private bool _checkedForUpdate;
private bool _enabled;
private string _toggleText;
/*
* NOTE: In this sample the system tray view-model doesn't receive any notification
* when the other window gets closed by pressing the top right 'x'.
* Thus no property notification is invoked, and system tray context-menu appears
* out of sync, still allowing 'Hide' and disabling 'Show'.
* Given the purpose of the sample - integrating Caliburn.Micro with WPF NotifyIcon -
* syncing the two view-models is not of interest here.
* */
public SystemTrayViewModel(IWindowManager windowManager, ShellViewModel shellViewModel)
{
@ -25,10 +35,8 @@ namespace Artemis.ViewModels
_shellViewModel.MainManager.Events.Subscribe(this);
_shellViewModel.MainManager.EnableProgram();
_checkedForUpdate = false;
//ActiveIcon = "../logo.ico";
if (General.Default.ShowOnStartup)
ShowWindow();
// TODO: Check if show on startup is enabled, if so, show window.
}
public bool CanShowWindow => !_shellViewModel.IsActive;
@ -44,21 +52,10 @@ namespace Artemis.ViewModels
_enabled = value;
ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis";
ActiveIcon = _enabled ? "../Resources/logo.ico" : "../Resources/logo-disabled.ico";
NotifyOfPropertyChange(() => Enabled);
}
}
public string ActiveIcon
{
get { return _activeIcon; }
set
{
_activeIcon = value;
NotifyOfPropertyChange();
}
}
public string ToggleText
{
get { return _toggleText; }
@ -96,17 +93,18 @@ namespace Artemis.ViewModels
if (!CanShowWindow)
return;
if (!_checkedForUpdate)
{
_checkedForUpdate = true;
var updateTask = new Task(Updater.CheckForUpdate);
updateTask.Start();
}
// manually show the next window view-model
_windowManager.ShowWindow(_shellViewModel);
NotifyOfPropertyChange(() => CanShowWindow);
NotifyOfPropertyChange(() => CanHideWindow);
if (_checkedForUpdate)
return;
_checkedForUpdate = true;
Updater.CheckForUpdate(_shellViewModel.MainManager.DialogService);
}

View File

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

View File

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

View File

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

View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

File diff suppressed because it is too large Load Diff

View File

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