Exemple #1
0
        private void Write(XmlNode xRoot, GffComponent vChild)
        {
            XmlElement xChild;

            if (vChild is GffStruct)
            {
                xChild = Xdoc.CreateElement(EStruct);
            }
            else if (vChild is GffList)
            {
                xChild = Xdoc.CreateElement(EList);
            }
            else if (vChild is GffField)
            {
                xChild = Xdoc.CreateElement(EField);
            }
            else
            {
                throw new ComponentException("Type de composant inconnu.");
            }
            WriteLabel(xChild, vChild);
            var child = vChild as GffStruct;

            if (child != null)
            {
                WriteStruct(xChild, child);
            }
            else if (vChild is GffField)
            {
                WriteField(xChild, vChild);
            }

            xRoot.AppendChild(xChild);

            var composite = vChild as GffComposite;

            if (composite == null)
            {
                return;
            }
            var cvChild = composite;

            foreach (var vChild2 in cvChild)
            {
                Write(xChild, vChild2);
            }
        }