FSO.Files.Formats.IFF.Chunks.PALT.Read C# (CSharp) Method

Read() public method

Reads a PALT chunk from a stream.
public Read ( IffFile iff, Stream stream ) : void
iff IffFile An Iff instance.
stream Stream A Stream object holding a PALT chunk.
return void
        public override void Read(IffFile iff, Stream stream)
        {
            using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
            {
                var version = io.ReadUInt32();
                var numEntries = io.ReadUInt32();
                var reserved = io.ReadBytes(8);

                Colors = new Color[numEntries];
                for (var i = 0; i < numEntries; i++)
                {
                    var r = io.ReadByte();
                    var g = io.ReadByte();
                    var b = io.ReadByte();
                    Colors[i] = new Color(r, g, b);
                }
            }
        }