Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StructLayout(LayoutKind.Sequential)]
- public partial class ChunkIdx1 : ChunkBase
- {
- public uint EntryCount { get; set; } = 0;
- public uint EntryMax { get; set; } = 0;
- public Idx1Entry[] Entry { get; set; } = null;
- }
- public partial class ChunkIdx1
- {
- public override ReadResult Read(Stream stream)
- {
- ReadResult result = BeginRead();
- if (result != ReadResult.Ok)
- {
- return result;
- }
- _ = stream.Read<byte>(8); // skip 8 bytes, fcc and size
- uint count = (uint) Math.Min(Size, Size.Even() - 8);
- EntryCount = EntryMax = count;
- if (count > 0)
- {
- Entry = new Idx1Entry[count];
- foreach (Idx1Entry t in Entry)
- {
- t.Fcc = stream.Read<uint>();
- t.Flags = stream.Read<uint>();
- t.Position = stream.Read<uint>();
- t.Length = stream.Read<uint>();
- }
- }
- else
- {
- Entry = null;
- }
- Debug.WriteLine($"idx1: index entry: {count}", "INFO");
- return ReadResult.Ok;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement