mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 19:34:15 +08:00
added ISettingsManager implementation.
This commit is contained in:
parent
21f2529e97
commit
d8389d2289
@ -1008,6 +1008,7 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Strings\arcStrings.ru-RU.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>perl "$(SolutionDir)inc-revision.pl" "$(ProjectPath)" $(ConfigurationName)
|
||||
|
12
ArcFormats/Properties/Settings.Designer.cs
generated
12
ArcFormats/Properties/Settings.Designer.cs
generated
@ -705,5 +705,17 @@ namespace GameRes.Formats.Properties {
|
||||
this["RCTApplyMask"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool UpgradeRequired {
|
||||
get {
|
||||
return ((bool)(this["UpgradeRequired"]));
|
||||
}
|
||||
set {
|
||||
this["UpgradeRequired"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,18 +19,6 @@ namespace GameRes.Formats.Properties {
|
||||
//
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
|
||||
if (null != Application.Current)
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke (DispatcherPriority.Normal, new Action(() => {
|
||||
Application.Current.Exit += ApplicationExitHandler;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationExitHandler (object sender, System.Windows.ExitEventArgs args)
|
||||
{
|
||||
Default.Save();
|
||||
}
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||
|
@ -173,5 +173,8 @@
|
||||
<Setting Name="RCTApplyMask" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="UpgradeRequired" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -3,6 +3,8 @@
|
||||
//! \brief Persistent resource settings implementation.
|
||||
//
|
||||
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace GameRes.Formats
|
||||
{
|
||||
internal class LocalResourceSetting : ResourceSettingBase
|
||||
@ -12,4 +14,23 @@ namespace GameRes.Formats
|
||||
set { Properties.Settings.Default[Name] = value; }
|
||||
}
|
||||
}
|
||||
|
||||
[Export(typeof(ISettingsManager))]
|
||||
internal class SettingsManager : ISettingsManager
|
||||
{
|
||||
public void UpgradeSettings ()
|
||||
{
|
||||
if (Properties.Settings.Default.UpgradeRequired)
|
||||
{
|
||||
Properties.Settings.Default.Upgrade();
|
||||
Properties.Settings.Default.UpgradeRequired = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveSettings ()
|
||||
{
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,6 +175,9 @@
|
||||
<setting name="RCTApplyMask" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="UpgradeRequired" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</GameRes.Formats.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
|
||||
|
Loading…
x
Reference in New Issue
Block a user