diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj
index 747099bf6..3aea3a357 100644
--- a/Artemis/Artemis/Artemis.csproj
+++ b/Artemis/Artemis/Artemis.csproj
@@ -257,6 +257,7 @@
True
+
@@ -289,28 +290,28 @@
-
- ..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.dll
+
+ ..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.dll
True
-
- ..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll
+
+ ..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll
True
-
- ..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll
+
+ ..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll
True
-
- ..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
+
+ ..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
True
-
- ..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.DataGrid.dll
+
+ ..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.DataGrid.dll
True
-
- ..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.Toolkit.dll
+
+ ..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.Toolkit.dll
True
@@ -325,6 +326,7 @@
+
@@ -551,12 +553,8 @@
-
- True
- True
- General.settings
-
+
True
True
@@ -791,10 +789,6 @@
SettingsSingleFileGenerator
Offsets.Designer.cs
-
- SettingsSingleFileGenerator
- General.Designer.cs
-
diff --git a/Artemis/Artemis/DAL/SettingsProvider.cs b/Artemis/Artemis/DAL/SettingsProvider.cs
new file mode 100644
index 000000000..f6e7c2da7
--- /dev/null
+++ b/Artemis/Artemis/DAL/SettingsProvider.cs
@@ -0,0 +1,49 @@
+using System;
+using Artemis.Settings;
+using Newtonsoft.Json;
+
+namespace Artemis.DAL
+{
+ public static class SettingsProvider
+ {
+ ///
+ /// Loads settings with the given name from the filesystem
+ ///
+ ///
+ ///
+ public static T Load(string name)
+ {
+ if (!AreSettings(typeof(T)))
+ throw new ArgumentException("Type doesn't implement IArtemisSettings");
+
+ throw new NotImplementedException();
+ }
+
+ ///
+ /// Saves the settings object to the filesystem
+ ///
+ ///
+ public static void Save(IArtemisSettings artemisSettings)
+ {
+ }
+
+ ///
+ /// Restores the settings object to its default values
+ ///
+ ///
+ ///
+ public static T GetDefault()
+ {
+ if (!AreSettings(typeof(T)))
+ throw new ArgumentException("Type doesn't implement IArtemisSettings");
+
+ // Loading the object from an empty string makes Json.NET use all the default values
+ return JsonConvert.DeserializeObject("");
+ }
+
+ private static bool AreSettings(Type t)
+ {
+ return t.IsAssignableFrom(typeof(IArtemisSettings));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml
index d59f8c89b..5bdbc3e76 100644
--- a/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml
+++ b/Artemis/Artemis/Modules/Games/RocketLeague/RocketLeagueView.xaml
@@ -28,7 +28,7 @@
diff --git a/Artemis/Artemis/Properties/AssemblyInfo.cs b/Artemis/Artemis/Properties/AssemblyInfo.cs
index 6af1ea75a..07562953c 100644
--- a/Artemis/Artemis/Properties/AssemblyInfo.cs
+++ b/Artemis/Artemis/Properties/AssemblyInfo.cs
@@ -9,7 +9,7 @@ using System.Windows;
[assembly: AssemblyTitle("Artemis")]
[assembly: AssemblyDescription("Adds third-party support for RGB keyboards to games")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Artemis developers")]
+[assembly: AssemblyCompany("SpoinkyNL")]
[assembly: AssemblyProduct("Artemis")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
@@ -52,6 +52,6 @@ using System.Windows;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.3.0.0")]
-[assembly: AssemblyFileVersion("1.3.0.0")]
+[assembly: AssemblyVersion("1.3.0.1")]
+[assembly: AssemblyFileVersion("1.3.0.1")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/General.Designer.cs b/Artemis/Artemis/Settings/General.Designer.cs
deleted file mode 100644
index 0d56558a5..000000000
--- a/Artemis/Artemis/Settings/General.Designer.cs
+++ /dev/null
@@ -1,146 +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 General : global::System.Configuration.ApplicationSettingsBase {
-
- private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General())));
-
- public static General Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("WindowsProfile")]
- public string LastEffect {
- get {
- return ((string)(this["LastEffect"]));
- }
- set {
- this["LastEffect"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string LastKeyboard {
- get {
- return ((string)(this["LastKeyboard"]));
- }
- set {
- this["LastKeyboard"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool EnablePointersUpdate {
- get {
- return ((bool)(this["EnablePointersUpdate"]));
- }
- set {
- this["EnablePointersUpdate"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("51364")]
- public int GamestatePort {
- get {
- return ((int)(this["GamestatePort"]));
- }
- set {
- this["GamestatePort"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool Autorun {
- get {
- return ((bool)(this["Autorun"]));
- }
- set {
- this["Autorun"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool Suspended {
- get {
- return ((bool)(this["Suspended"]));
- }
- set {
- this["Suspended"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool ShowOnStartup {
- get {
- return ((bool)(this["ShowOnStartup"]));
- }
- set {
- this["ShowOnStartup"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool AutoUpdate {
- get {
- return ((bool)(this["AutoUpdate"]));
- }
- set {
- this["AutoUpdate"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Light")]
- public string Theme {
- get {
- return ((string)(this["Theme"]));
- }
- set {
- this["Theme"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Info")]
- public string LogLevel {
- get {
- return ((string)(this["LogLevel"]));
- }
- set {
- this["LogLevel"] = value;
- }
- }
- }
-}
diff --git a/Artemis/Artemis/Settings/General.settings b/Artemis/Artemis/Settings/General.settings
deleted file mode 100644
index 9eef70257..000000000
--- a/Artemis/Artemis/Settings/General.settings
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
- WindowsProfile
-
-
-
-
-
- True
-
-
- 51364
-
-
- False
-
-
- False
-
-
- True
-
-
- True
-
-
- Light
-
-
- Info
-
-
-
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/GeneralSettings.cs b/Artemis/Artemis/Settings/GeneralSettings.cs
index f66788f39..e97dbe763 100644
--- a/Artemis/Artemis/Settings/GeneralSettings.cs
+++ b/Artemis/Artemis/Settings/GeneralSettings.cs
@@ -1,89 +1,67 @@
using System;
+using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using System.Windows;
+using Artemis.DAL;
using Artemis.Utilities;
using MahApps.Metro;
+using Newtonsoft.Json;
namespace Artemis.Settings
{
- public class GeneralSettings
+ public class GeneralSettings : IArtemisSettings
{
- public GeneralSettings()
+ [DefaultValue("WindowsProfile")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public string LastEffect { get; set; }
+
+ [DefaultValue(null)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public string LastKeyboard { get; set; }
+
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool EnablePointersUpdate { get; set; }
+
+ [DefaultValue(51364)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public int GamestatePort { get; set; }
+
+ [DefaultValue(false)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool Autorun { get; set; }
+
+ [DefaultValue(false)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool Suspended { get; set; }
+
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool ShowOnStartup { get; set; }
+
+ [DefaultValue(true)]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public bool AutoUpdate { get; set; }
+
+ [DefaultValue("Light")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public string Theme { get; set; }
+
+ [DefaultValue("Info")]
+ [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
+ public string LogLevel { get; set; }
+
+ public string Name { get; } = "GeneralSettings";
+
+ public void Save()
{
- ThemeManager.AddAccent("CorsairYellow", new Uri("pack://application:,,,/Styles/Accents/CorsairYellow.xaml"));
+ SettingsProvider.Save(this);
+ ApplyAutorun();
ApplyTheme();
- }
-
- public int GamestatePort
- {
- get { return General.Default.GamestatePort; }
- set
- {
- if (General.Default.GamestatePort == value) return;
- General.Default.GamestatePort = value;
- }
- }
-
- public bool EnablePointersUpdate
- {
- get { return General.Default.EnablePointersUpdate; }
- set
- {
- if (General.Default.EnablePointersUpdate == value) return;
- General.Default.EnablePointersUpdate = value;
- }
- }
-
- public bool Autorun
- {
- get { return General.Default.Autorun; }
- set
- {
- if (General.Default.Autorun == value) return;
- General.Default.Autorun = value;
- }
- }
-
- public bool AutoUpdate
- {
- get { return General.Default.AutoUpdate; }
- set
- {
- if (General.Default.AutoUpdate == value) return;
- General.Default.AutoUpdate = value;
- }
- }
-
- public bool ShowOnStartup
- {
- get { return General.Default.ShowOnStartup; }
- set
- {
- if (General.Default.ShowOnStartup == value) return;
- General.Default.ShowOnStartup = value;
- }
- }
-
- public string Theme
- {
- get { return General.Default.Theme; }
- set
- {
- if (General.Default.Theme == value) return;
- General.Default.Theme = value;
- }
- }
-
- public string LogLevel
- {
- get { return General.Default.LogLevel; }
- set
- {
- if (General.Default.LogLevel == value) return;
- General.Default.LogLevel = value;
- }
+ ApplyGamestatePort();
+ Logging.SetupLogging(LogLevel);
}
private void ApplyGamestatePort()
@@ -106,16 +84,6 @@ namespace Artemis.Settings
File.Delete(startupFolder + @"\Artemis.lnk");
}
- public void SaveSettings()
- {
- General.Default.Save();
-
- ApplyAutorun();
- ApplyTheme();
- ApplyGamestatePort();
- Logging.SetupLogging(LogLevel);
- }
-
private void ApplyTheme()
{
switch (Theme)
@@ -138,18 +106,5 @@ namespace Artemis.Settings
break;
}
}
-
- public void ResetSettings()
- {
- GamestatePort = 51364;
- EnablePointersUpdate = true;
- Autorun = true;
- AutoUpdate = true;
- ShowOnStartup = true;
- Theme = "Light";
- LogLevel = "Info";
-
- SaveSettings();
- }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/IArtemisSettings.cs b/Artemis/Artemis/Settings/IArtemisSettings.cs
new file mode 100644
index 000000000..a40b3bae2
--- /dev/null
+++ b/Artemis/Artemis/Settings/IArtemisSettings.cs
@@ -0,0 +1,8 @@
+namespace Artemis.Settings
+{
+ public interface IArtemisSettings
+ {
+ string Name { get; }
+ void Save();
+ }
+}
\ No newline at end of file
diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs
index 3086ff820..4878b624b 100644
--- a/Artemis/Artemis/Utilities/Updater.cs
+++ b/Artemis/Artemis/Utilities/Updater.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Linq;
using System.Net;
using Artemis.Settings;
@@ -17,11 +18,21 @@ namespace Artemis.Utilities
if (!General.Default.AutoUpdate)
return;
- using (var mgr = new UpdateManager("http://artemis-rgb.com/auto-update"))
+ // TODO: Remove prerelease before releasing
+ // using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/SpoinkyNL/Artemis", null, null, null,true))
+ // {
+ // // Replace / remove the autorun shortcut
+ // SquirrelAwareApp.HandleEvents(onAppUpdate: v => AppUpdate(mgr.Result),
+ // onAppUninstall: v => AppUninstall(mgr.Result));
+ //
+ // await mgr.Result.UpdateApp();
+ // }
+
+ using (var mgr = new UpdateManager("C:\\Users\\Robert\\Desktop\\Artemis builds\\squirrel_test"))
{
// Replace / remove the autorun shortcut
SquirrelAwareApp.HandleEvents(onAppUpdate: v => AppUpdate(mgr), onAppUninstall: v => AppUninstall(mgr));
-
+
await mgr.UpdateApp();
}
}
@@ -29,22 +40,22 @@ namespace Artemis.Utilities
private static void AppUpdate(IUpdateManager mgr)
{
var settings = new GeneralSettings();
-
settings.ApplyAutorun();
mgr.CreateShortcutForThisExe();
}
private static void AppUninstall(IUpdateManager mgr)
{
- var settings = new GeneralSettings {Autorun = false};
+ // Use GeneralSettings to get rid of the autorun shortcut
+ var fakeSettings = new GeneralSettings { Autorun = false };
+ fakeSettings.ApplyAutorun();
- settings.ApplyAutorun();
mgr.RemoveShortcutForThisExe();
}
public static void GetPointers()
{
- if (!General.Default.EnablePointersUpdate)
+ if (!DAL.SettingsProvider.Load("GeneralSettings").EnablePointersUpdate)
return;
try
diff --git a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
index 6edd134dd..090c0fe4c 100644
--- a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Dynamic;
using System.Linq;
using System.Reflection;
+using Artemis.DAL;
using Artemis.Events;
using Artemis.Managers;
using Artemis.Settings;
@@ -31,7 +32,7 @@ namespace Artemis.ViewModels.Flyouts
MainManager = mainManager;
Header = "Settings";
Position = Position.Right;
- GeneralSettings = new GeneralSettings();
+ GeneralSettings = SettingsProvider.Load("GeneralSettings");
LogLevels = new BindableCollection();
LogLevels.AddRange(LogLevel.AllLoggingLevels.Select(l => l.Name));
@@ -200,13 +201,14 @@ namespace Artemis.ViewModels.Flyouts
public void ResetSettings()
{
- GeneralSettings.ResetSettings();
+ GeneralSettings = SettingsProvider.GetDefault();
+ GeneralSettings.Save();
NotifyOfPropertyChange(() => GeneralSettings);
}
public void SaveSettings()
{
- GeneralSettings.SaveSettings();
+ GeneralSettings.Save();
}
public void NavigateTo(string url)
@@ -216,9 +218,9 @@ namespace Artemis.ViewModels.Flyouts
protected override void HandleOpen()
{
- SelectedKeyboardProvider = string.IsNullOrEmpty(General.Default.LastKeyboard)
+ SelectedKeyboardProvider = string.IsNullOrEmpty(GeneralSettings.LastKeyboard)
? "None"
- : General.Default.LastKeyboard;
+ : GeneralSettings.LastKeyboard;
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/packages.config b/Artemis/Artemis/packages.config
index f70ca7757..14d03af95 100644
--- a/Artemis/Artemis/packages.config
+++ b/Artemis/Artemis/packages.config
@@ -7,7 +7,7 @@
-
+