Example #1
0
        public void Load(Stream stream)
        {
            Stack <ColorEntryCollection> colors;
            ColorGroupCollection         groups;
            ColorEntryCollection         globalColors;

            groups       = new ColorGroupCollection();
            globalColors = new ColorEntryCollection();
            colors       = new Stack <ColorEntryCollection>();

            // add the global collection to the bottom of the stack to handle color blocks outside of a group
            colors.Push(globalColors);

            int blockCount;

            this.ReadAndValidateVersion(stream);

            blockCount = stream.ReadUInt32BigEndian();

            for (int i = 0; i < blockCount; i++)
            {
                this.ReadBlock(stream, groups, colors);
            }

            this.Groups = groups;
            this.Colors = globalColors;
        }
        private void LoadColors(ColorEntryCollection colors, TreeNode root)
        {
            foreach (ColorEntry color in colors)
            {
                TreeNode node;

                node = new TreeNode
                {
                    Text             = $"{color.Name} [RGB({color.R}, {color.G}, {color.B}) {color.Type}]",
                    ImageKey         = "color",
                    SelectedImageKey = "color"
                };

                root.Nodes.Add(node);
            }
        }