(Pias): use decimal number for entry names.

This commit is contained in:
morkt 2023-10-27 04:17:21 +04:00
parent 6981d3bf82
commit 1521532bf4
2 changed files with 9 additions and 4 deletions

View File

@ -45,7 +45,7 @@ namespace GameRes.Formats.Pias
internal class IndexReader internal class IndexReader
{ {
internal const bool NamesAsHexOffset = true; internal const bool UseOffsetAsName = true;
protected ArcView m_arc; protected ArcView m_arc;
protected ResourceType m_res; protected ResourceType m_res;
@ -118,7 +118,7 @@ namespace GameRes.Formats.Pias
if (!known_offsets.Contains (offset)) if (!known_offsets.Contains (offset))
{ {
var entry = new Entry { var entry = new Entry {
Name = NamesAsHexOffset ? offset.ToString ("X8") : m_dir.Count.ToString("D4"), Name = GetName (offset, m_dir.Count),
Type = entry_type, Type = entry_type,
Offset = offset, Offset = offset,
Size = entry_size, Size = entry_size,
@ -132,6 +132,11 @@ namespace GameRes.Formats.Pias
} }
return true; return true;
} }
internal string GetName (long offset, int num)
{
return UseOffsetAsName ? offset.ToString ("D8") : num.ToString("D4");
}
} }
[Export(typeof(ArchiveFormat))] [Export(typeof(ArchiveFormat))]

View File

@ -96,7 +96,7 @@ namespace GameRes.Formats.Pias
key.Seed (seed); key.Seed (seed);
Decrypt (buffer, 0, 4, key); Decrypt (buffer, 0, 4, key);
entry.Size = (buffer.ToUInt32 (0) & 0xFFFFFu) + 8u; entry.Size = (buffer.ToUInt32 (0) & 0xFFFFFu) + 8u;
entry.Name = NamesAsHexOffset ? entry.Offset.ToString ("X8") : i.ToString("D4"); entry.Name = GetName (entry.Offset, i);
entry.Type = "image"; entry.Type = "image";
} }
var known_offsets = new HashSet<long> (m_dir.Select (e => e.Offset)); var known_offsets = new HashSet<long> (m_dir.Select (e => e.Offset));
@ -111,7 +111,7 @@ namespace GameRes.Formats.Pias
if (!known_offsets.Contains (offset)) if (!known_offsets.Contains (offset))
{ {
var entry = new Entry { var entry = new Entry {
Name = (NamesAsHexOffset ? offset.ToString ("X8") : m_dir.Count.ToString("D4")) + "_", Name = GetName (offset, m_dir.Count) + "_",
Type = "image", Type = "image",
Offset = offset, Offset = offset,
Size = entry_size, Size = entry_size,