Files
Bruce d1813637c5 Organized the project files.
And also fixed some bugs.
2025-12-08 16:06:13 +08:00

38 lines
1.1 KiB
C#

using System.IO;
using System.Runtime.InteropServices;
namespace PriFileFormat
{
public class TocEntry
{
public string SectionIdentifier { get; }
public ushort Flags { get; }
public ushort SectionFlags { get; }
public uint SectionQualifier { get; }
public uint SectionOffset { get; }
public uint SectionLength { get; }
private TocEntry (string sectionIdentifier, ushort flags, ushort sectionFlags, uint sectionQualifier, uint sectionOffset, uint sectionLength)
{
SectionIdentifier = sectionIdentifier;
Flags = flags;
SectionFlags = sectionFlags;
SectionQualifier = sectionQualifier;
SectionOffset = sectionOffset;
SectionLength = sectionLength;
}
internal static TocEntry Parse (BinaryReader binaryReader)
{
return new TocEntry (
new string (binaryReader.ReadChars (16)),
binaryReader.ReadUInt16 (),
binaryReader.ReadUInt16 (),
binaryReader.ReadUInt32 (),
binaryReader.ReadUInt32 (),
binaryReader.ReadUInt32 ());
}
public override string ToString ()
{
return $"{SectionIdentifier.TrimEnd ('\0', ' ')} length: {SectionLength}";
}
}
}