(NOA): added default encoding setting.

This commit is contained in:
morkt 2018-09-05 14:06:14 +04:00
parent c029d97de1
commit 50606a056a
4 changed files with 27 additions and 3 deletions

View File

@ -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<string, Dictionary<string, string>> KnownKeys =
new Dictionary<string, Dictionary<string, string>>();
@ -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<Encoding>());
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))

View File

@ -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;
}
}
}
}

View File

@ -188,5 +188,8 @@
<Setting Name="ODNAudioSampleRate" Type="System.UInt32" Scope="User">
<Value Profile="(Default)">44100</Value>
</Setting>
<Setting Name="NOAEncodingCP" Type="System.Int32" Scope="User">
<Value Profile="(Default)">932</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -190,6 +190,9 @@
<setting name="ODNAudioSampleRate" serializeAs="String">
<value>44100</value>
</setting>
<setting name="NOAEncodingCP" serializeAs="String">
<value>932</value>
</setting>
</GameRes.Formats.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>