Ejemplo n.º 1
0
        public void LoadXML(XmlNode node)
        {
            // Read components
            int componentID = 0;

            foreach (var childNode in node.FirstChild.ChildNodes.OfType <XmlNode>())
            {
                MeshCube cube = new MeshCube();
                cube.ID = componentID++;
                cube.LoadXML(childNode);
                AddComponent(cube);
            }

            // Seal
            Seal();
        }
Ejemplo n.º 2
0
        public void LoadXML(XmlNode node)
        {
            // ID
            this.ID = int.Parse(node.Attributes[Helper.Check(() => this.ID)].Value, ExportationConstants.XML_FORMATTER);

            // Mesh
            MeshCube mesh = new MeshCube();

            mesh.LoadXML(node.SelectSingleNode(ExportationConstants.XML_MESHCUBE_IDENT));
            Mesh = mesh;

            // Virtual pieces
            VirtualPieces = new List <VirtualPiece>();
            if (node.SelectSingleNode(ExportationConstants.XML_VIRTUAL_PIECE_COLLECTION_IDENT) != null)
            {
                foreach (var virtualPieceNode in node.SelectSingleNode(ExportationConstants.XML_VIRTUAL_PIECE_COLLECTION_IDENT).ChildNodes.OfType <XmlNode>())
                {
                    VirtualPiece virtualPiece = new VirtualPiece();
                    virtualPiece.LoadXML(virtualPieceNode);
                    virtualPiece.Container = this;
                    VirtualPieces.Add(virtualPiece);
                }
            }

            // Slants
            Slants = new List <Slant>();
            if (node.SelectSingleNode(ExportationConstants.XML_SLANT_COLLECTION_IDENT) != null)
            {
                foreach (var slantNode in node.SelectSingleNode(ExportationConstants.XML_SLANT_COLLECTION_IDENT).ChildNodes.OfType <XmlNode>())
                {
                    Slant slant = new Slant();
                    slant.LoadXML(slantNode);
                    slant.Container = this;
                    Slants.Add(slant);
                }
            }

            // Seal
            this.Seal();
        }