Beispiel #1
0
        void DeserializeNodeTree(Stream file, NodeResource deserializedParentNode, ref int bytesRead, bool debug, bool assemblyMode)
        {
            int childCount = deserializedParentNode.GetNumberOfChildren();

            for (int i = 0; i < childCount; i++)
            {
                NodeResource node = NodeResource.DeserializeNode(file, ref bytesRead, debug, assemblyMode);

                deserializedParentNode.AddChildNode(node);

                DeserializeNodeTree(file, node, ref bytesRead, debug, assemblyMode);
            }
        }
        public override NodeResource Serialize(SerializedAssets serializedAssets, NodeResource serializedParent, ISerializeLogging logger)
        {
            NodeResource serializedNode = new NodeResource(this.resourceType, this.referenceID, this.name);

            logger.LogNode(this);

            if (serializedParent != null)
            {
                serializedParent.AddChildNode(serializedNode);
            }

            foreach (NodeBase child in this.ChildNodes)
            {
                child.Serialize(serializedAssets, serializedNode, logger);
            }

            if (serializedParent == null)
            {
                return(serializedNode);
            }

            return(null);
        }