refactor: Rename & Format

This commit is contained in:
Crsky
2026-04-02 05:58:19 +08:00
parent e8853332e2
commit 5c8dee7b03

View File

@@ -81,7 +81,7 @@ namespace GameRes.Formats.NeXAS
Settings = new[] { PacEncoding }; Settings = new[] { PacEncoding };
} }
EncodingSetting PacEncoding = new EncodingSetting ("NexasEncodingCP", "DefaultEncoding"); readonly EncodingSetting PacEncoding = new EncodingSetting ("NexasEncodingCP", "DefaultEncoding");
public override ArcFile TryOpen (ArcView file) public override ArcFile TryOpen (ArcView file)
{ {
@@ -89,7 +89,7 @@ namespace GameRes.Formats.NeXAS
return null; return null;
List<Entry> dir = null; List<Entry> dir = null;
INexasIndexReader reader = new IndexReader (file, PacEncoding.Get<Encoding>()); INexasIndexReader reader = new IndexReaderV1 (file, PacEncoding.Get<Encoding> ());
try try
{ {
dir = reader.Read (); dir = reader.Read ();
@@ -98,7 +98,7 @@ namespace GameRes.Formats.NeXAS
if (null == dir) if (null == dir)
{ {
reader = new OldIndexReader (file); reader = new IndexReaderV0 (file);
dir = reader.Read (); dir = reader.Read ();
if (null == dir) if (null == dir)
@@ -110,18 +110,18 @@ namespace GameRes.Formats.NeXAS
return new PacArchive (file, this, dir, reader.PackType); return new PacArchive (file, this, dir, reader.PackType);
} }
internal sealed class IndexReader : INexasIndexReader internal sealed class IndexReaderV1 : INexasIndexReader
{ {
ArcView m_file; readonly ArcView m_file;
int m_count; readonly int m_count;
int m_pack_type; readonly int m_pack_type;
Encoding m_encoding; readonly Encoding m_encoding;
const int MaxNameLength = 0x40; const int MaxNameLength = 0x40;
public Compression PackType { get { return (Compression)m_pack_type; } } public Compression PackType { get { return (Compression)m_pack_type; } }
public IndexReader (ArcView file, Encoding enc) public IndexReaderV1 (ArcView file, Encoding enc)
{ {
m_file = file; m_file = file;
m_count = file.View.ReadInt32 (4); m_count = file.View.ReadInt32 (4);
@@ -212,14 +212,14 @@ namespace GameRes.Formats.NeXAS
} }
} }
internal sealed class OldIndexReader : INexasIndexReader internal sealed class IndexReaderV0 : INexasIndexReader
{ {
ArcView m_file; readonly ArcView m_file;
uint m_header_size; readonly uint m_header_size;
public Compression PackType { get { return Compression.NeedDecryptionOnly; } } public Compression PackType { get { return Compression.NeedDecryptionOnly; } }
public OldIndexReader (ArcView file) public IndexReaderV0 (ArcView file)
{ {
m_file = file; m_file = file;
m_header_size = file.View.ReadUInt32 (3); m_header_size = file.View.ReadUInt32 (3);