mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 12:39:16 +08:00
(XP3): display selected decryptor name in popup dialog.
This commit is contained in:
parent
d87ac53f9b
commit
851fe04756
@ -98,7 +98,7 @@ namespace GameRes.Formats.KiriKiri
|
||||
|
||||
public bool ForceEncryptionQuery = true;
|
||||
|
||||
private static readonly ICrypt NoCryptAlgorithm = new NoCrypt();
|
||||
internal static readonly ICrypt NoCryptAlgorithm = new NoCrypt();
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
|
@ -1,9 +1,16 @@
|
||||
<Grid x:Class="GameRes.Formats.GUI.WidgetXP3"
|
||||
<StackPanel x:Class="GameRes.Formats.GUI.WidgetXP3"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:fmt="clr-namespace:GameRes.Formats.KiriKiri"
|
||||
xmlns:p="clr-namespace:GameRes.Formats.Properties"
|
||||
MaxWidth="250">
|
||||
<ComboBox Name="Scheme" ItemsSource="{Binding}"
|
||||
SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=XP3Scheme, Mode=TwoWay}" Width="180"/>
|
||||
</Grid>
|
||||
xmlns:local="clr-namespace:GameRes.Formats.GUI"
|
||||
MaxWidth="250" Orientation="Vertical" HorizontalAlignment="Left">
|
||||
<StackPanel.Resources>
|
||||
<local:ClassNameConverter x:Key="ClassNameConverter" />
|
||||
</StackPanel.Resources>
|
||||
<ComboBox Name="Scheme" Width="180" ItemsSource="{Binding}" HorizontalAlignment="Left"
|
||||
DisplayMemberPath="Key" SelectedValuePath="Key"
|
||||
SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=XP3Scheme, Mode=TwoWay}"/>
|
||||
<TextBlock Name="AlgorithmName" DataContext="{Binding ElementName=Scheme, Path=SelectedItem}" Margin="0,5,0,0"
|
||||
Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource ClassNameConverter}}"/>
|
||||
</StackPanel>
|
||||
|
@ -1,8 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using GameRes.Formats.KiriKiri;
|
||||
using GameRes.Formats.Properties;
|
||||
using GameRes.Formats.Strings;
|
||||
|
||||
namespace GameRes.Formats.GUI
|
||||
@ -10,20 +11,38 @@ namespace GameRes.Formats.GUI
|
||||
/// <summary>
|
||||
/// Interaction logic for WidgetXP3.xaml
|
||||
/// </summary>
|
||||
public partial class WidgetXP3 : Grid
|
||||
public partial class WidgetXP3 : StackPanel
|
||||
{
|
||||
public WidgetXP3 ()
|
||||
{
|
||||
InitializeComponent();
|
||||
var keys = new string[] { arcStrings.ArcNoEncryption };
|
||||
Scheme.ItemsSource = keys.Concat (Xp3Opener.KnownSchemes.Keys.OrderBy (x => x));
|
||||
if (-1 == Scheme.SelectedIndex)
|
||||
Scheme.SelectedIndex = 0;
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
public ICrypt GetScheme ()
|
||||
{
|
||||
return Xp3Opener.GetScheme (Scheme.SelectedItem as string);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user