RtfDomParser.RTFRawDocument.ReadColorTable C# (CSharp) Méthode

ReadColorTable() private méthode

read color table
private ReadColorTable ( RtfDomParser.RTFNodeGroup group ) : void
group RtfDomParser.RTFNodeGroup
Résultat void
        private void ReadColorTable( RTFNodeGroup group )
        {
            myColorTable.Clear();
            int r = -1;
            int g = -1;
            int b = -1;
            foreach (RTFNode node in group.Nodes)
            {
                if (node.Keyword == "red")
                {
                    r = node.Parameter;
                }
                else if (node.Keyword == "green")
                {
                    g = node.Parameter;
                }
                else if (node.Keyword == "blue")
                {
                    b = node.Parameter;
                }
                if (node.Keyword == ";")
                {
                    if (r >= 0 && g >= 0 && b >= 0)
                    {
                        System.Drawing.Color c = System.Drawing.Color.FromArgb(255, r, g, b);
                        myColorTable.Add(c);
                        r = -1;
                        g = -1;
                        b = -1;
                    }
                }
            }
            if (r >= 0 && g >= 0 && b >= 0)
            {
                // read the last color
                System.Drawing.Color c = System.Drawing.Color.FromArgb(255, r, g, b);
                myColorTable.Add(c);
            }
        }