コード例 #1
0
        public void ReadXml(XmlReader reader)
        {
            XmlSerializer featureSerializer = new XmlSerializer(typeof(AtlasFeature));

            //Reading Features
            reader.ReadToFollowing("Features");
            XmlReader featureReader = reader.ReadSubtree();

            while (featureReader.ReadToFollowing("AtlasFeature"))
            {
                AddFeature((AtlasFeature)featureSerializer.Deserialize(featureReader));
            }
            featureReader.Close();

            reader.ReadToFollowing("RootFeature");
            string rootName = reader.ReadElementContentAsString();

            rootFeature = GetFeature(rootName);

            //Reading Connections
            if (!reader.Name.Equals("Connections"))
            {
                reader.ReadToFollowing("Connections");
            }
            XmlReader connectionReader = reader.ReadSubtree();

            while (connectionReader.ReadToFollowing("AtlasConnection"))
            {
                AtlasFeature        child  = GetFeature(reader["Child"]);
                AtlasFeature        parent = GetFeature(reader["Parent"]);
                AtlasConnectionType type   = (AtlasConnectionType)int.Parse(reader["Type"]);
                AddConnection(parent, child, type);
            }
            connectionReader.Close();

            //Reading Constraints
            if (!reader.Name.Equals("Constraints"))
            {
                reader.ReadToFollowing("Constraints");
            }
            XmlReader constraintReader = reader.ReadSubtree();

            while (constraintReader.ReadToFollowing("AtlasConstraint"))
            {
                AtlasConstraintValidationQueue queue = new AtlasConstraintValidationQueue(constraintReader["Content"]);
                queue.Normalize();
                AddConstraint(queue);
            }
            constraintReader.Close();

            reader.Close();
        }