mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
implemented external storage of resource schemes.
This commit is contained in:
@@ -55,6 +55,12 @@ namespace GameRes.Formats.Selene
|
||||
public string PassPhrase { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class KcapScheme : ResourceScheme
|
||||
{
|
||||
public Dictionary<string,string> KnownSchemes;
|
||||
}
|
||||
|
||||
[Export(typeof(ArchiveFormat))]
|
||||
public class PackOpener : ArchiveFormat
|
||||
{
|
||||
@@ -66,17 +72,19 @@ namespace GameRes.Formats.Selene
|
||||
|
||||
static private string DefaultPassPhrase = "Selene.Default.Password";
|
||||
|
||||
public static readonly Dictionary<string,string> KnownSchemes = new Dictionary<string,string> {
|
||||
{ arcStrings.KCAPDefault, "" },
|
||||
{ "Okaa-san ga Ippai!", "hahadata256pasyamada2zikan" },
|
||||
{ "Itazura Mahjong", "mjdata999pasyamada2zikan" },
|
||||
};
|
||||
public static Dictionary<string,string> KnownSchemes = new Dictionary<string,string>();
|
||||
|
||||
public PackOpener ()
|
||||
{
|
||||
Extensions = new string[] { "pack" };
|
||||
}
|
||||
|
||||
public override ResourceScheme Scheme
|
||||
{
|
||||
get { return new KcapScheme { KnownSchemes = KnownSchemes }; }
|
||||
set { KnownSchemes = ((KcapScheme)value).KnownSchemes; }
|
||||
}
|
||||
|
||||
public override ArcFile TryOpen (ArcView file)
|
||||
{
|
||||
int count = file.View.ReadInt32 (4);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:s="clr-namespace:GameRes.Formats.Strings"
|
||||
xmlns:p="clr-namespace:GameRes.Formats.Properties"
|
||||
xmlns:fmt="clr-namespace:GameRes.Formats.Selene"
|
||||
xmlns:local="clr-namespace:GameRes.Formats.GUI"
|
||||
MaxWidth="260">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -22,6 +21,6 @@
|
||||
<Label Content="{x:Static s:arcStrings.LabelScheme}" Target="{Binding ElementName=EncScheme}"
|
||||
Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right"/>
|
||||
<ComboBox Name="EncScheme" Grid.Column="1" Grid.Row="1" Margin="0,3,0,0"
|
||||
ItemsSource="{Binding Source={x:Static fmt:PackOpener.KnownSchemes}, Path=Keys, Mode=OneWay}"
|
||||
ItemsSource="{Binding}"
|
||||
SelectedValue="{Binding Source={x:Static p:Settings.Default}, Path=KCAPScheme, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Windows;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using GameRes.Formats.Properties;
|
||||
using GameRes.Formats.Selene;
|
||||
using GameRes.Formats.Strings;
|
||||
|
||||
namespace GameRes.Formats.GUI
|
||||
{
|
||||
@@ -13,7 +15,9 @@ namespace GameRes.Formats.GUI
|
||||
public WidgetKCAP ()
|
||||
{
|
||||
InitializeComponent ();
|
||||
if (null == EncScheme.SelectedItem)
|
||||
var keys = new[] { arcStrings.ArcDefault };
|
||||
EncScheme.ItemsSource = keys.Concat (PackOpener.KnownSchemes.Keys);
|
||||
if (-1 == EncScheme.SelectedIndex)
|
||||
EncScheme.SelectedIndex = 0;
|
||||
EncScheme.SelectionChanged += OnSchemeChanged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user