mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
chore: code enhancement
This commit is contained in:
@@ -45,7 +45,14 @@ namespace GameRes.Formats.NeXAS
|
|||||||
None2,
|
None2,
|
||||||
Zstd,
|
Zstd,
|
||||||
ZstdOrNone,
|
ZstdOrNone,
|
||||||
NeedDecryptionOnly = 0xFDFD, // magic number, no actual meaning
|
NeedDecryptionOnly = 0xFDFD, // internal magic number
|
||||||
|
}
|
||||||
|
|
||||||
|
internal interface INexasIndexReader
|
||||||
|
{
|
||||||
|
Compression PackType { get; }
|
||||||
|
|
||||||
|
List<Entry> Read ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PacArchive : ArcFile
|
public class PacArchive : ArcFile
|
||||||
@@ -82,7 +89,7 @@ namespace GameRes.Formats.NeXAS
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<Entry> dir = null;
|
List<Entry> dir = null;
|
||||||
dynamic reader = new IndexReader (file, PacEncoding.Get<Encoding>());
|
INexasIndexReader reader = new IndexReader (file, PacEncoding.Get<Encoding>());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dir = reader.Read();
|
dir = reader.Read();
|
||||||
@@ -103,7 +110,7 @@ namespace GameRes.Formats.NeXAS
|
|||||||
return new PacArchive (file, this, dir, reader.PackType);
|
return new PacArchive (file, this, dir, reader.PackType);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class IndexReader
|
internal sealed class IndexReader : INexasIndexReader
|
||||||
{
|
{
|
||||||
ArcView m_file;
|
ArcView m_file;
|
||||||
int m_count;
|
int m_count;
|
||||||
@@ -205,7 +212,7 @@ namespace GameRes.Formats.NeXAS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class OldIndexReader
|
internal sealed class OldIndexReader : INexasIndexReader
|
||||||
{
|
{
|
||||||
ArcView m_file;
|
ArcView m_file;
|
||||||
uint m_header_size;
|
uint m_header_size;
|
||||||
|
|||||||
@@ -42,8 +42,11 @@ namespace GameRes.Formats.Duke
|
|||||||
|
|
||||||
public override ArcFile TryOpen (ArcView file)
|
public override ArcFile TryOpen (ArcView file)
|
||||||
{
|
{
|
||||||
|
if (!file.Name.HasExtension (".dat"))
|
||||||
|
return null;
|
||||||
|
|
||||||
int count = (int)(file.View.ReadUInt32 (0) ^ 0xfa261efb);
|
int count = (int)(file.View.ReadUInt32 (0) ^ 0xfa261efb);
|
||||||
if (!file.Name.HasExtension (".dat") || !IsSaneCount (count))
|
if (!IsSaneCount (count))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
uint index_offset = 4;
|
uint index_offset = 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user