Exemple #1
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.ReadUInt16("signature");
     version = reader.ReadUInt16("version");
     refDataStart = reader.ReadUInt32("ref_data_start");
     unknown = reader.ReadUInt32("unknown");
     XmlNodeList referenceNodes = reader.Node.SelectNodes("./references/reference");
     var numReferences = referenceNodes.Count;
     referenceData = new List<string>(numReferences);
     for (int i = 0; i < numReferences; i++)
         referenceData.Add(referenceNodes[i].InnerText);
 }
 /// <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));
 }
Exemple #3
0
 /// <summary>
 /// Reads the contents of a section block from an XML document.
 /// </summary>
 /// <param name="node">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);
         sectionID = reader.ReadUInt32("id");
         gpuSize = reader.ReadUInt32("gpu_size");
         XmlNode cpuDataNode = reader.GetNodeOptional("cpu_data");
         if (cpuDataNode == null)
             cpuData = null;
         else if (SRRawDataBlock.HasRawXmlData(cpuDataNode))
             cpuData = new SRRawDataBlock(cpuDataNode);
         else
             cpuData = new SRZoneObjectSectionCpuData(cpuDataNode);
     }
     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.
        /// 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.ReadUInt32("signature");
            version = reader.ReadUInt32("version");
            flags = reader.ReadUInt32("flags");
            handleListPointer = reader.ReadUInt32("handle_list_pointer");
            objectDataPointer = reader.ReadUInt32("object_data_pointer");
            objectDataSize = reader.ReadUInt32("object_data_size");
            XmlNodeList handleNodes = reader.Node.SelectNodes("./handles/handle");
            var numHandles = handleNodes.Count;
            handleList = new List<UInt64>((int)numHandles);
            for (int i = 0; i < numHandles; i++)
                handleList.Add(SRXmlNodeReader.ReadUInt64(handleNodes[i]));

            XmlNodeList objectNodes = reader.Node.SelectNodes("./objects/" + SRZoneObject.XmlTagName);
            var numObjects = objectNodes.Count;
            objectList = new List<SRZoneObject>(numObjects);
            for (int i = 0; i < numObjects; i++)
                objectList.Add(new SRZoneObject(objectNodes[i], i));
        }