Exemplo n.º 1
0
 // See description of this method in the abstract base class SRZoneProperty.
 protected override void ReadXmlData(XmlNode thisNode)
 {
     SRXmlNodeReader reader = new SRXmlNodeReader(thisNode);
     value = reader.ReadString("string");
 }
Exemplo n.º 2
0
 /// <summary>
 /// Reads the contents of a data block from an XML document.
 /// </summary>
 /// <param name="thisNode">XML node which represents an instance of this data block.</param>
 /// <param name="index">Index within a sequence (starts at 0).</param>
 public void ReadXml(XmlNode thisNode, int index)
 {
     try
     {
         SRXmlNodeReader reader = new SRXmlNodeReader(thisNode);
         name = reader.ReadString("name");
         if (name == "") name = null;
         handleOffset = reader.ReadUInt64("handle");
         parentHandleOffset = reader.ReadUInt64("parent_handle");
         objectTypeHash = reader.ReadInt32("object_type_hash");
         padding = reader.ReadUInt16("padding");
         XmlNodeList propertyNodes = reader.Node.SelectNodes("./properties/" + SRZoneProperty.XmlTagName);
         propertyList = new List<SRZoneProperty>(propertyNodes.Count);
         for (int i = 0; i < propertyNodes.Count; i++)
             propertyList.Add(SRZoneProperty.Create(propertyNodes[i], i));
     }
     catch (Exception e)
     {
         // Add context information for the error message
         if (index >= 0)
             e.Data[BlockName] = index + 1;
         throw;
     }
 }
 /// <summary>
 /// Reads the contents of a data block from an XML document.
 /// </summary>
 /// <param name="thisNode">XML node which represents an instance of this data block.</param>
 /// <param name="index">Index within a sequence (starts at 0).</param>
 public void ReadXml(XmlNode thisNode, int index)
 {
     try
     {
         SRXmlNodeReader reader = new SRXmlNodeReader(thisNode);
         name = reader.ReadString("file");
         m_pos_x = MeshPosToInt16(reader.ReadSingle("pos_x"));
         m_pos_y = MeshPosToInt16(reader.ReadSingle("pos_y"));
         m_pos_z = MeshPosToInt16(reader.ReadSingle("pos_z"));
         pitch = MeshOrientToInt16(reader.ReadSingle("pitch"));
         bank = MeshOrientToInt16(reader.ReadSingle("bank"));
         heading = MeshOrientToInt16(reader.ReadSingle("heading"));
     }
     catch (Exception e)
     {
         // Add context information for the error message
         if (index >= 0)
             e.Data[BlockName] = index + 1;
         throw;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Reads the contents of a data block from an XML document.
 /// This may read one or more nodes from the given parentNode.
 /// This can return false if it doesn't find any data nodes in the parentNode.
 /// </summary>
 /// <param name="parentNode">XML node to read from.</param>
 /// <returns>true</returns>
 public override void ReadXml(XmlNode parentNode)
 {
     SRXmlNodeReader reader = new SRXmlNodeReader(parentNode, XmlTagName);
     signature = reader.ReadString("signature");
     version = reader.ReadUInt32("version");
     fileReferenceOffset = new SRPosition(reader.Node, "file_reference_offset");
     fileReferencesPtr = reader.ReadUInt32("file_references_ptr");
     zoneType = (Byte)reader.ReadUInt16("zone_type");
     XmlNodeList referenceNodes = reader.Node.SelectNodes("./mesh_file_references/" + SRZoneMeshFileReference.XmlTagName);
     references = new List<SRZoneMeshFileReference>(referenceNodes.Count);
     for (int i = 0; i < referenceNodes.Count; i++)
         references.Add(new SRZoneMeshFileReference(referenceNodes[i], i, vFileHeader));
 }