2018-01-04 20:46:37 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2015-08-19 21:40:32 +04:00
|
|
|
|
using System.Windows.Controls;
|
2018-01-04 20:46:37 +04:00
|
|
|
|
using System.Windows.Data;
|
2015-08-19 21:40:32 +04:00
|
|
|
|
using GameRes.Formats.KiriKiri;
|
|
|
|
|
using GameRes.Formats.Strings;
|
|
|
|
|
|
|
|
|
|
namespace GameRes.Formats.GUI
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for WidgetXP3.xaml
|
|
|
|
|
/// </summary>
|
2018-01-04 20:46:37 +04:00
|
|
|
|
public partial class WidgetXP3 : StackPanel
|
2015-08-19 21:40:32 +04:00
|
|
|
|
{
|
|
|
|
|
public WidgetXP3 ()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2018-01-04 20:46:37 +04: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) => {
|
|
|
|
|
if (-1 == this.Scheme.SelectedIndex)
|
|
|
|
|
this.Scheme.SelectedIndex = 0;
|
|
|
|
|
};
|
2015-08-19 21:40:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ICrypt GetScheme ()
|
|
|
|
|
{
|
2018-01-04 20:46:37 +04: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-19 21:40:32 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|