Beispiel #1
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)){
                var  version1 = io.ReadUInt16();
                var  version2 = io.ReadUInt16();
                uint version  = 0;

                if (version1 == 0)
                {
                    io.ByteOrder = ByteOrder.BIG_ENDIAN;
                    version      = version2;
                }
                else
                {
                    version = version1;
                }

                var spriteCount = io.ReadUInt32();
                PaletteID = (ushort)io.ReadUInt32();

                Frames = new List <SPRFrame>();
                if (version != 1001)
                {
                    var offsetTable = new List <uint>();
                    for (var i = 0; i < spriteCount; i++)
                    {
                        offsetTable.Add(io.ReadUInt32());
                    }
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
                else
                {
                    while (io.HasMore)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
            }
        }
Beispiel #2
0
        public override void Read(Iff iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN)){
                var version1 = io.ReadUInt16();
                var version2 = io.ReadUInt16();
                uint version = 0;

                if (version1 == 0){
                    io.ByteOrder = ByteOrder.BIG_ENDIAN;
                    version = version2;
                }else{
                    version = version1;
                }

                var spriteCount = io.ReadUInt32();
                PaletteID = (ushort)io.ReadUInt32();

                Frames = new List<SPRFrame>();
                if (version != 1001){
                    var offsetTable = new List<uint>();
                    for (var i = 0; i < spriteCount; i++)
                    {
                        offsetTable.Add(io.ReadUInt32());
                    }
                    for (var i = 0; i < spriteCount; i++)
                    {
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }else{
                    while (io.HasMore){
                        var frame = new SPRFrame(this);
                        frame.Read(version, io);
                        Frames.Add(frame);
                    }
                }
            }
        }