refactored ResourceOptions handling.

This commit is contained in:
morkt
2014-07-27 07:39:58 +04:00
parent 5253f8c776
commit 1c33e4c9d5
7 changed files with 137 additions and 66 deletions

View File

@@ -21,10 +21,10 @@ namespace GameRes.Formats.GUI
/// </summary>
public partial class WidgetINT : Grid
{
public WidgetINT (IntEncryptionInfo encryption_info)
public WidgetINT ()
{
InitializeComponent();
this.DataContext = encryption_info;
this.DataContext = GameRes.Formats.Properties.Settings.Default.INTEncryption ?? new IntEncryptionInfo();
Passphrase.TextChanged += OnPassphraseChanged;
EncScheme.SelectionChanged += OnSchemeChanged;
@@ -61,24 +61,6 @@ namespace GameRes.Formats.GUI
}
}
}
public uint? GetKey ()
{
if (null != Info.Key && Info.Key.HasValue)
return Info.Key;
if (!string.IsNullOrEmpty (Info.Scheme))
{
IntOpener.KeyData keydata;
if (IntOpener.KnownSchemes.TryGetValue (Info.Scheme, out keydata))
return keydata.Key;
}
if (!string.IsNullOrEmpty (Info.Password))
return IntOpener.EncodePassPhrase (Info.Password);
return null;
}
}
[ValueConversion(typeof(uint?), typeof(string))]