mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Started settings refactor for 1.3.0.0
This commit is contained in:
parent
c9e696afbc
commit
fcb4ca3df3
@ -257,6 +257,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
@ -289,28 +290,28 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.9.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=2.9.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=2.9.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.9.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.DataGrid, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.DataGrid, Version=2.9.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.7\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.9.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.9\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
@ -325,6 +326,7 @@
|
||||
</Compile>
|
||||
<Compile Include="ArtemisBootstrapper.cs" />
|
||||
<Compile Include="DAL\ProfileProvider.cs" />
|
||||
<Compile Include="DAL\SettingsProvider.cs" />
|
||||
<Compile Include="DeviceProviders\Corsair\CorsairMice.cs" />
|
||||
<Compile Include="DeviceProviders\Corsair\CorsairHeadsets.cs" />
|
||||
<Compile Include="DeviceProviders\Corsair\Utilities\KeyMap.cs" />
|
||||
@ -551,12 +553,8 @@
|
||||
</Compile>
|
||||
<Compile Include="Services\DialogService.cs" />
|
||||
<Compile Include="Services\MetroDialogService.cs" />
|
||||
<Compile Include="Settings\General.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>General.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Settings\GeneralSettings.cs" />
|
||||
<Compile Include="Settings\IArtemisSettings.cs" />
|
||||
<Compile Include="Settings\Offsets.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
@ -791,10 +789,6 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Offsets.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Settings\General.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>General.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
|
||||
49
Artemis/Artemis/DAL/SettingsProvider.cs
Normal file
49
Artemis/Artemis/DAL/SettingsProvider.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using Artemis.Settings;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Artemis.DAL
|
||||
{
|
||||
public static class SettingsProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads settings with the given name from the filesystem
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static T Load<T>(string name)
|
||||
{
|
||||
if (!AreSettings(typeof(T)))
|
||||
throw new ArgumentException("Type doesn't implement IArtemisSettings");
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the settings object to the filesystem
|
||||
/// </summary>
|
||||
/// <param name="artemisSettings"></param>
|
||||
public static void Save(IArtemisSettings artemisSettings)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores the settings object to its default values
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static T GetDefault<T>()
|
||||
{
|
||||
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<T>("");
|
||||
}
|
||||
|
||||
private static bool AreSettings(Type t)
|
||||
{
|
||||
return t.IsAssignableFrom(typeof(IArtemisSettings));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@
|
||||
<Label FontSize="20" HorizontalAlignment="Left">
|
||||
<Label.Content>
|
||||
<AccessText TextWrapping="Wrap"
|
||||
Text="By default fills up the keyboard according to the amount of boost. Also colors mouse and headset according to boost." />
|
||||
Text="By default fills up the keyboard and colors all devices according to the amount boost." />
|
||||
</Label.Content>
|
||||
</Label>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
@ -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")]
|
||||
146
Artemis/Artemis/Settings/General.Designer.cs
generated
146
Artemis/Artemis/Settings/General.Designer.cs
generated
@ -1,146 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Artemis.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="LastEffect" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">WindowsProfile</Value>
|
||||
</Setting>
|
||||
<Setting Name="LastKeyboard" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="GamestatePort" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">51364</Value>
|
||||
</Setting>
|
||||
<Setting Name="Autorun" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="Suspended" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ShowOnStartup" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="AutoUpdate" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="Theme" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Light</Value>
|
||||
</Setting>
|
||||
<Setting Name="LogLevel" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Info</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Artemis/Artemis/Settings/IArtemisSettings.cs
Normal file
8
Artemis/Artemis/Settings/IArtemisSettings.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Artemis.Settings
|
||||
{
|
||||
public interface IArtemisSettings
|
||||
{
|
||||
string Name { get; }
|
||||
void Save();
|
||||
}
|
||||
}
|
||||
@ -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>("GeneralSettings").EnablePointersUpdate)
|
||||
return;
|
||||
|
||||
try
|
||||
|
||||
@ -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>("GeneralSettings");
|
||||
|
||||
LogLevels = new BindableCollection<string>();
|
||||
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>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@
|
||||
<package id="CUE.NET" version="1.0.3" targetFramework="net452" />
|
||||
<package id="DeltaCompressionDotNet" version="1.0.0" targetFramework="net461" />
|
||||
<package id="DynamicExpresso.Core" version="1.3.1.0" targetFramework="net452" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.7" targetFramework="net452" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.9" targetFramework="net461" />
|
||||
<package id="gong-wpf-dragdrop" version="0.1.4.3" targetFramework="net452" />
|
||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
|
||||
<package id="log4net" version="2.0.5" targetFramework="net452" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user