(PFS): added option to select filenames encoding (#162)

This commit is contained in:
morkt 2018-03-11 21:12:58 +04:00
parent eafe023de9
commit 8016560d04
11 changed files with 52 additions and 3 deletions

View File

@ -135,6 +135,8 @@
<Compile Include="elf\ArcAi5DAT.cs" />
<Compile Include="elf\ImageRMT.cs" />
<Compile Include="Emote\ImageDREF.cs" />
<Compile Include="FC01\ArcPAK.cs" />
<Compile Include="FrontWing\ArcVAV.cs" />
<Compile Include="Groover\ArcPCG.cs" />
<Compile Include="HCSystem\ArcPAK.cs" />
<Compile Include="HCSystem\ImageOPF.cs" />

View File

@ -23,11 +23,11 @@
// IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace GameRes.Formats.Artemis
{
@ -42,9 +42,12 @@ namespace GameRes.Formats.Artemis
public PfsOpener ()
{
Extensions = new string[] { "pfs", "000", "001", "002", "003" };
Extensions = new string[] { "pfs", "000", "001", "002", "003", "004", "005" };
Settings = new[] { PfsEncoding };
}
EncodingSetting PfsEncoding = new EncodingSetting ("PFSEncodingCP");
public override ArcFile TryOpen (ArcView file)
{
if (!file.View.AsciiEqual (0, "pf"))
@ -65,7 +68,7 @@ namespace GameRes.Formats.Artemis
int count = file.View.ReadInt32 (7);
if (!IsSaneCount (count) || 7L + index_size > file.MaxOffset)
return null;
var encoding = version >= 8 ? System.Text.Encoding.UTF8 : Encodings.cp932;
var encoding = PfsEncoding.Get<Encoding>();
var index = file.View.ReadBytes (7, index_size);
int index_offset = 4;
var dir = new List<Entry> (count);

View File

@ -741,5 +741,17 @@ namespace GameRes.Formats.Properties {
this["OGGFixCrc"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("65001")]
public int PFSEncodingCP {
get {
return ((int)(this["PFSEncodingCP"]));
}
set {
this["PFSEncodingCP"] = value;
}
}
}
}

View File

@ -182,5 +182,8 @@
<Setting Name="OGGFixCrc" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="PFSEncodingCP" Type="System.Int32" Scope="User">
<Value Profile="(Default)">65001</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -660,6 +660,15 @@ namespace GameRes.Formats.Strings {
}
}
/// <summary>
/// Looks up a localized string similar to Default file names encoding.
/// </summary>
public static string PFSEncodingCP {
get {
return ResourceManager.GetString("PFSEncodingCP", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use default encryption scheme.
/// </summary>

View File

@ -498,4 +498,7 @@ Choose encryption scheme or enter a passphrase.</comment>
<data name="ZIPEncodingCP" xml:space="preserve">
<value>Default file names encoding</value>
</data>
<data name="PFSEncodingCP" xml:space="preserve">
<value>Default file names encoding</value>
</data>
</root>

View File

@ -399,4 +399,8 @@
<value>Default file names encoding</value>
<comment>translation pending</comment>
</data>
<data name="PFSEncodingCP" xml:space="preserve">
<value>Default file names encoding</value>
<comment>translation pending</comment>
</data>
</root>

View File

@ -398,4 +398,7 @@ Choose encryption scheme or enter a passphrase.</value>
<data name="ZIPEncodingCP" xml:space="preserve">
<value>Default file names encoding</value>
</data>
<data name="PFSEncodingCP" xml:space="preserve">
<value>Default file names encoding</value>
</data>
</root>

View File

@ -291,6 +291,9 @@
<data name="PDScrambleContents" xml:space="preserve">
<value>Шифровать содержимое</value>
</data>
<data name="PFSEncodingCP" xml:space="preserve">
<value>Кодировка имён файлов</value>
</data>
<data name="QLIEDefaultScheme" xml:space="preserve">
<value>"Старый" метод шифрования</value>
</data>

View File

@ -400,4 +400,8 @@
<value>Default file names encoding</value>
<comment>translation pending</comment>
</data>
<data name="PFSEncodingCP" xml:space="preserve">
<value>Default file names encoding</value>
<comment>translation pending</comment>
</data>
</root>

View File

@ -184,6 +184,9 @@
<setting name="OGGFixCrc" serializeAs="String">
<value>False</value>
</setting>
<setting name="PFSEncodingCP" serializeAs="String">
<value>65001</value>
</setting>
</GameRes.Formats.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>