コード例 #1
0
        /// <summary> Converts the XElement into a SerializeNode </summary>
        public static SerializeNode Deserialize(XElement root)
        {
            // ReSharper disable PossibleNullReferenceException
            var typeId = root.Attribute(TypeIdAttributeName).Value;

            var node = new SerializeNode(typeId);

            // recreate each element
            foreach (var attributeElement in root.Elements(AttributeElementName))
            {
                node.AddData(attributeElement.Attribute(KeyAttributeName).Value,
                             attributeElement.Attribute(ValueAttributeName).Value);
            }

            // recreate each block
            foreach (var childElement in root.Elements(NodeElementName))
            {
                node.Children.Add(Deserialize(childElement));
            }

            return(node);
            // ReSharper restore PossibleNullReferenceException
        }
コード例 #2
0
 /// <summary />
 public void SerializeInto(SerializeNode node)
 {
     node.AddData("Body", _buffer.GetText());
 }