示例#1
0
        private void WriteBlock(Stream stream, AseColorGroupData block)
        {
            int blockLength;

            blockLength = this.GetBlockLength(block);

            // write the start group block
            stream.WriteBigEndian((ushort)AseBlockType.GroupStart);
            stream.WriteBigEndian(blockLength);
            this.WriteNullTerminatedString(stream, block.Name);
            this.WriteExtraData(stream, block.ExtraData);

            // write the colors in the group
            foreach (var color in block.Colors)
            {
                this.WriteBlock(stream, color);
            }

            // and write the end group block
            stream.WriteBigEndian((ushort)AseBlockType.GroupEnd);
            stream.WriteBigEndian(0); // there isn't any data, but we still need to specify that
        }
示例#2
0
        private _BlockData ReadGroupBlock(Stream stream, AseColorGroupCollection groups, Stack <AseColorEntryCollection> colorStack)
        {
            AseColorGroupData block;
            string            name;

            // read the name of the group
            name = stream.ReadStringBigEndian();

            // create the group and add it to the results set
            block = new AseColorGroupData
            {
                Name = name
            };

            groups.Add(block);

            // add the group color collection to the stack, so when subsequent color blocks
            // are read, they will be added to the correct collection
            colorStack.Push(block.Colors);

            return(block);
        }