diff --git a/ArcFormats/Strings/arcStrings.Designer.cs b/ArcFormats/Strings/arcStrings.Designer.cs
index 8ebef624..4ba844ff 100644
--- a/ArcFormats/Strings/arcStrings.Designer.cs
+++ b/ArcFormats/Strings/arcStrings.Designer.cs
@@ -124,6 +124,15 @@ namespace GameRes.Formats.Strings {
}
}
+ ///
+ /// Looks up a localized string similar to 32-bit hex number.
+ ///
+ public static string ArcHex32Bit {
+ get {
+ return ResourceManager.GetString("ArcHex32Bit", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to no encryption.
///
diff --git a/ArcFormats/Strings/arcStrings.resx b/ArcFormats/Strings/arcStrings.resx
index 2327ad49..1d26a4d3 100644
--- a/ArcFormats/Strings/arcStrings.resx
+++ b/ArcFormats/Strings/arcStrings.resx
@@ -312,6 +312,9 @@ Enter archive encryption key.
Default
+
+ 32-bit hex number
+
Default
diff --git a/ArcFormats/Strings/arcStrings.ru-RU.resx b/ArcFormats/Strings/arcStrings.ru-RU.resx
index 4c95c452..02a5194c 100644
--- a/ArcFormats/Strings/arcStrings.ru-RU.resx
+++ b/ArcFormats/Strings/arcStrings.ru-RU.resx
@@ -136,6 +136,9 @@
Содержимое архива зашифровано.
Выберите алгоритм шифрования.
+
+ 32-битное шестнадцатеричное число
+
без шифрования
diff --git a/ArcFormats/WidgetDPK.xaml b/ArcFormats/WidgetDPK.xaml
index 234e0fa7..12a0bdc9 100644
--- a/ArcFormats/WidgetDPK.xaml
+++ b/ArcFormats/WidgetDPK.xaml
@@ -5,17 +5,6 @@
xmlns:p="clr-namespace:GameRes.Formats.Properties"
xmlns:dac="clr-namespace:GameRes.Formats.Dac"
xmlns:local="clr-namespace:GameRes.Formats.GUI">
-
-
-
-
@@ -36,17 +25,10 @@
IsReadOnly="True" TextWrapping="NoWrap" Grid.Column="1" Grid.Row="1" Margin="0,3,0,3"
DataContext="{Binding ElementName=EncScheme, Path=SelectedItem}"/>
-
-
-
-
+ ToolTip="{x:Static s:arcStrings.ArcHex32Bit}"/>
-
-
-
-
+ ToolTip="{x:Static s:arcStrings.ArcHex32Bit}"/>
diff --git a/ArcFormats/WidgetDPK.xaml.cs b/ArcFormats/WidgetDPK.xaml.cs
index c088c0ad..586f3ec4 100644
--- a/ArcFormats/WidgetDPK.xaml.cs
+++ b/ArcFormats/WidgetDPK.xaml.cs
@@ -1,4 +1,6 @@
using System.Windows.Controls;
+using GameRes.Formats.Dac;
+using GameRes.Formats.Properties;
namespace GameRes.Formats.GUI
{
@@ -10,8 +12,28 @@ namespace GameRes.Formats.GUI
public WidgetDPK ()
{
InitializeComponent ();
- if (null == EncScheme.SelectedItem)
- EncScheme.SelectedIndex = 0;
+ var last_scheme = EncScheme.SelectedItem as DpkScheme;
+ if (null == last_scheme)
+ last_scheme = DpkOpener.KnownSchemes[0];
+ uint key1 = Settings.Default.DPKKey1;
+ uint key2 = Settings.Default.DPKKey2;
+ if (last_scheme.Key1 != key1 || last_scheme.Key2 != key2)
+ EncScheme.SelectedIndex = -1;
+ Key1.Text = key1.ToString ("X");
+ Key2.Text = key2.ToString ("X8");
+
+ EncScheme.SelectionChanged += OnSchemeChanged;
+ }
+
+ void OnSchemeChanged (object sender, SelectionChangedEventArgs e)
+ {
+ var widget = sender as ComboBox;
+ var scheme = widget.SelectedItem as DpkScheme;
+ if (null != scheme)
+ {
+ Key1.Text = scheme.Key1.ToString ("X");
+ Key2.Text = scheme.Key2.ToString ("X8");
+ }
}
}
}