2018-01-05 00:46:37 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2015-08-20 01:40:32 +08:00
|
|
|
|
using System.Windows.Controls;
|
2018-01-05 00:46:37 +08:00
|
|
|
|
using System.Windows.Data;
|
2015-08-20 01:40:32 +08:00
|
|
|
|
using GameRes.Formats.KiriKiri;
|
|
|
|
|
using GameRes.Formats.Strings;
|
|
|
|
|
|
|
|
|
|
namespace GameRes.Formats.GUI
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for WidgetXP3.xaml
|
|
|
|
|
/// </summary>
|
2018-01-05 00:46:37 +08:00
|
|
|
|
public partial class WidgetXP3 : StackPanel
|
2015-08-20 01:40:32 +08:00
|
|
|
|
{
|
|
|
|
|
public WidgetXP3 ()
|
|
|
|
|
{
|
2018-01-10 21:11:29 +08:00
|
|
|
|
var last_selected = Properties.Settings.Default.XP3Scheme;
|
2015-08-20 01:40:32 +08:00
|
|
|
|
InitializeComponent();
|
2018-01-05 00:46:37 +08:00
|
|
|
|
var keys = new[] { new KeyValuePair<string, ICrypt> (arcStrings.ArcNoEncryption, Xp3Opener.NoCryptAlgorithm) };
|
|
|
|
|
this.DataContext = keys.Concat (Xp3Opener.KnownSchemes.OrderBy (x => x.Key));
|
|
|
|
|
this.Loaded += (s, e) => {
|
2018-01-10 21:11:29 +08:00
|
|
|
|
if (!string.IsNullOrEmpty (last_selected))
|
|
|
|
|
this.Scheme.SelectedValue = last_selected;
|
|
|
|
|
else
|
2018-01-05 00:46:37 +08:00
|
|
|
|
this.Scheme.SelectedIndex = 0;
|
|
|
|
|
};
|
2015-08-20 01:40:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ICrypt GetScheme ()
|
|
|
|
|
{
|
2018-01-05 00:46:37 +08:00
|
|
|
|
return Xp3Opener.GetScheme (Scheme.SelectedValue as string);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class ClassNameConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value != null)
|
|
|
|
|
return value.GetType().Name;
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
2015-08-20 01:40:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|