implemented external storage of resource schemes.

This commit is contained in:
morkt
2015-09-18 01:27:53 +04:00
parent eef86f0804
commit 9a8bff184d
32 changed files with 478 additions and 1431 deletions

View File

@@ -50,6 +50,12 @@ namespace GameRes.Formats.Marble
}
}
[Serializable]
public class MblScheme : ResourceScheme
{
public Dictionary<string, string> KnownKeys;
}
[Export(typeof(ArchiveFormat))]
public class MblOpener : ArchiveFormat
{
@@ -150,13 +156,13 @@ namespace GameRes.Formats.Marble
}
}
public static Dictionary<string, string> KnownKeys = new Dictionary<string, string> {
{ arcStrings.ArcDefault, "" },
{ "Chikatetsu Fuusa Jiken", "naze" }, // 地下鉄封鎖事件
{ "Eien no Owari ni", "eientamasoft" }, // 永遠の終わりに
{ "Sakura Machizaka Stories", "sakura桜" }, // 桜待坂Stories vol.1/vol.2
{ "Trouble Succubus", "とらぶるサッキュバス-0928-2007" }, // とらぶるサッキュバス
};
public static Dictionary<string, string> KnownKeys = new Dictionary<string, string>();
public override ResourceScheme Scheme
{
get { return new MblScheme { KnownKeys = KnownKeys }; }
set { KnownKeys = ((MblScheme)value).KnownKeys; }
}
public override Stream OpenEntry (ArcFile arc, Entry entry)
{

View File

@@ -9,7 +9,7 @@
<RowDefinition/>
</Grid.RowDefinitions>
<ComboBox Name="EncScheme" Grid.Row="0" Margin="0,3,0,0" Width="180" HorizontalAlignment="Right"
ItemsSource="{Binding Source={x:Static m:MblOpener.KnownKeys}, Mode=OneWay}"
ItemsSource="{Binding}"
DisplayMemberPath="Key" SelectedValuePath="Value"
SelectedValue="{Binding ElementName=PassPhrase, Path=Text, Mode=TwoWay}"/>
<TextBox Name="PassPhrase" Grid.Row="1" Margin="0,3,0,3" Width="{Binding ElementName=EncScheme, Path=ActualWidth}" HorizontalAlignment="Right"

View File

@@ -1,4 +1,8 @@
using System.Windows.Controls;
using GameRes.Formats.Marble;
using GameRes.Formats.Strings;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
namespace GameRes.Formats.GUI
{
@@ -10,6 +14,10 @@ namespace GameRes.Formats.GUI
public WidgetMBL ()
{
InitializeComponent ();
var keys = new[] { new KeyValuePair<string, string> (arcStrings.ArcDefault, "") };
EncScheme.ItemsSource = keys.Concat (MblOpener.KnownKeys);
if (-1 == EncScheme.SelectedIndex)
EncScheme.SelectedIndex = 0;
}
}
}