From 50606a056a47b26feecc077df6f45b274abc5940 Mon Sep 17 00:00:00 2001 From: morkt Date: Wed, 5 Sep 2018 14:06:14 +0400 Subject: [PATCH] (NOA): added default encoding setting. --- ArcFormats/Entis/ArcNOA.cs | 12 +++++++++--- ArcFormats/Properties/Settings.Designer.cs | 12 ++++++++++++ ArcFormats/Properties/Settings.settings | 3 +++ ArcFormats/app.config | 3 +++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ArcFormats/Entis/ArcNOA.cs b/ArcFormats/Entis/ArcNOA.cs index ef1a4732..4b162457 100644 --- a/ArcFormats/Entis/ArcNOA.cs +++ b/ArcFormats/Entis/ArcNOA.cs @@ -78,8 +78,11 @@ namespace GameRes.Formats.Entis public NoaOpener () { Extensions = new string[] { "noa", "dat", "rsa" }; + Settings = new[] { NoaEncoding }; } + EncodingSetting NoaEncoding = new EncodingSetting ("NOAEncodingCP", "DefaultEncoding"); + public static Dictionary> KnownKeys = new Dictionary>(); @@ -90,7 +93,7 @@ namespace GameRes.Formats.Entis uint id = file.View.ReadUInt32 (8); if (0x02000400 != id) return null; - var reader = new IndexReader (file); + var reader = new IndexReader (file, NoaEncoding.Get()); if (!reader.ParseRoot() || 0 == reader.Dir.Count) return null; if (!reader.HasEncrypted) @@ -275,9 +278,12 @@ namespace GameRes.Formats.Entis public bool HasEncrypted { get { return m_found_encrypted; } } - public IndexReader (ArcView file) + public Encoding Encoding { get; set; } + + public IndexReader (ArcView file, Encoding enc) { m_file = file; + Encoding = enc; } public bool ParseRoot () @@ -332,7 +338,7 @@ namespace GameRes.Formats.Entis uint name_length = m_file.View.ReadUInt32 (dir_offset); dir_offset += 4; - string name = m_file.View.ReadString (dir_offset, name_length); + string name = m_file.View.ReadString (dir_offset, name_length, Encoding); dir_offset += name_length; if (string.IsNullOrEmpty (cur_dir)) diff --git a/ArcFormats/Properties/Settings.Designer.cs b/ArcFormats/Properties/Settings.Designer.cs index 94120fe1..bd127aef 100644 --- a/ArcFormats/Properties/Settings.Designer.cs +++ b/ArcFormats/Properties/Settings.Designer.cs @@ -765,5 +765,17 @@ namespace GameRes.Formats.Properties { this["ODNAudioSampleRate"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("932")] + public int NOAEncodingCP { + get { + return ((int)(this["NOAEncodingCP"])); + } + set { + this["NOAEncodingCP"] = value; + } + } } } diff --git a/ArcFormats/Properties/Settings.settings b/ArcFormats/Properties/Settings.settings index 8bb080fb..1aac9cbc 100644 --- a/ArcFormats/Properties/Settings.settings +++ b/ArcFormats/Properties/Settings.settings @@ -188,5 +188,8 @@ 44100 + + 932 + \ No newline at end of file diff --git a/ArcFormats/app.config b/ArcFormats/app.config index 0f145199..41facb48 100644 --- a/ArcFormats/app.config +++ b/ArcFormats/app.config @@ -190,6 +190,9 @@ 44100 + + 932 +