diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj
index 3aea3a357..65678f065 100644
--- a/Artemis/Artemis/Artemis.csproj
+++ b/Artemis/Artemis/Artemis.csproj
@@ -360,17 +360,10 @@
-
-
-
-
+
-
- True
- True
- EurotruckSimulator2.settings
-
+
@@ -378,11 +371,6 @@
EurotruckSimulator2View.xaml
-
- True
- True
- UnrealTournament.settings
-
@@ -390,11 +378,6 @@
UnrealTournamentView.xaml
-
- True
- True
- WoW.settings
-
@@ -423,31 +406,16 @@
-
- AudioVisualization.settings
- True
- True
-
-
- True
- True
- Bubbles.settings
-
BubblesView.xaml
-
- True
- True
- WindowsProfile.settings
-
WindowsProfileView.xaml
@@ -457,37 +425,17 @@
-
- CounterStrike.settings
- True
- True
-
-
- True
- True
- Dota2.settings
-
OverwatchView.xaml
-
- RocketLeague.settings
- True
- True
-
-
- True
- True
- TheDivision.settings
-
@@ -496,21 +444,11 @@
-
- Overwatch.settings
- True
- True
-
-
- True
- True
- Witcher3.settings
-
@@ -520,7 +458,6 @@
VolumeDisplay.settings
-
@@ -553,13 +490,12 @@
+
+
-
- True
- True
- Offsets.settings
-
+
+
@@ -691,19 +627,7 @@
Code
-
- SettingsSingleFileGenerator
- EurotruckSimulator2.Designer.cs
-
-
- SettingsSingleFileGenerator
- UnrealTournament.Designer.cs
-
-
- SettingsSingleFileGenerator
- WoW.Designer.cs
-
Designer
@@ -714,42 +638,6 @@
Designer
Resources.Designer.cs
-
- SettingsSingleFileGenerator
- AudioVisualization.Designer.cs
-
-
- SettingsSingleFileGenerator
- Bubbles.Designer.cs
-
-
- SettingsSingleFileGenerator
- WindowsProfile.Designer.cs
-
-
- SettingsSingleFileGenerator
- CounterStrike.Designer.cs
-
-
- SettingsSingleFileGenerator
- Dota2.Designer.cs
-
-
- SettingsSingleFileGenerator
- RocketLeague.Designer.cs
-
-
- SettingsSingleFileGenerator
- TheDivision.Designer.cs
-
-
- SettingsSingleFileGenerator
- Overwatch.Designer.cs
-
-
- SettingsSingleFileGenerator
- Witcher3.Designer.cs
-
SettingsSingleFileGenerator
VolumeDisplay.Designer.cs
@@ -785,10 +673,6 @@
-
- SettingsSingleFileGenerator
- Offsets.Designer.cs
-
diff --git a/Artemis/Artemis/ArtemisBootstrapper.cs b/Artemis/Artemis/ArtemisBootstrapper.cs
index 46747daed..2a67236ec 100644
--- a/Artemis/Artemis/ArtemisBootstrapper.cs
+++ b/Artemis/Artemis/ArtemisBootstrapper.cs
@@ -22,7 +22,7 @@ namespace Artemis
public ArtemisBootstrapper()
{
// Start logging before anything else
- Logging.SetupLogging(SettingsProvider.Load("GeneralSettings").LogLevel);
+ Logging.SetupLogging(SettingsProvider.Load().LogLevel);
Initialize();
BindSpecialValues();
diff --git a/Artemis/Artemis/DAL/SettingsProvider.cs b/Artemis/Artemis/DAL/SettingsProvider.cs
index 138fb67d8..0e4ecfed6 100644
--- a/Artemis/Artemis/DAL/SettingsProvider.cs
+++ b/Artemis/Artemis/DAL/SettingsProvider.cs
@@ -20,15 +20,14 @@ namespace Artemis.DAL
///
/// Loads settings with the given name from the filesystem
///
- ///
///
- public static T Load(string name) where T : new()
+ public static T Load() where T : new()
{
if (!AreSettings(typeof(T)))
throw new ArgumentException("Type doesn't implement IArtemisSettings");
// Attempt to load from memory first
- var inMemory = Settings.FirstOrDefault(s => s.Name == name);
+ var inMemory = Settings.FirstOrDefault(s => s.GetType() == typeof(T));
if (inMemory != null)
return (T) inMemory;
@@ -37,20 +36,24 @@ namespace Artemis.DAL
try
{
var loadSettings = (IArtemisSettings) JsonConvert
- .DeserializeObject(File.ReadAllText(SettingsFolder + $@"\{name}.json"));
+ .DeserializeObject(File.ReadAllText(SettingsFolder + $@"\{typeof(T)}.json"));
+
if (loadSettings == null)
- SetToDefault(ref loadSettings);
+ {
+ loadSettings = (IArtemisSettings) new T();
+ loadSettings.Reset(true);
+ }
Settings.Add(loadSettings);
return (T) loadSettings;
}
catch (Exception e)
{
- Logger.Error(e, "Couldn't load settings '{0}.json'", name);
+ Logger.Error(e, "Couldn't load settings '{0}.json'", typeof(T));
// Not sure about this, I've seen prettier code
var loadSettings = (IArtemisSettings) new T();
- SetToDefault(ref loadSettings);
+ loadSettings.Reset(true);
Settings.Add(loadSettings);
return (T) loadSettings;
}
@@ -73,29 +76,27 @@ namespace Artemis.DAL
}
catch (Exception e)
{
- Logger.Error(e, "Couldn't save settings '{0}.json'", artemisSettings.Name);
+ Logger.Error(e, "Couldn't save settings '{0}.json'", artemisSettings.GetType());
return;
}
- File.WriteAllText(SettingsFolder + $@"\{artemisSettings.Name}.json", json);
+ File.WriteAllText(SettingsFolder + $@"\{artemisSettings.GetType()}.json", json);
}
///
- /// Restores the settings object to its default values
+ /// Ensures the settings folder exists
///
- ///
- public static void SetToDefault(ref IArtemisSettings settings)
- {
- // Loading the object from an empty JSON object makes Json.NET use all the default values
- settings = (IArtemisSettings) JsonConvert.DeserializeObject("{}", settings.GetType());
- }
-
private static void CheckSettings()
{
if (!Directory.Exists(SettingsFolder))
Directory.CreateDirectory(SettingsFolder);
}
+ ///
+ /// Checks to see if the given type is a setting
+ ///
+ ///
+ ///
private static bool AreSettings(Type t)
{
return typeof(IArtemisSettings).IsAssignableFrom(t);
diff --git a/Artemis/Artemis/Managers/DeviceManager.cs b/Artemis/Artemis/Managers/DeviceManager.cs
index d8f6dcb11..676d3da13 100644
--- a/Artemis/Artemis/Managers/DeviceManager.cs
+++ b/Artemis/Artemis/Managers/DeviceManager.cs
@@ -24,7 +24,7 @@ namespace Artemis.Managers
public DeviceManager(ILogger logger, List deviceProviders)
{
_logger = logger;
- _generalSettings = SettingsProvider.Load("GeneralSettings");
+ _generalSettings = SettingsProvider.Load();
KeyboardProviders = deviceProviders.Where(d => d.Type == DeviceType.Keyboard)
.Cast().ToList();
diff --git a/Artemis/Artemis/Managers/EffectManager.cs b/Artemis/Artemis/Managers/EffectManager.cs
index d0ae03983..ab23035e9 100644
--- a/Artemis/Artemis/Managers/EffectManager.cs
+++ b/Artemis/Artemis/Managers/EffectManager.cs
@@ -25,7 +25,7 @@ namespace Artemis.Managers
{
EffectModels = new List();
- _generalSettings = DAL.SettingsProvider.Load("GeneralSettings");
+ _generalSettings = DAL.SettingsProvider.Load();
_logger = logger;
_deviceManager = deviceManager;
diff --git a/Artemis/Artemis/Managers/MainManager.cs b/Artemis/Artemis/Managers/MainManager.cs
index 97276aa76..b0d8fe146 100644
--- a/Artemis/Artemis/Managers/MainManager.cs
+++ b/Artemis/Artemis/Managers/MainManager.cs
@@ -40,7 +40,7 @@ namespace Artemis.Managers
Running = false;
// Create and start the web server
- GameStateWebServer = new GameStateWebServer();
+ GameStateWebServer = new GameStateWebServer(logger);
GameStateWebServer.Start();
// Start the named pipe
diff --git a/Artemis/Artemis/Managers/ProfileManager.cs b/Artemis/Artemis/Managers/ProfileManager.cs
index 8d0d53f42..c44cb6f1a 100644
--- a/Artemis/Artemis/Managers/ProfileManager.cs
+++ b/Artemis/Artemis/Managers/ProfileManager.cs
@@ -16,6 +16,7 @@ namespace Artemis.Managers
private readonly EffectManager _effectManager;
private readonly ILogger _logger;
private readonly LoopManager _loopManager;
+ private GeneralSettings _generalSettings;
public ProfileManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager,
LoopManager loopManager)
@@ -24,6 +25,7 @@ namespace Artemis.Managers
_effectManager = effectManager;
_deviceManager = deviceManager;
_loopManager = loopManager;
+ _generalSettings = SettingsProvider.Load();
GameViewModels = new List();
@@ -45,7 +47,7 @@ namespace Artemis.Managers
///
private void SetupProfilePreview(object sender, ElapsedEventArgs e)
{
- if (string.IsNullOrEmpty(SettingsProvider.Load("GeneralSettings").LastKeyboard) || _deviceManager.ChangingKeyboard ||
+ if (string.IsNullOrEmpty(_generalSettings.LastKeyboard) || _deviceManager.ChangingKeyboard ||
ProfilePreviewModel == null)
return;
diff --git a/Artemis/Artemis/Models/EffectModel.cs b/Artemis/Artemis/Models/EffectModel.cs
index e24db72dc..c0ec5cbb6 100644
--- a/Artemis/Artemis/Models/EffectModel.cs
+++ b/Artemis/Artemis/Models/EffectModel.cs
@@ -8,6 +8,7 @@ using Artemis.Models.Interfaces;
using Artemis.Profiles;
using Artemis.Profiles.Layers.Interfaces;
using Artemis.Profiles.Layers.Models;
+using Artemis.Settings;
using Newtonsoft.Json;
namespace Artemis.Models
diff --git a/Artemis/Artemis/Models/EffectSettings.cs b/Artemis/Artemis/Models/EffectSettings.cs
deleted file mode 100644
index 98996df54..000000000
--- a/Artemis/Artemis/Models/EffectSettings.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace Artemis.Models
-{
- public abstract class EffectSettings
- {
- ///
- /// Loads the settings from the settings file
- ///
- public abstract void Load();
-
- ///
- /// Saves the settings to the settings file
- ///
- public abstract void Save();
-
- ///
- /// Returns the settings to their default value
- ///
- public abstract void ToDefault();
- }
-}
\ No newline at end of file
diff --git a/Artemis/Artemis/Models/GameModel.cs b/Artemis/Artemis/Models/GameModel.cs
index c5d6ad198..fc63cd2ca 100644
--- a/Artemis/Artemis/Models/GameModel.cs
+++ b/Artemis/Artemis/Models/GameModel.cs
@@ -1,5 +1,6 @@
using Artemis.Managers;
using Artemis.Models.Interfaces;
+using Artemis.Settings;
namespace Artemis.Models
{
diff --git a/Artemis/Artemis/Models/GamePointersCollectionModel.cs b/Artemis/Artemis/Models/GamePointersCollectionModel.cs
deleted file mode 100644
index 35279db50..000000000
--- a/Artemis/Artemis/Models/GamePointersCollectionModel.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Artemis.Models
-{
- public class GamePointersCollectionModel
- {
- public string Game { get; set; }
- public string GameVersion { get; set; }
- public List GameAddresses { get; set; }
- }
-
- public class GamePointer
- {
- public string Description { get; set; }
- public IntPtr BasePointer { get; set; }
- public int[] Offsets { get; set; }
-
- public override string ToString()
- {
- return Offsets.Aggregate(BasePointer.ToString("X"),
- (current, offset) => current + $"+{offset.ToString("X")}");
- }
- }
-}
\ No newline at end of file
diff --git a/Artemis/Artemis/Models/GameSettings.cs b/Artemis/Artemis/Models/GameSettings.cs
deleted file mode 100644
index fe026cfb4..000000000
--- a/Artemis/Artemis/Models/GameSettings.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Artemis.Models
-{
- public abstract class GameSettings : EffectSettings
- {
- public bool Enabled { get; set; }
- public string LastProfile { get; set; }
- }
-}
\ No newline at end of file
diff --git a/Artemis/Artemis/Models/Interfaces/GameDataModel.cs b/Artemis/Artemis/Models/Interfaces/IDataModel.cs
similarity index 94%
rename from Artemis/Artemis/Models/Interfaces/GameDataModel.cs
rename to Artemis/Artemis/Models/Interfaces/IDataModel.cs
index de39f4457..4e5a0ec07 100644
--- a/Artemis/Artemis/Models/Interfaces/GameDataModel.cs
+++ b/Artemis/Artemis/Models/Interfaces/IDataModel.cs
@@ -1,6 +1,6 @@
-namespace Artemis.Models.Interfaces
-{
- public interface IDataModel
- {
- }
+namespace Artemis.Models.Interfaces
+{
+ public interface IDataModel
+ {
+ }
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Models/OverlayModel.cs b/Artemis/Artemis/Models/OverlayModel.cs
index 631b20dfe..e5a58c602 100644
--- a/Artemis/Artemis/Models/OverlayModel.cs
+++ b/Artemis/Artemis/Models/OverlayModel.cs
@@ -1,4 +1,5 @@
using Artemis.Managers;
+using Artemis.Settings;
namespace Artemis.Models
{
diff --git a/Artemis/Artemis/Models/OverlaySettings.cs b/Artemis/Artemis/Models/OverlaySettings.cs
deleted file mode 100644
index e05df3d2a..000000000
--- a/Artemis/Artemis/Models/OverlaySettings.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Artemis.Models
-{
- public abstract class OverlaySettings : EffectSettings
- {
- public bool Enabled { get; set; }
- }
-}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.Designer.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.Designer.cs
deleted file mode 100644
index e5342a3e7..000000000
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.Designer.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Effects.AudioVisualizer {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class AudioVisualization : global::System.Configuration.ApplicationSettingsBase {
-
- private static AudioVisualization defaultInstance = ((AudioVisualization)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AudioVisualization())));
-
- public static AudioVisualization Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("4")]
- public int Sensitivity {
- get {
- return ((int)(this["Sensitivity"]));
- }
- set {
- this["Sensitivity"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("21")]
- public int Bars {
- get {
- return ((int)(this["Bars"]));
- }
- set {
- this["Bars"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool FromBottom {
- get {
- return ((bool)(this["FromBottom"]));
- }
- set {
- this["FromBottom"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("3")]
- public int FadeSpeed {
- get {
- return ((int)(this["FadeSpeed"]));
- }
- set {
- this["FadeSpeed"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("#FFF90000")]
- public global::System.Windows.Media.Color TopColor {
- get {
- return ((global::System.Windows.Media.Color)(this["TopColor"]));
- }
- set {
- this["TopColor"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("#FFFF761E")]
- public global::System.Windows.Media.Color MiddleColor {
- get {
- return ((global::System.Windows.Media.Color)(this["MiddleColor"]));
- }
- set {
- this["MiddleColor"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("#FF00DF00")]
- public global::System.Windows.Media.Color BottomColor {
- get {
- return ((global::System.Windows.Media.Color)(this["BottomColor"]));
- }
- set {
- this["BottomColor"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings
deleted file mode 100644
index aef505bd4..000000000
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
- 4
-
-
- 21
-
-
- True
-
-
- 3
-
-
- #FFF90000
-
-
- #FFFF761E
-
-
- #FF00DF00
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs
index fa3496fef..90ede32ce 100644
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs
+++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs
@@ -23,18 +23,16 @@ namespace Artemis.Modules.Effects.AudioVisualizer
private int _sensitivity;
private IWaveIn _waveIn;
- public AudioVisualizerModel(MainManager mainManager) : base(mainManager, new AudioVisualizerSettings(), null)
+ public AudioVisualizerModel(MainManager mainManager) : base(mainManager, null, null)
{
Name = "Audiovisualizer";
DeviceIds = new List();
SpectrumData = new List();
Initialized = false;
- Settings = (AudioVisualizerSettings) base.Settings;
}
public int Lines { get; set; }
-
- public new AudioVisualizerSettings Settings { get; set; }
+
public List SpectrumData { get; set; }
public List SoundRectangles { get; set; }
@@ -72,15 +70,15 @@ namespace Artemis.Modules.Effects.AudioVisualizer
MainManager.DeviceManager.ActiveKeyboard,
0, 0, new List
{
- ColorHelpers.ToDrawingColor(Settings.TopColor),
- ColorHelpers.ToDrawingColor(Settings.MiddleColor),
- ColorHelpers.ToDrawingColor(Settings.BottomColor)
+ Color.Red,
+ Color.Yellow,
+ Color.Lime
},
LinearGradientMode.Vertical)
{ContainedBrush = false, Height = 0});
}
- _sensitivity = Settings.Sensitivity;
- _fromBottom = Settings.FromBottom;
+ _sensitivity = 2;
+ _fromBottom = true;
_sampleAggregator.FftCalculated += FftCalculated;
_sampleAggregator.PerformFFT = true;
@@ -127,7 +125,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
SoundRectangles[i].Height = keyboardHeight;
else
SoundRectangles[i].Height = SoundRectangles[i].Height -
- Settings.FadeSpeed;
+ 5; // was FadeSpeed setting
// Apply Bars setting
SoundRectangles[i].X = i*KeyboardScale;
SoundRectangles[i].Width = KeyboardScale;
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs
deleted file mode 100644
index 7c965870c..000000000
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System.Windows.Media;
-using Artemis.Models;
-
-namespace Artemis.Modules.Effects.AudioVisualizer
-{
- public class AudioVisualizerSettings : EffectSettings
- {
- public AudioVisualizerSettings()
- {
- Load();
- }
-
- public int Sensitivity { get; set; }
- public int Bars { get; set; }
- public bool FromBottom { get; set; }
- public int FadeSpeed { get; set; }
- public Color TopColor { get; set; }
- public Color MiddleColor { get; set; }
- public Color BottomColor { get; set; }
-
- public sealed override void Load()
- {
- Sensitivity = AudioVisualization.Default.Sensitivity;
- Bars = AudioVisualization.Default.Bars;
- FromBottom = AudioVisualization.Default.FromBottom;
- FadeSpeed = AudioVisualization.Default.FadeSpeed;
- TopColor = AudioVisualization.Default.TopColor;
- MiddleColor = AudioVisualization.Default.MiddleColor;
- BottomColor = AudioVisualization.Default.BottomColor;
- }
-
- public sealed override void Save()
- {
- AudioVisualization.Default.Sensitivity = Sensitivity;
- AudioVisualization.Default.Bars = Bars;
- AudioVisualization.Default.FromBottom = FromBottom;
- AudioVisualization.Default.FadeSpeed = FadeSpeed;
- AudioVisualization.Default.TopColor = TopColor;
- AudioVisualization.Default.MiddleColor = MiddleColor;
- AudioVisualization.Default.BottomColor = BottomColor;
-
- AudioVisualization.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Sensitivity = 4;
- Bars = 21;
- FromBottom = true;
- FadeSpeed = 3;
- TopColor = Color.FromArgb(255, 249, 0, 0);
- MiddleColor = Color.FromArgb(255, 255, 118, 30);
- BottomColor = Color.FromArgb(255, 0, 223, 0);
- }
- }
-}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.Designer.cs b/Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.Designer.cs
deleted file mode 100644
index 6815b56a6..000000000
--- a/Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.Designer.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Effects.Bubbles {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class Bubbles : global::System.Configuration.ApplicationSettingsBase {
-
- private static Bubbles defaultInstance = ((Bubbles)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Bubbles())));
-
- public static Bubbles Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool IsRandomColors {
- get {
- return ((bool)(this["IsRandomColors"]));
- }
- set {
- this["IsRandomColors"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
- public global::System.Windows.Media.Color BubbleColor {
- get {
- return ((global::System.Windows.Media.Color)(this["BubbleColor"]));
- }
- set {
- this["BubbleColor"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool IsShiftColors {
- get {
- return ((bool)(this["IsShiftColors"]));
- }
- set {
- this["IsShiftColors"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("25")]
- public int BubbleSize {
- get {
- return ((int)(this["BubbleSize"]));
- }
- set {
- this["BubbleSize"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("4")]
- public int MoveSpeed {
- get {
- return ((int)(this["MoveSpeed"]));
- }
- set {
- this["MoveSpeed"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("12")]
- public int ShiftColorSpeed {
- get {
- return ((int)(this["ShiftColorSpeed"]));
- }
- set {
- this["ShiftColorSpeed"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("14")]
- public int BubbleCount {
- get {
- return ((int)(this["BubbleCount"]));
- }
- set {
- this["BubbleCount"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("25")]
- public int Smoothness {
- get {
- return ((int)(this["Smoothness"]));
- }
- set {
- this["Smoothness"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.settings b/Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.settings
deleted file mode 100644
index 748dada51..000000000
--- a/Artemis/Artemis/Modules/Effects/Bubbles/Bubbles.settings
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
- True
-
-
- #FFFF0000
-
-
- True
-
-
- 25
-
-
- 4
-
-
- 12
-
-
- 14
-
-
- 25
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/Bubbles/BubblesSettings.cs b/Artemis/Artemis/Modules/Effects/Bubbles/BubblesSettings.cs
index a6f264c67..17b4d9d37 100644
--- a/Artemis/Artemis/Modules/Effects/Bubbles/BubblesSettings.cs
+++ b/Artemis/Artemis/Modules/Effects/Bubbles/BubblesSettings.cs
@@ -1,60 +1,54 @@
-using System.Windows.Media;
-using Artemis.Models;
+using System.ComponentModel;
+using System.Windows.Media;
+using Artemis.DAL;
+using Artemis.Settings;
+using Newtonsoft.Json;
namespace Artemis.Modules.Effects.Bubbles
{
public class BubblesSettings : EffectSettings
{
- public BubblesSettings()
- {
- Load();
- }
-
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public bool IsRandomColors { get; set; }
+
public Color BubbleColor { get; set; }
+
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public bool IsShiftColors { get; set; }
+
+ [DefaultValue(12)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int ShiftColorSpeed { get; set; }
+
+ [DefaultValue(25)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int BubbleSize { get; set; }
+
+ [DefaultValue(4)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int MoveSpeed { get; set; }
+
+ [DefaultValue(14)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int BubbleCount { get; set; }
+
+ [DefaultValue(25)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int Smoothness { get; set; }
- public sealed override void Load()
+ public new void Reset(bool save = false)
{
- IsRandomColors = Bubbles.Default.IsRandomColors;
- BubbleColor = Bubbles.Default.BubbleColor;
- IsShiftColors = Bubbles.Default.IsShiftColors;
- ShiftColorSpeed = Bubbles.Default.ShiftColorSpeed;
- BubbleSize = Bubbles.Default.BubbleSize;
- MoveSpeed = Bubbles.Default.MoveSpeed;
- BubbleCount = Bubbles.Default.BubbleCount;
- Smoothness = Bubbles.Default.Smoothness;
- }
+ JsonConvert.PopulateObject("{}", this, new JsonSerializerSettings
+ {
+ ObjectCreationHandling = ObjectCreationHandling.Reuse
+ });
- public sealed override void Save()
- {
- Bubbles.Default.IsRandomColors = IsRandomColors;
- Bubbles.Default.BubbleColor = BubbleColor;
- Bubbles.Default.IsShiftColors = IsShiftColors;
- Bubbles.Default.ShiftColorSpeed = ShiftColorSpeed;
- Bubbles.Default.BubbleSize = BubbleSize;
- Bubbles.Default.MoveSpeed = MoveSpeed;
- Bubbles.Default.BubbleCount = BubbleCount;
- Bubbles.Default.Smoothness = Smoothness;
+ BubbleColor = Colors.Red;
- Bubbles.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- IsRandomColors = true;
- BubbleColor = Color.FromArgb(255, 255, 0, 0);
- IsShiftColors = true;
- ShiftColorSpeed = 12;
- BubbleSize = 25;
- MoveSpeed = 4;
- BubbleCount = 14;
- Smoothness = 25;
+ if (save)
+ SettingsProvider.Save(this);
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/WindowsProfile/PerformanceInfo.cs b/Artemis/Artemis/Modules/Effects/WindowsProfile/PerformanceInfo.cs
new file mode 100644
index 000000000..e807c6582
--- /dev/null
+++ b/Artemis/Artemis/Modules/Effects/WindowsProfile/PerformanceInfo.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Artemis.Modules.Effects.WindowsProfile
+{
+ internal static class PerformanceInfo
+ {
+ [DllImport("psapi.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool GetPerformanceInfo([Out] out PerformanceInformation performanceInformation,
+ [In] int size);
+
+ public static long GetPhysicalAvailableMemoryInMiB()
+ {
+ var pi = new PerformanceInformation();
+ if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))
+ return Convert.ToInt64(pi.PhysicalAvailable.ToInt64()*pi.PageSize.ToInt64()/1048576);
+ return -1;
+ }
+
+ public static long GetTotalMemoryInMiB()
+ {
+ var pi = new PerformanceInformation();
+ if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))
+ return Convert.ToInt64(pi.PhysicalTotal.ToInt64()*pi.PageSize.ToInt64()/1048576);
+ return -1;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct PerformanceInformation
+ {
+ public int Size;
+ public IntPtr CommitTotal;
+ public IntPtr CommitLimit;
+ public IntPtr CommitPeak;
+ public IntPtr PhysicalTotal;
+ public IntPtr PhysicalAvailable;
+ public IntPtr SystemCache;
+ public IntPtr KernelTotal;
+ public IntPtr KernelPaged;
+ public IntPtr KernelNonPaged;
+ public IntPtr PageSize;
+ public int HandlesCount;
+ public int ProcessCount;
+ public int ThreadCount;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfile.Designer.cs b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfile.Designer.cs
deleted file mode 100644
index 5e8a56c4d..000000000
--- a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfile.Designer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Effects.WindowsProfile {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class WindowsProfile : global::System.Configuration.ApplicationSettingsBase {
-
- private static WindowsProfile defaultInstance = ((WindowsProfile)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new WindowsProfile())));
-
- public static WindowsProfile Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Demo (Duplicate to keep changes)")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfile.settings b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfile.settings
deleted file mode 100644
index 4a88bb226..000000000
--- a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfile.settings
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
- Demo (Duplicate to keep changes)
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs
index 85b774605..03a355d14 100644
--- a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs
+++ b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileModel.cs
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -12,54 +12,6 @@ using SpotifyAPI.Local;
namespace Artemis.Modules.Effects.WindowsProfile
{
- internal static class PerformanceInfo
- {
- [DllImport("psapi.dll", SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool GetPerformanceInfo([Out] out PerformanceInformation performanceInformation,
- [In] int size);
-
- public static long GetPhysicalAvailableMemoryInMiB()
- {
- var pi = new PerformanceInformation();
- if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))
- {
- return Convert.ToInt64(pi.PhysicalAvailable.ToInt64()*pi.PageSize.ToInt64()/1048576);
- }
- return -1;
- }
-
- public static long GetTotalMemoryInMiB()
- {
- var pi = new PerformanceInformation();
- if (GetPerformanceInfo(out pi, Marshal.SizeOf(pi)))
- {
- return Convert.ToInt64(pi.PhysicalTotal.ToInt64()*pi.PageSize.ToInt64()/1048576);
- }
- return -1;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct PerformanceInformation
- {
- public int Size;
- public IntPtr CommitTotal;
- public IntPtr CommitLimit;
- public IntPtr CommitPeak;
- public IntPtr PhysicalTotal;
- public IntPtr PhysicalAvailable;
- public IntPtr SystemCache;
- public IntPtr KernelTotal;
- public IntPtr KernelPaged;
- public IntPtr KernelNonPaged;
- public IntPtr PageSize;
- public int HandlesCount;
- public int ProcessCount;
- public int ThreadCount;
- }
- }
-
-
public class WindowsProfileModel : EffectModel
{
private readonly ILogger _logger;
@@ -70,7 +22,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
private bool _spotifySetupBusy;
public WindowsProfileModel(ILogger logger, MainManager mainManager)
- : base(mainManager, new WindowsProfileSettings(), new WindowsProfileDataModel())
+ : base(mainManager, SettingsProvider.Load(), new WindowsProfileDataModel())
{
_logger = logger;
Name = "WindowsProfile";
@@ -133,7 +85,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
private void UpdateCpu(WindowsProfileDataModel dataModel)
{
- if (_cores == null || _overallCpu == null)
+ if ((_cores == null) || (_overallCpu == null))
return;
// CPU is only updated every 15 frames, the performance counter gives 0 if updated too often
diff --git a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileSettings.cs b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileSettings.cs
index a41551fe2..adff6e1e7 100644
--- a/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileSettings.cs
+++ b/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileSettings.cs
@@ -1,28 +1,8 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Effects.WindowsProfile
{
public class WindowsProfileSettings : GameSettings
{
- public WindowsProfileSettings()
- {
- Load();
- }
-
- public sealed override void Load()
- {
- LastProfile = WindowsProfile.Default.LastProfile;
- }
-
- public sealed override void Save()
- {
- WindowsProfile.Default.LastProfile = LastProfile;
-
- WindowsProfile.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrike.Designer.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrike.Designer.cs
deleted file mode 100644
index 85a966af8..000000000
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrike.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.CounterStrike {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class CounterStrike : global::System.Configuration.ApplicationSettingsBase {
-
- private static CounterStrike defaultInstance = ((CounterStrike)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new CounterStrike())));
-
- public static CounterStrike Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("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;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrike.settings b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrike.settings
deleted file mode 100644
index 2e32158e5..000000000
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrike.settings
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
index 339b88479..8a7893c5d 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -11,7 +12,8 @@ namespace Artemis.Modules.Games.CounterStrike
{
public class CounterStrikeModel : GameModel
{
- public CounterStrikeModel(MainManager mainManager): base(mainManager, new CounterStrikeSettings(), new CounterStrikeDataModel())
+ public CounterStrikeModel(MainManager mainManager)
+ : base(mainManager, SettingsProvider.Load(), new CounterStrikeDataModel())
{
Name = "CounterStrike";
ProcessName = "csgo";
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs
index 24b5699f1..cb5d20c9b 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeSettings.cs
@@ -1,35 +1,9 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.CounterStrike
{
public class CounterStrikeSettings : GameSettings
{
- public CounterStrikeSettings()
- {
- Load();
- }
-
public string GameDirectory { get; set; }
-
- public sealed override void Load()
- {
- Enabled = CounterStrike.Default.Enabled;
- LastProfile = CounterStrike.Default.LastProfile;
- GameDirectory = CounterStrike.Default.GameDirectory;
- }
-
- public sealed override void Save()
- {
- CounterStrike.Default.Enabled = Enabled;
- CounterStrike.Default.GameDirectory = GameDirectory;
-
- CounterStrike.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- GameDirectory = string.Empty;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
index db5dd161c..fe83e2708 100644
--- a/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/CounterStrike/CounterStrikeViewModel.cs
@@ -23,7 +23,7 @@ namespace Artemis.Modules.Games.CounterStrike
{
var gameSettings = (CounterStrikeSettings) GameSettings;
// If already propertly set up, don't do anything
- if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
+ if ((gameSettings.GameDirectory != null) && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
File.Exists(gameSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg"))
return;
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
deleted file mode 100644
index 1f692a740..000000000
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.Dota2 {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class Dota2 : global::System.Configuration.ApplicationSettingsBase {
-
- private static Dota2 defaultInstance = ((Dota2)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Dota2())));
-
- public static Dota2 Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string GameDirectory {
- get {
- return ((string)(this["GameDirectory"]));
- }
- set {
- this["GameDirectory"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
deleted file mode 100644
index c4c987d69..000000000
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs
index 26260e19d..1b42e6989 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -9,7 +10,8 @@ namespace Artemis.Modules.Games.Dota2
{
public class Dota2Model : GameModel
{
- public Dota2Model(MainManager mainManager): base(mainManager, new Dota2Settings(), new Dota2DataModel())
+ public Dota2Model(MainManager mainManager)
+ : base(mainManager, SettingsProvider.Load(), new Dota2DataModel())
{
Name = "Dota2";
ProcessName = "dota2";
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
index b57b5b478..771460b2a 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
@@ -1,36 +1,9 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.Dota2
{
internal class Dota2Settings : GameSettings
{
- public Dota2Settings()
- {
- Load();
- }
-
public string GameDirectory { get; set; }
-
-
- public sealed override void Load()
- {
- Enabled = Dota2.Default.Enabled;
- GameDirectory = Dota2.Default.GameDirectory;
- }
-
- public sealed override void Save()
- {
- Dota2.Default.Enabled = Enabled;
- Dota2.Default.LastProfile = LastProfile;
- Dota2.Default.GameDirectory = GameDirectory;
-
- Dota2.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- GameDirectory = string.Empty;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs
index e6dc67a59..659809370 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs
@@ -10,7 +10,8 @@ namespace Artemis.Modules.Games.Dota2
{
public sealed class Dota2ViewModel : GameViewModel
{
- public Dota2ViewModel(MainManager main, IProfileEditorVmFactory pFactory, Dota2Model model) : base(main, model, pFactory)
+ public Dota2ViewModel(MainManager main, IProfileEditorVmFactory pFactory, Dota2Model model)
+ : base(main, model, pFactory)
{
DisplayName = "Dota 2";
@@ -22,7 +23,7 @@ namespace Artemis.Modules.Games.Dota2
{
var gameSettings = (Dota2Settings) GameSettings;
// If already propertly set up, don't do anything
- if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
+ if ((gameSettings.GameDirectory != null) && File.Exists(gameSettings.GameDirectory + "csgo.exe") &&
File.Exists(gameSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg"))
return;
diff --git a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.Designer.cs b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.Designer.cs
deleted file mode 100644
index ca817dca5..000000000
--- a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.EurotruckSimulator2 {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class EurotruckSimulator2 : global::System.Configuration.ApplicationSettingsBase {
-
- private static EurotruckSimulator2 defaultInstance = ((EurotruckSimulator2)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new EurotruckSimulator2())));
-
- public static EurotruckSimulator2 Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string GameDirectory {
- get {
- return ((string)(this["GameDirectory"]));
- }
- set {
- this["GameDirectory"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.settings b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.settings
deleted file mode 100644
index 9a6ae97f9..000000000
--- a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2.settings
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
- True
-
-
- Default
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Model.cs b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Model.cs
index eaac24e99..e784be51d 100644
--- a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Model.cs
+++ b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Model.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -10,7 +11,8 @@ namespace Artemis.Modules.Games.EurotruckSimulator2
public class EurotruckSimulator2Model : GameModel
{
public EurotruckSimulator2Model(MainManager mainManager)
- : base(mainManager, new EurotruckSimulator2Settings(), new EurotruckSimulator2DataModel())
+ : base(mainManager, SettingsProvider.Load(), new EurotruckSimulator2DataModel()
+ )
{
Name = "EurotruckSimulator2";
ProcessName = "eurotrucks2";
diff --git a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Settings.cs b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Settings.cs
index 0db66dc85..575b1c698 100644
--- a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Settings.cs
+++ b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2Settings.cs
@@ -1,35 +1,9 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.EurotruckSimulator2
{
public class EurotruckSimulator2Settings : GameSettings
{
- public EurotruckSimulator2Settings()
- {
- Load();
- }
-
public string GameDirectory { get; set; }
-
- public sealed override void Load()
- {
- Enabled = EurotruckSimulator2.Default.Enabled;
- LastProfile = EurotruckSimulator2.Default.LastProfile;
- GameDirectory = EurotruckSimulator2.Default.GameDirectory;
- }
-
- public sealed override void Save()
- {
- EurotruckSimulator2.Default.Enabled = Enabled;
- EurotruckSimulator2.Default.GameDirectory = GameDirectory;
-
- EurotruckSimulator2.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- GameDirectory = string.Empty;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2ViewModel.cs b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2ViewModel.cs
index 899e1bff1..8c7571e0f 100644
--- a/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2ViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/EurotruckSimulator2/EurotruckSimulator2ViewModel.cs
@@ -9,7 +9,8 @@ namespace Artemis.Modules.Games.EurotruckSimulator2
{
public sealed class EurotruckSimulator2ViewModel : GameViewModel
{
- public EurotruckSimulator2ViewModel(MainManager main, IProfileEditorVmFactory pFactory, EurotruckSimulator2Model model): base(main, model, pFactory)
+ public EurotruckSimulator2ViewModel(MainManager main, IProfileEditorVmFactory pFactory,
+ EurotruckSimulator2Model model) : base(main, model, pFactory)
{
DisplayName = "ETS 2";
diff --git a/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.Designer.cs b/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.Designer.cs
deleted file mode 100644
index eafa814c5..000000000
--- a/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.Overwatch {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class Overwatch : global::System.Configuration.ApplicationSettingsBase {
-
- private static Overwatch defaultInstance = ((Overwatch)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Overwatch())));
-
- public static Overwatch Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string GameDirectory {
- get {
- return ((string)(this["GameDirectory"]));
- }
- set {
- this["GameDirectory"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.settings b/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.settings
deleted file mode 100644
index 2e6b121a0..000000000
--- a/Artemis/Artemis/Modules/Games/Overwatch/Overwatch.settings
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs
index 180015fe8..adfc83c35 100644
--- a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs
+++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchModel.cs
@@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Models.Interfaces;
using Artemis.Profiles.Layers.Models;
+using Artemis.Settings;
using Artemis.Utilities;
namespace Artemis.Modules.Games.Overwatch
@@ -21,7 +23,8 @@ namespace Artemis.Modules.Games.Overwatch
private DateTime _ultimateReady;
private DateTime _ultimateUsed;
- public OverwatchModel(MainManager mainManager): base(mainManager, new OverwatchSettings(), new OverwatchDataModel())
+ public OverwatchModel(MainManager mainManager)
+ : base(mainManager, SettingsProvider.Load(), new OverwatchDataModel())
{
Name = "Overwatch";
ProcessName = "Overwatch";
@@ -133,10 +136,10 @@ namespace Artemis.Modules.Games.Overwatch
// Ult can't possibly be ready within 2 seconds of changing, this avoids false positives.
// Filtering on ultReady and ultUsed removes false positives from the native ultimate effects
// The control keys don't show during character select, so don't continue on those either.
- if (_characterChange.AddSeconds(2) >= DateTime.Now ||
- _ultimateUsed.AddSeconds(2) >= DateTime.Now ||
- _ultimateReady.AddSeconds(2) >= DateTime.Now ||
- _stickyStatus.Value == OverwatchStatus.InCharacterSelect)
+ if ((_characterChange.AddSeconds(2) >= DateTime.Now) ||
+ (_ultimateUsed.AddSeconds(2) >= DateTime.Now) ||
+ (_ultimateReady.AddSeconds(2) >= DateTime.Now) ||
+ (_stickyStatus.Value == OverwatchStatus.InCharacterSelect))
return;
ParseSpecialKeys(gameDataModel, characterMatch, colors);
@@ -148,7 +151,7 @@ namespace Artemis.Modules.Games.Overwatch
if (string.IsNullOrEmpty(arrayString))
return null;
var intermediateArray = arrayString.Split('|');
- if (intermediateArray[0] == "1" || intermediateArray.Length < 2)
+ if ((intermediateArray[0] == "1") || (intermediateArray.Length < 2))
return null;
var array = intermediateArray[1].Substring(1).Split(' ');
if (!array.Any())
@@ -164,7 +167,7 @@ namespace Artemis.Modules.Games.Overwatch
// Can't parse to a byte directly since it may contain values >254
var parts = intermediate.Split(',').Select(int.Parse).ToArray();
- if (parts[0] >= 5 && parts[1] >= 21)
+ if ((parts[0] >= 5) && (parts[1] >= 21))
continue;
colors[parts[0], parts[1]] = Color.FromRgb((byte) parts[2], (byte) parts[3], (byte) parts[4]);
@@ -218,13 +221,13 @@ namespace Artemis.Modules.Games.Overwatch
private bool ControlsShown(Color[,] colors)
{
var keyColor = Color.FromRgb(222, 153, 0);
- return colors[2, 3] == keyColor || colors[3, 2] == keyColor ||
- colors[3, 3] == keyColor || colors[3, 4] == keyColor;
+ return (colors[2, 3] == keyColor) || (colors[3, 2] == keyColor) ||
+ (colors[3, 3] == keyColor) || (colors[3, 4] == keyColor);
}
private void ParseSpecialKeys(OverwatchDataModel gameDataModel, CharacterColor? characterMatch, Color[,] colors)
{
- if (characterMatch == null || characterMatch.Value.Character == OverwatchCharacter.None)
+ if ((characterMatch == null) || (characterMatch.Value.Character == OverwatchCharacter.None))
return;
// Ultimate is ready when Q is blinking
diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs
index 83c381737..bdee3b7c7 100644
--- a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs
+++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchSettings.cs
@@ -1,36 +1,9 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.Overwatch
{
public class OverwatchSettings : GameSettings
{
- public OverwatchSettings()
- {
- Load();
- }
-
public string GameDirectory { get; set; }
-
- 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 sealed override void ToDefault()
- {
- Enabled = true;
- GameDirectory = string.Empty;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchViewModel.cs b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchViewModel.cs
index faee1e9cf..5882f192a 100644
--- a/Artemis/Artemis/Modules/Games/Overwatch/OverwatchViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/Overwatch/OverwatchViewModel.cs
@@ -22,7 +22,7 @@ namespace Artemis.Modules.Games.Overwatch
{
var gameSettings = (OverwatchSettings) GameSettings;
// If already propertly set up, don't do anything
- if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "Overwatch.exe") &&
+ if ((gameSettings.GameDirectory != null) && File.Exists(gameSettings.GameDirectory + "Overwatch.exe") &&
File.Exists(gameSettings.GameDirectory + "RzChromaSDK64.dll"))
return;
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeague.Designer.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeague.Designer.cs
deleted file mode 100644
index 0606fb33e..000000000
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeague.Designer.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.RocketLeague {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class RocketLeague : global::System.Configuration.ApplicationSettingsBase {
-
- private static RocketLeague defaultInstance = ((RocketLeague)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new RocketLeague())));
-
- public static RocketLeague Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeague.settings b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeague.settings
deleted file mode 100644
index 38d736f51..000000000
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeague.settings
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs
index c69fb1cd8..32647e4bb 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueModel.cs
@@ -1,12 +1,12 @@
using System.Collections.Generic;
using System.Linq;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
using Artemis.Settings;
using Artemis.Utilities;
using Artemis.Utilities.Memory;
-using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague
{
@@ -16,7 +16,7 @@ namespace Artemis.Modules.Games.RocketLeague
private GamePointersCollection _pointer;
public RocketLeagueModel(MainManager mainManager)
- : base(mainManager, new RocketLeagueSettings(), new RocketLeagueDataModel())
+ : base(mainManager, SettingsProvider.Load(), new RocketLeagueDataModel())
{
Name = "RocketLeague";
ProcessName = "RocketLeague";
@@ -25,20 +25,20 @@ namespace Artemis.Modules.Games.RocketLeague
Initialized = false;
// Generate a new offset when the game is updated
- //var offset = new GamePointersCollection
- //{
- // Game = "RocketLeague",
- // GameVersion = "1.21",
- // GameAddresses = new List
- // {
- // new GamePointer
- // {
- // Description = "Boost",
- // BasePointer = new IntPtr(0x016AD528),
- // Offsets = new[] {0x304, 0x8, 0x50, 0x720, 0x224}
- // }
- // }
- //};
+// var offset = new GamePointersCollection
+// {
+// Game = "RocketLeague",
+// GameVersion = "1.21",
+// GameAddresses = new List
+// {
+// new GamePointer
+// {
+// Description = "Boost",
+// BasePointer = new IntPtr(0x016AD528),
+// Offsets = new[] {0x304, 0x8, 0x50, 0x720, 0x224}
+// }
+// }
+// };
//var res = JsonConvert.SerializeObject(offset, Formatting.Indented);
}
@@ -55,7 +55,7 @@ namespace Artemis.Modules.Games.RocketLeague
Initialized = false;
Updater.GetPointers();
- _pointer = JsonConvert.DeserializeObject(Offsets.Default.RocketLeague);
+ _pointer = SettingsProvider.Load().RocketLeague;
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
if (tempProcess == null)
@@ -68,7 +68,7 @@ namespace Artemis.Modules.Games.RocketLeague
public override void Update()
{
- if (Profile == null || DataModel == null || _memory == null)
+ if ((Profile == null) || (DataModel == null) || (_memory == null))
return;
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueSettings.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueSettings.cs
index f7d2f018e..38d0c3bfa 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueSettings.cs
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueSettings.cs
@@ -1,31 +1,8 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.RocketLeague
{
public class RocketLeagueSettings : GameSettings
{
- public RocketLeagueSettings()
- {
- Load();
- }
-
- public sealed override void Load()
- {
- Enabled = RocketLeague.Default.Enabled;
- LastProfile = RocketLeague.Default.LastProfile;
- }
-
- public sealed override void Save()
- {
- RocketLeague.Default.Enabled = Enabled;
- RocketLeague.Default.LastProfile = LastProfile;
-
- RocketLeague.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs
index dd0ec8217..35a90422c 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueViewModel.cs
@@ -1,10 +1,9 @@
-using Artemis.InjectionFactories;
+using Artemis.DAL;
+using Artemis.InjectionFactories;
using Artemis.Managers;
using Artemis.Settings;
using Artemis.Utilities;
-using Artemis.Utilities.Memory;
using Artemis.ViewModels.Abstract;
-using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague
{
@@ -12,7 +11,8 @@ namespace Artemis.Modules.Games.RocketLeague
{
private string _versionText;
- public RocketLeagueViewModel(MainManager main, IProfileEditorVmFactory pFactory, RocketLeagueModel model) : base(main, model, pFactory)
+ public RocketLeagueViewModel(MainManager main, IProfileEditorVmFactory pFactory, RocketLeagueModel model)
+ : base(main, model, pFactory)
{
DisplayName = "Rocket League";
SetVersionText();
@@ -33,7 +33,7 @@ namespace Artemis.Modules.Games.RocketLeague
private void SetVersionText()
{
- if (!DAL.SettingsProvider.Load("GeneralSettings").EnablePointersUpdate)
+ if (!SettingsProvider.Load().EnablePointersUpdate)
{
VersionText = "Note: You disabled pointer updates, this could result in the " +
"Rocket League effect not working after a game update.";
@@ -41,9 +41,7 @@ namespace Artemis.Modules.Games.RocketLeague
}
Updater.GetPointers();
- var version = JsonConvert
- .DeserializeObject(Offsets.Default.RocketLeague)
- .GameVersion;
+ var version = SettingsProvider.Load().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).";
}
diff --git a/Artemis/Artemis/Modules/Games/TheDivision/TheDivision.Designer.cs b/Artemis/Artemis/Modules/Games/TheDivision/TheDivision.Designer.cs
deleted file mode 100644
index 1898edec3..000000000
--- a/Artemis/Artemis/Modules/Games/TheDivision/TheDivision.Designer.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.TheDivision {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class TheDivision : global::System.Configuration.ApplicationSettingsBase {
-
- private static TheDivision defaultInstance = ((TheDivision)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new TheDivision())));
-
- public static TheDivision Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/TheDivision/TheDivision.settings b/Artemis/Artemis/Modules/Games/TheDivision/TheDivision.settings
deleted file mode 100644
index f4e38723a..000000000
--- a/Artemis/Artemis/Modules/Games/TheDivision/TheDivision.settings
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs b/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs
index fa1790d37..78555c95a 100644
--- a/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs
+++ b/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionModel.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -15,7 +16,7 @@ namespace Artemis.Modules.Games.TheDivision
private StickyValue _stickyHp;
public TheDivisionModel(MainManager mainManager)
- : base(mainManager, new TheDivisionSettings(), new TheDivisionDataModel())
+ : base(mainManager, SettingsProvider.Load(), new TheDivisionDataModel())
{
Name = "TheDivision";
ProcessName = "TheDivision";
@@ -81,7 +82,7 @@ namespace Artemis.Modules.Games.TheDivision
var bPer = parts[4];
// F1 to F4 indicate the player and his party. Blinks red on damage taken
- if (keyCode >= 59 && keyCode <= 62)
+ if ((keyCode >= 59) && (keyCode <= 62))
{
var playerId = keyCode - 58;
@@ -105,15 +106,15 @@ namespace Artemis.Modules.Games.TheDivision
// R blinks white when low on ammo
else if (keyCode == 19)
{
- _stickyAmmo.Value = rPer == 100 && gPer > 1 && bPer > 1;
+ _stickyAmmo.Value = (rPer == 100) && (gPer > 1) && (bPer > 1);
gameDataModel.LowAmmo = _stickyAmmo.Value;
}
// G turns white when holding a grenade, turns off when out of grenades
else if (keyCode == 34)
{
- if (rPer == 100 && gPer < 10 && bPer < 10)
+ if ((rPer == 100) && (gPer < 10) && (bPer < 10))
gameDataModel.GrenadeState = GrenadeState.HasGrenade;
- else if (rPer == 100 && gPer > 10 && bPer > 10)
+ else if ((rPer == 100) && (gPer > 10) && (bPer > 10))
gameDataModel.GrenadeState = GrenadeState.GrenadeEquipped;
else
gameDataModel.GrenadeState = GrenadeState.HasNoGrenade;
@@ -121,7 +122,7 @@ namespace Artemis.Modules.Games.TheDivision
// V blinks on low HP
else if (keyCode == 47)
{
- _stickyHp.Value = rPer == 100 && gPer > 1 && bPer > 1;
+ _stickyHp.Value = (rPer == 100) && (gPer > 1) && (bPer > 1);
gameDataModel.LowHp = _stickyHp.Value;
}
}
diff --git a/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionSettings.cs b/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionSettings.cs
index c0af8190b..c3f0c2ea1 100644
--- a/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionSettings.cs
+++ b/Artemis/Artemis/Modules/Games/TheDivision/TheDivisionSettings.cs
@@ -1,31 +1,8 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.TheDivision
{
public class TheDivisionSettings : GameSettings
{
- public TheDivisionSettings()
- {
- Load();
- }
-
- 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();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournament.Designer.cs b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournament.Designer.cs
deleted file mode 100644
index 1458db06a..000000000
--- a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournament.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.UnrealTournament {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class UnrealTournament : global::System.Configuration.ApplicationSettingsBase {
-
- private static UnrealTournament defaultInstance = ((UnrealTournament)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new UnrealTournament())));
-
- public static UnrealTournament Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string GameDirectory {
- get {
- return ((string)(this["GameDirectory"]));
- }
- set {
- this["GameDirectory"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournament.settings b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournament.settings
deleted file mode 100644
index 8052f2dea..000000000
--- a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournament.settings
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentDataModel.cs b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentDataModel.cs
index aa2deb1b9..5d611805c 100644
--- a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentDataModel.cs
+++ b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentDataModel.cs
@@ -32,17 +32,25 @@ namespace Artemis.Modules.Games.UnrealTournament
public string PlayerName { get; set; }
public string UniqueId { get; set; }
public int Score { get; set; }
+
[JsonProperty("Team Num")]
public int TeamNum { get; set; }
+
public int RankCheck { get; set; }
+
[JsonProperty("Duel Rank")]
public int DuelRank { get; set; }
+
public int No_of_Duel_Played { get; set; }
+
[JsonProperty("CTF Rank")]
public int CTFRank { get; set; }
+
public int No_CTF_MatchesPlayed { get; set; }
+
[JsonProperty("TDM Rank")]
public int TDMRank { get; set; }
+
public int No_TDM_MatchesPlayed { get; set; }
public int DMRank { get; set; }
public int No_DM_Matches_Played { get; set; }
@@ -100,5 +108,4 @@ namespace Artemis.Modules.Games.UnrealTournament
public int RespawnWaitTime { get; set; }
public int ForceRespawnTime { get; set; }
}
-
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentModel.cs b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentModel.cs
index a1863c2f9..41a36ea29 100644
--- a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentModel.cs
+++ b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -9,8 +10,8 @@ namespace Artemis.Modules.Games.UnrealTournament
{
public class UnrealTournamentModel : GameModel
{
- public UnrealTournamentModel(MainManager mainManager, UnrealTournamentSettings settings)
- : base(mainManager, settings, new UnrealTournamentDataModel())
+ public UnrealTournamentModel(MainManager mainManager)
+ : base(mainManager, SettingsProvider.Load(), new UnrealTournamentDataModel())
{
Name = "UnrealTournament";
ProcessName = "UE4-Win64-Shipping";
diff --git a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentSettings.cs b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentSettings.cs
index 9b27c884a..6de639c81 100644
--- a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentSettings.cs
+++ b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentSettings.cs
@@ -1,36 +1,9 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.UnrealTournament
{
public class UnrealTournamentSettings : GameSettings
{
- public UnrealTournamentSettings()
- {
- Load();
- }
-
public string GameDirectory { get; set; }
-
- public sealed override void Load()
- {
- Enabled = UnrealTournament.Default.Enabled;
- LastProfile = UnrealTournament.Default.LastProfile;
- GameDirectory = UnrealTournament.Default.GameDirectory;
- }
-
- public sealed override void Save()
- {
- UnrealTournament.Default.Enabled = Enabled;
- UnrealTournament.Default.LastProfile = LastProfile;
- UnrealTournament.Default.GameDirectory = GameDirectory;
-
- UnrealTournament.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- GameDirectory = string.Empty;
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentViewModel.cs b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentViewModel.cs
index f7b67bb27..77f15e532 100644
--- a/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/UnrealTournament/UnrealTournamentViewModel.cs
@@ -32,7 +32,8 @@ namespace Artemis.Modules.Games.UnrealTournament
{
var gameSettings = (UnrealTournamentSettings) GameSettings;
// If already propertly set up, don't do anything
- if (gameSettings.GameDirectory != null && File.Exists(gameSettings.GameDirectory + "UE4-Win64-Shipping.exe"))
+ if ((gameSettings.GameDirectory != null) &&
+ File.Exists(gameSettings.GameDirectory + "UE4-Win64-Shipping.exe"))
return;
// Attempt to read the file
@@ -119,7 +120,8 @@ namespace Artemis.Modules.Games.UnrealTournament
{
var gif = Resources.redeemer;
ProfileProvider.InsertGif(ProfileProvider.GetAll()
- .Where(p => p.GameName == "UnrealTournament" && p.Name == "Default"), "Redeemer GIF", gif, "redeemer");
+ .Where(p => (p.GameName == "UnrealTournament") && (p.Name == "Default")), "Redeemer GIF", gif,
+ "redeemer");
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3.Designer.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3.Designer.cs
deleted file mode 100644
index 03c4b50bb..000000000
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3.Designer.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.Witcher3 {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class Witcher3 : global::System.Configuration.ApplicationSettingsBase {
-
- private static Witcher3 defaultInstance = ((Witcher3)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Witcher3())));
-
- public static Witcher3 Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [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;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3.settings b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3.settings
deleted file mode 100644
index 6078fcd0f..000000000
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3.settings
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs
index 2044dc1d8..57d735a93 100644
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs
+++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Model.cs
@@ -4,6 +4,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
+using Artemis.DAL;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Profiles.Layers.Models;
@@ -17,7 +18,7 @@ namespace Artemis.Modules.Games.Witcher3
private string _witcherSettings;
public Witcher3Model(MainManager mainManager)
- : base(mainManager, new Witcher3Settings(), new Witcher3DataModel())
+ : base(mainManager, SettingsProvider.Load(), new Witcher3DataModel())
{
Name = "Witcher3";
ProcessName = "witcher3";
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Settings.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Settings.cs
index 5e882446c..af2173169 100644
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Settings.cs
+++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3Settings.cs
@@ -1,31 +1,10 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.Witcher3
{
public class Witcher3Settings : GameSettings
{
- public Witcher3Settings()
- {
- Load();
- }
-
- 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();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- }
+ // TODO: Change this to work the same as UT
+ public string GameDirectory { get; set; }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs
index df2560740..5c6b00472 100644
--- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3ViewModel.cs
@@ -60,8 +60,6 @@ namespace Artemis.Modules.Games.Witcher3
Directory.GetFiles(dialog.SelectedPath + @"\mods", "playerWitcher.ws", SearchOption.AllDirectories)
.FirstOrDefault();
if (file != null)
- {
- // Don't trip over our own mod
if (!file.Contains("modArtemis"))
{
var viewHelp = await
@@ -82,7 +80,6 @@ namespace Artemis.Modules.Games.Witcher3
new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
return;
}
- }
}
archive.ExtractToDirectory(dialog.SelectedPath, true);
diff --git a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoW.Designer.cs b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoW.Designer.cs
deleted file mode 100644
index 42350d4e9..000000000
--- a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoW.Designer.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Modules.Games.WorldofWarcraft {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class WoW : global::System.Configuration.ApplicationSettingsBase {
-
- private static WoW defaultInstance = ((WoW)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new WoW())));
-
- public static WoW Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Enabled {
- get {
- return ((bool)(this["Enabled"]));
- }
- set {
- this["Enabled"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Default")]
- public string LastProfile {
- get {
- return ((string)(this["LastProfile"]));
- }
- set {
- this["LastProfile"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoW.settings b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoW.settings
deleted file mode 100644
index db9c19f89..000000000
--- a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoW.settings
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- True
-
-
- Default
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWModel.cs b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWModel.cs
index 07f854eda..b2d33b702 100644
--- a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWModel.cs
+++ b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWModel.cs
@@ -10,7 +10,7 @@
// {
// private Memory _memory;
//
-// public WoWModel(MainManager mainManager): base(mainManager, new WoWSettings(), new WoWDataModel())
+// public WoWModel(MainManager mainManager): base(mainManager, SettingsProvider.Load(), new WoWDataModel())
// {
// Name = "WoW";
// ProcessName = "Wow-64";
@@ -50,4 +50,5 @@
// return Profile.GetRenderLayers(DataModel, keyboardOnly);
// }
// }
-//}
\ No newline at end of file
+//}
+
diff --git a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWSettings.cs b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWSettings.cs
index 7c04d9de0..1672b160d 100644
--- a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWSettings.cs
+++ b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWSettings.cs
@@ -1,31 +1,11 @@
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Games.WorldofWarcraft
{
public class WoWSettings : GameSettings
{
- public WoWSettings()
+ private WoWSettings()
{
- Load();
- }
-
- public sealed override void Load()
- {
- Enabled = WoW.Default.Enabled;
- LastProfile = WoW.Default.LastProfile;
- }
-
- public sealed override void Save()
- {
- WoW.Default.Enabled = Enabled;
- WoW.Default.LastProfile = LastProfile;
-
- WoW.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWViewModel.cs b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWViewModel.cs
index b32a08b04..143875c80 100644
--- a/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/WorldofWarcraft/WoWViewModel.cs
@@ -11,4 +11,5 @@
// DisplayName = "WoW";
// }
// }
-//}
\ No newline at end of file
+//}
+
diff --git a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplaySettings.cs b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplaySettings.cs
index c84c530cf..a67eb0d12 100644
--- a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplaySettings.cs
+++ b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplaySettings.cs
@@ -1,39 +1,11 @@
using System.Windows.Media;
-using Artemis.Models;
+using Artemis.Settings;
namespace Artemis.Modules.Overlays.VolumeDisplay
{
public class VolumeDisplaySettings : OverlaySettings
{
- public VolumeDisplaySettings()
- {
- Load();
- }
-
public Color MainColor { get; set; }
public Color SecondaryColor { get; set; }
-
- public sealed override void Load()
- {
- Enabled = VolumeDisplay.Default.Enabled;
- MainColor = VolumeDisplay.Default.MainColor;
- SecondaryColor = VolumeDisplay.Default.SecondaryColor;
- }
-
- public sealed override void Save()
- {
- VolumeDisplay.Default.Enabled = Enabled;
- VolumeDisplay.Default.MainColor = MainColor;
- VolumeDisplay.Default.SecondaryColor = SecondaryColor;
-
- VolumeDisplay.Default.Save();
- }
-
- public sealed override void ToDefault()
- {
- Enabled = true;
- MainColor = Color.FromArgb(255, 38, 246, 0);
- SecondaryColor = Color.FromArgb(255, 255, 41, 0);
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/EffectSettings.cs b/Artemis/Artemis/Settings/EffectSettings.cs
new file mode 100644
index 000000000..99255a3ab
--- /dev/null
+++ b/Artemis/Artemis/Settings/EffectSettings.cs
@@ -0,0 +1,24 @@
+using Artemis.DAL;
+using Newtonsoft.Json;
+
+namespace Artemis.Settings
+{
+ public class EffectSettings : IArtemisSettings
+ {
+ public void Save()
+ {
+ SettingsProvider.Save(this);
+ }
+
+ public void Reset(bool save = false)
+ {
+ JsonConvert.PopulateObject("{}", this, new JsonSerializerSettings
+ {
+ ObjectCreationHandling = ObjectCreationHandling.Reuse
+ });
+
+ if (save)
+ SettingsProvider.Save(this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/GameSettings.cs b/Artemis/Artemis/Settings/GameSettings.cs
new file mode 100644
index 000000000..3ed293c84
--- /dev/null
+++ b/Artemis/Artemis/Settings/GameSettings.cs
@@ -0,0 +1,16 @@
+using System.ComponentModel;
+using Newtonsoft.Json;
+
+namespace Artemis.Settings
+{
+ public abstract class GameSettings : EffectSettings
+ {
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool Enabled { get; set; }
+
+ [DefaultValue("Default")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public string LastProfile { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/GeneralSettings.cs b/Artemis/Artemis/Settings/GeneralSettings.cs
index 9ca827b2a..41a8738c3 100644
--- a/Artemis/Artemis/Settings/GeneralSettings.cs
+++ b/Artemis/Artemis/Settings/GeneralSettings.cs
@@ -6,6 +6,7 @@ using System.Runtime.InteropServices.ComTypes;
using System.Windows;
using Artemis.DAL;
using Artemis.Utilities;
+using Caliburn.Micro;
using MahApps.Metro;
using Newtonsoft.Json;
@@ -16,7 +17,6 @@ namespace Artemis.Settings
public GeneralSettings()
{
ThemeManager.AddAccent("CorsairYellow", new Uri("pack://application:,,,/Styles/Accents/CorsairYellow.xaml"));
- ApplyTheme();
}
[DefaultValue("WindowsProfile")]
@@ -59,8 +59,6 @@ namespace Artemis.Settings
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public string LogLevel { get; set; }
- public string Name { get; } = "GeneralSettings";
-
public void Save()
{
SettingsProvider.Save(this);
@@ -70,6 +68,17 @@ namespace Artemis.Settings
Logging.SetupLogging(LogLevel);
}
+ public void Reset(bool save = false)
+ {
+ JsonConvert.PopulateObject("{}", this, new JsonSerializerSettings
+ {
+ ObjectCreationHandling = ObjectCreationHandling.Reuse
+ });
+
+ if (save)
+ SettingsProvider.Save(this);
+ }
+
private void ApplyGamestatePort()
{
// TODO: Restart Gamestate server with new port
@@ -90,27 +99,30 @@ namespace Artemis.Settings
File.Delete(startupFolder + @"\Artemis.lnk");
}
- private void ApplyTheme()
+ public void ApplyTheme()
{
- switch (Theme)
+ Execute.OnUIThread(delegate
{
- case "Light":
- ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Teal"),
- ThemeManager.GetAppTheme("BaseLight"));
- break;
- case "Dark":
- ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Teal"),
- ThemeManager.GetAppTheme("BaseDark"));
- break;
- case "Corsair Light":
- ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("CorsairYellow"),
- ThemeManager.GetAppTheme("BaseLight"));
- break;
- case "Corsair Dark":
- ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("CorsairYellow"),
- ThemeManager.GetAppTheme("BaseDark"));
- break;
- }
+ switch (Theme)
+ {
+ case "Light":
+ ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Teal"),
+ ThemeManager.GetAppTheme("BaseLight"));
+ break;
+ case "Dark":
+ ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Teal"),
+ ThemeManager.GetAppTheme("BaseDark"));
+ break;
+ case "Corsair Light":
+ ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("CorsairYellow"),
+ ThemeManager.GetAppTheme("BaseLight"));
+ break;
+ case "Corsair Dark":
+ ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("CorsairYellow"),
+ ThemeManager.GetAppTheme("BaseDark"));
+ break;
+ }
+ });
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/IArtemisSettings.cs b/Artemis/Artemis/Settings/IArtemisSettings.cs
index a40b3bae2..bdba87ea7 100644
--- a/Artemis/Artemis/Settings/IArtemisSettings.cs
+++ b/Artemis/Artemis/Settings/IArtemisSettings.cs
@@ -2,7 +2,16 @@
{
public interface IArtemisSettings
{
- string Name { get; }
+ ///
+ /// Utility method for quickly saving this instance of settings.
+ /// Some settings might wrap logic around this
+ ///
void Save();
+
+ ///
+ /// Resets this settings instance to its default values
+ ///
+ /// Save the settings after resetting them
+ void Reset(bool save = false);
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/OffsetSettings.cs b/Artemis/Artemis/Settings/OffsetSettings.cs
new file mode 100644
index 000000000..68ec07922
--- /dev/null
+++ b/Artemis/Artemis/Settings/OffsetSettings.cs
@@ -0,0 +1,27 @@
+using Artemis.DAL;
+using Artemis.Utilities.Memory;
+using Newtonsoft.Json;
+
+namespace Artemis.Settings
+{
+ public class OffsetSettings : IArtemisSettings
+ {
+ public GamePointersCollection RocketLeague { get; set; }
+
+ public void Save()
+ {
+ SettingsProvider.Save(this);
+ }
+
+ public void Reset(bool save = false)
+ {
+ JsonConvert.PopulateObject("{}", this, new JsonSerializerSettings
+ {
+ ObjectCreationHandling = ObjectCreationHandling.Reuse
+ });
+
+ if (save)
+ SettingsProvider.Save(this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/Offsets.Designer.cs b/Artemis/Artemis/Settings/Offsets.Designer.cs
deleted file mode 100644
index 151411864..000000000
--- a/Artemis/Artemis/Settings/Offsets.Designer.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Artemis.Settings {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
- internal sealed partial class Offsets : global::System.Configuration.ApplicationSettingsBase {
-
- private static Offsets defaultInstance = ((Offsets)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Offsets())));
-
- public static Offsets Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("{\"Game\":\"RocketLeague\",\"GameVersion\":\"1.10\",\"GameAddresses\":[{\"Description\":\"Boos" +
- "t\",\"BasePointer\":{\"value\":21998084},\"Offsets\":[88,1452,1780,540]}]}")]
- public string RocketLeague {
- get {
- return ((string)(this["RocketLeague"]));
- }
- set {
- this["RocketLeague"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("{\"Game\":\"Witcher3\",\"GameVersion\":\"1.11\",\"GameAddresses\":[{\"Description\":\"Sign\",\"B" +
- "asePointer\":{\"value\":42942304},\"Offsets\":[40,16,32,3008]}]}")]
- public string Witcher3 {
- get {
- return ((string)(this["Witcher3"]));
- }
- set {
- this["Witcher3"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Settings/Offsets.settings b/Artemis/Artemis/Settings/Offsets.settings
deleted file mode 100644
index 1c29a3853..000000000
--- a/Artemis/Artemis/Settings/Offsets.settings
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- {"Game":"RocketLeague","GameVersion":"1.10","GameAddresses":[{"Description":"Boost","BasePointer":{"value":21998084},"Offsets":[88,1452,1780,540]}]}
-
-
- {"Game":"Witcher3","GameVersion":"1.11","GameAddresses":[{"Description":"Sign","BasePointer":{"value":42942304},"Offsets":[40,16,32,3008]}]}
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/OverlaySettings.cs b/Artemis/Artemis/Settings/OverlaySettings.cs
new file mode 100644
index 000000000..efc7486c6
--- /dev/null
+++ b/Artemis/Artemis/Settings/OverlaySettings.cs
@@ -0,0 +1,12 @@
+using System.ComponentModel;
+using Newtonsoft.Json;
+
+namespace Artemis.Settings
+{
+ public class OverlaySettings : EffectSettings
+ {
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool Enabled { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs b/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs
index 937f29a6e..85dd34ed5 100644
--- a/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs
+++ b/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs
@@ -2,9 +2,10 @@
using System.IO;
using System.Net;
using System.Threading;
-using System.Windows.Forms;
+using Artemis.DAL;
using Artemis.Settings;
using Newtonsoft.Json;
+using Ninject.Extensions.Logging;
namespace Artemis.Utilities.GameState
{
@@ -17,12 +18,15 @@ namespace Artemis.Utilities.GameState
public delegate void GameDataReceivedEventHandler(
object sender, GameDataReceivedEventArgs gameDataReceivedEventArgs);
+ private readonly ILogger _logger;
+
private readonly AutoResetEvent _waitForConnection = new AutoResetEvent(false);
private HttpListener _listener;
- public GameStateWebServer()
+ public GameStateWebServer(ILogger logger)
{
+ _logger = logger;
Start();
}
@@ -36,7 +40,7 @@ namespace Artemis.Utilities.GameState
if (Running)
return;
- Port = DAL.SettingsProvider.Load("GeneralSettings").GamestatePort;
+ Port = SettingsProvider.Load().GamestatePort;
_listener = new HttpListener();
_listener.Prefixes.Add($"http://localhost:{Port}/");
@@ -45,10 +49,9 @@ namespace Artemis.Utilities.GameState
{
_listener.Start();
}
- catch (HttpListenerException)
+ catch (HttpListenerException e)
{
- MessageBox.Show("Couldn't start the webserver. CS:GO/Dota2 effects won't work :c \n\n" +
- "Try changing the port in Settings and restart Artemis.");
+ _logger.Error(e, "Couldn't start the webserver on port {0}.", Port);
Running = false;
return;
}
diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs
index 0d4bc2a4e..ff71ee0c8 100644
--- a/Artemis/Artemis/Utilities/Updater.cs
+++ b/Artemis/Artemis/Utilities/Updater.cs
@@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
-using System.Configuration;
using System.Linq;
using System.Net;
+using Artemis.DAL;
using Artemis.Settings;
using Artemis.Utilities.Memory;
using Newtonsoft.Json;
using Squirrel;
-using SettingsProvider = Artemis.DAL.SettingsProvider;
namespace Artemis.Utilities
{
@@ -16,7 +15,7 @@ namespace Artemis.Utilities
public static async void UpdateApp()
{
// Only update if the user allows it
- if (!SettingsProvider.Load("GeneralSettings").AutoUpdate)
+ if (!SettingsProvider.Load().AutoUpdate)
return;
// TODO: Remove prerelease before releasing
@@ -48,7 +47,7 @@ namespace Artemis.Utilities
private static void AppUninstall(IUpdateManager mgr)
{
// Use GeneralSettings to get rid of the autorun shortcut
- var fakeSettings = new GeneralSettings { Autorun = false };
+ var fakeSettings = new GeneralSettings {Autorun = false};
fakeSettings.ApplyAutorun();
mgr.RemoveShortcutForThisExe();
@@ -56,32 +55,60 @@ namespace Artemis.Utilities
public static void GetPointers()
{
- if (!DAL.SettingsProvider.Load("GeneralSettings").EnablePointersUpdate)
+ if (!SettingsProvider.Load().EnablePointersUpdate)
+ {
+ LoadNullDefaults();
return;
+ }
try
{
var jsonClient = new WebClient();
-
+ var offsetSettings = SettingsProvider.Load();
// Random number to get around cache issues
var rand = new Random(DateTime.Now.Millisecond);
- var json = jsonClient.DownloadString(
- "https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next());
+ var json = jsonClient.DownloadString("https://raw.githubusercontent.com/SpoinkyNL/" +
+ "Artemis/master/pointers.json?random=" + rand.Next());
// Get a list of pointers
var pointers = JsonConvert.DeserializeObject>(json);
+
// Assign each pointer to the settings file
- var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague"));
- if (rlPointers != null)
- {
- Offsets.Default.RocketLeague = rlPointers;
- Offsets.Default.Save();
- }
+ if (pointers.FirstOrDefault(p => p.Game == "RocketLeague") != null)
+ offsetSettings.RocketLeague = pointers.FirstOrDefault(p => p.Game == "RocketLeague");
+
+ offsetSettings.Save();
}
catch (Exception)
{
// ignored
}
}
+
+ ///
+ /// JSON default value handling can only go so far, so the update will take care of defaults
+ /// on the offsets if they are null
+ ///
+ private static void LoadNullDefaults()
+ {
+ var offsetSettings = SettingsProvider.Load();
+ if (offsetSettings.RocketLeague == null)
+ offsetSettings.RocketLeague = new GamePointersCollection
+ {
+ Game = "RocketLeague",
+ GameVersion = "1.21",
+ GameAddresses = new List
+ {
+ new GamePointer
+ {
+ Description = "Boost",
+ BasePointer = new IntPtr(0x016AD528),
+ Offsets = new[] {0x304, 0x8, 0x50, 0x720, 0x224}
+ }
+ }
+ };
+
+ offsetSettings.Save();
+ }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs b/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs
index 78439464e..a56a0af70 100644
--- a/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs
@@ -1,8 +1,10 @@
using System;
+using Artemis.DAL;
using Artemis.Events;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Services;
+using Artemis.Settings;
using Caliburn.Micro;
using Ninject;
@@ -90,7 +92,7 @@ namespace Artemis.ViewModels.Abstract
if (!resetConfirm.Value)
return;
- EffectSettings.ToDefault();
+ EffectSettings.Reset(true);
NotifyOfPropertyChange(() => EffectSettings);
SaveSettings();
diff --git a/Artemis/Artemis/ViewModels/Abstract/GameViewModel.cs b/Artemis/Artemis/ViewModels/Abstract/GameViewModel.cs
index 089c285a5..33b737cb5 100644
--- a/Artemis/Artemis/ViewModels/Abstract/GameViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Abstract/GameViewModel.cs
@@ -4,6 +4,7 @@ using Artemis.Managers;
using Artemis.Models;
using Artemis.Modules.Effects.ProfilePreview;
using Artemis.Services;
+using Artemis.Settings;
using Artemis.ViewModels.Profiles;
using Caliburn.Micro;
using Ninject;
@@ -80,7 +81,7 @@ namespace Artemis.ViewModels.Abstract
if (!resetConfirm.Value)
return;
- GameSettings.ToDefault();
+ GameSettings.Reset(true);
NotifyOfPropertyChange(() => GameSettings);
SaveSettings();
diff --git a/Artemis/Artemis/ViewModels/Abstract/OverlayViewModel.cs b/Artemis/Artemis/ViewModels/Abstract/OverlayViewModel.cs
index e56a85b9b..7d0a315cd 100644
--- a/Artemis/Artemis/ViewModels/Abstract/OverlayViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Abstract/OverlayViewModel.cs
@@ -1,6 +1,7 @@
using Artemis.Managers;
using Artemis.Models;
using Artemis.Services;
+using Artemis.Settings;
using Caliburn.Micro;
using Ninject;
@@ -53,7 +54,7 @@ namespace Artemis.ViewModels.Abstract
if (!resetConfirm.Value)
return;
- OverlaySettings.ToDefault();
+ OverlaySettings.Reset(true);
NotifyOfPropertyChange(() => OverlaySettings);
OverlayModel.Enabled = OverlaySettings.Enabled;
diff --git a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
index d7f0621b6..826d6fdca 100644
--- a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
@@ -32,7 +32,7 @@ namespace Artemis.ViewModels.Flyouts
MainManager = mainManager;
Header = "Settings";
Position = Position.Right;
- GeneralSettings = SettingsProvider.Load("GeneralSettings");
+ GeneralSettings = SettingsProvider.Load();
LogLevels = new BindableCollection();
LogLevels.AddRange(LogLevel.AllLoggingLevels.Select(l => l.Name));
@@ -201,9 +201,7 @@ namespace Artemis.ViewModels.Flyouts
public void ResetSettings()
{
- IArtemisSettings generalSettings = GeneralSettings;
- SettingsProvider.SetToDefault(ref generalSettings);
- GeneralSettings.Save();
+ GeneralSettings.Reset(true);
NotifyOfPropertyChange(() => GeneralSettings);
}
diff --git a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
index 1e77b6f0b..4e1ac238c 100644
--- a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
+++ b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
@@ -32,7 +32,7 @@ namespace Artemis.ViewModels
MainManager.EnableProgram();
MainManager.OnEnabledChangedEvent += MainManagerOnOnEnabledChangedEvent;
- var generalSettings = SettingsProvider.Load("GeneralSettings");
+ var generalSettings = SettingsProvider.Load();
Enabled = !generalSettings.Suspended;
if (generalSettings.ShowOnStartup)
ShowWindow();
@@ -116,6 +116,7 @@ namespace Artemis.ViewModels
NotifyOfPropertyChange(() => CanHideWindow);
ShowKeyboardDialog();
+ SettingsProvider.Load().ApplyTheme();
CheckDuplicateInstances();
}
@@ -132,7 +133,8 @@ namespace Artemis.ViewModels
DialogService.ShowMessageBox("Multiple instances found",
"It looks like there are multiple running instances of Artemis. " +
- "This can cause issues. If so, please make sure Artemis isn't already running");
+ "This can cause issues, especially with CS:GO and Dota2. " +
+ "If so, please make sure Artemis isn't already running");
}
private async void ShowKeyboardDialog()