Skip to content

Commit

Permalink
Add settings upgrade (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
mburbea authored Sep 18, 2020
1 parent 020c890 commit 6b96319
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions KoAR.SaveEditor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<setting name="Acknowledged3x" serializeAs="String">
<value>False</value>
</setting>
<setting name="Upgraded" serializeAs="String">
<value>False</value>
</setting>
</KoAR.SaveEditor.Properties.Settings>
</userSettings>
<applicationSettings>
Expand Down
13 changes: 13 additions & 0 deletions KoAR.SaveEditor/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Reflection;
using System.Windows;
using KoAR.SaveEditor.Properties;
using Microsoft.Windows.Themes;

namespace KoAR.SaveEditor
Expand All @@ -9,5 +11,16 @@ partial class App
static App() => Type.GetTypeCode(typeof(PlatformCulture)); // Needed to enforce loading of PresentationFramework.Aero.dll before initializing App.

public static Version Version { get; } = new Version(Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);

protected override void OnStartup(StartupEventArgs e)
{
if (!Settings.Default.Upgraded)
{
Settings.Default.Upgrade();
Settings.Default.Upgraded = true;
Settings.Default.Save();
}
base.OnStartup(e);
}
}
}
14 changes: 13 additions & 1 deletion KoAR.SaveEditor/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions KoAR.SaveEditor/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
<Setting Name="Acknowledged3x" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Upgraded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

0 comments on commit 6b96319

Please sign in to comment.