Пример #1
0
        public static BlockStatement Clone(this BlockStatement bs)
        {
            Type           t = bs.GetType();
            BlockStatement d = Activator.CreateInstance(t) as BlockStatement;

            foreach (Statement cst in bs.Body)
            {
                d.Body.Add(Clone(cst));
            }
            return(d);
        }
Пример #2
0
        private static XmlNode CreateBlockStatementNode(BlockStatement e, XmlDocument xmlDoc, Nullable <Point> point = null)
        {
            XmlNode exNode = CreateNode(xmlDoc, "BlockStatement", "type", GetTypeName(e.GetType()));

            if (point != null)
            {
                exNode.Attributes.Append(CreateAttribute(xmlDoc, "x", point.Value.X + ""));
                exNode.Attributes.Append(CreateAttribute(xmlDoc, "y", point.Value.Y + ""));
            }
            //xmlDoc.CreateElement("BlockStatement");
            XmlNode bNode = xmlDoc.CreateElement("Body");

            exNode.AppendChild(bNode);

            foreach (Statement s in e.Body)
            {
                bNode.AppendChild(CreateStatementNode(s, xmlDoc));
            }
            return(exNode);
        }