Esempio n. 1
0
        public override void Read(EndianBinaryReader reader, ISection section = null)
        {
            int  aetSetCount   = reader.ReadInt32();
            long aetSetsOffset = reader.ReadOffset();
            int  aetCount      = reader.ReadInt32();
            long aetsOffset    = reader.ReadOffset();

            reader.ReadAtOffset(aetSetsOffset, () =>
            {
                AetSets.Capacity = aetSetCount;

                for (int i = 0; i < aetSetCount; i++)
                {
                    uint id          = reader.ReadUInt32();
                    string name      = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                    string fileName  = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                    int index        = reader.ReadInt32();
                    uint spriteSetId = reader.ReadUInt32();

                    AetSets.Add(new AetSetInfo
                    {
                        Id          = id,
                        Name        = name,
                        FileName    = fileName,
                        SpriteSetId = spriteSetId
                    });
                }
            });

            reader.ReadAtOffset(aetsOffset, () =>
            {
                for (int i = 0; i < aetCount; i++)
                {
                    uint id     = reader.ReadUInt32();
                    string name = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                    int info    = reader.ReadInt32();

                    if (section?.Format == BinaryFormat.X)
                    {
                        reader.SkipNulls(sizeof(uint));
                    }

                    ushort index    = ( ushort )(info & 0xFFFF);
                    ushort setIndex = ( ushort )((info >> 16) & 0xFFFF);

                    var aetInfo = new AetInfo
                    {
                        Id    = id,
                        Name  = name,
                        Index = index
                    };

                    AetSets[setIndex].Aets.Add(aetInfo);
                }
            });
        }
Esempio n. 2
0
        public override void Read(EndianBinaryReader reader, ISection section = null)
        {
            int  aetSetCount   = reader.ReadInt32();
            long aetSetsOffset = reader.ReadOffset();
            int  aetCount      = reader.ReadInt32();
            long aetsOffset    = reader.ReadOffset();

            reader.ReadAtOffset(aetSetsOffset, () =>
            {
                AetSets.Capacity = aetSetCount;
                for (int i = 0; i < aetSetCount; i++)
                {
                    int id          = reader.ReadInt32();
                    string name     = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                    string fileName = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);
                    int index       = reader.ReadInt32();
                    int spriteSetId = reader.ReadInt32();

                    AetSets.Add(new AetSetInfo
                    {
                        Id          = id,
                        Name        = name,
                        FileName    = fileName,
                        SpriteSetId = spriteSetId,
                    });
                }
            });

            reader.ReadAtOffset(aetsOffset, () =>
            {
                for (int i = 0; i < aetCount; i++)
                {
                    int id      = reader.ReadInt32();
                    string name = reader.ReadStringOffset(StringBinaryFormat.NullTerminated);

                    int info     = reader.ReadInt32();
                    int index    = info & 0xFFFF;
                    int setIndex = (info >> 16) & 0xFFFF;

                    var aetInfo = new AetInfo
                    {
                        Id    = id,
                        Name  = name,
                        Index = index,
                    };

                    AetSets[setIndex].Aets.Add(aetInfo);
                }
            });
        }