// PROTECTED READERS / WRITERS
 // See description of this method in the abstract base class SRZoneProperty.
 protected override void ReadData(SRBinaryReader binaryReader, int size)
 {
     position = new SRPosition(binaryReader);
     SRTrace.WriteLine("        Value:     Position (x,y,z):  " + position.ToString());
     if (size != 12)
         throw new SRZoneFileException("Transform length is wrong.");
 }
 // CONSTRUCTORS
 public SRZoneTransformOrientationProperty(Int32 nameCrc, SRPosition position = null, SRQuaternionOrientation orientation = null)
     : base(nameCrc, position)
 {
     this.orientation = orientation != null ? orientation : new SRQuaternionOrientation();
 }
 // See description of this method in the abstract base class SRZoneProperty.
 protected override void ReadXmlData(XmlNode parentNode)
 {
     position = new SRPosition(parentNode);
 }
 // CONSTRUCTORS
 public SRZoneTransformProperty(Int32 nameCrc, SRPosition position = null)
 {
     this.nameCrc = nameCrc;
     this.position = position != null ? position : new SRPosition();
 }
 /// <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));
 }
 // READERS / WRITERS
 /// <summary>
 /// Reads a data block from a file binary stream.
 /// </summary>
 /// <param name="binaryReader">Binary reader to read the block from.  Must point to the beginning of the block.</param>
 /// <param name="size">Maximum number of bytes to read.</param>
 public void Read(SRBinaryReader binaryReader)
 {
     binaryReader.Align(Alignment);
     SRTrace.WriteLine("");
     SRTrace.WriteLine("WORLD ZONE HEADER:  [file offset 0x{0:X8}]", binaryReader.BaseStream.Position);
     signature = new string(binaryReader.ReadChars(4));
     SRTrace.WriteLine("  World Zone Signature:   " + signature);
     if (signature != "SR3Z")
         throw new SRZoneFileException("Incorrect world zone signature.", binaryReader.BaseStream.Position - 4);
     version = binaryReader.ReadUInt32();
     SRTrace.WriteLine("  World Zone Version:     {0}", version);
     if (version != 29 && version != 32)  // version 29 = SR3, 32 = SR4
         throw new SRZoneFileException("Incorrect world zone version.");
     int v_file_header_ptr = binaryReader.ReadInt32();
     SRTrace.WriteLine("  V-File Header Pointer:  0x{0:X8}", v_file_header_ptr);
     fileReferenceOffset = new SRPosition(binaryReader);
     SRTrace.WriteLine("  File Reference Offset:  {0}", fileReferenceOffset.ToString());
     fileReferencesPtr = binaryReader.ReadUInt32();
     SRTrace.WriteLine("  WZ File Reference Ptr:  0x{0:X8}", fileReferencesPtr);
     int num_file_references = binaryReader.ReadInt16();
     SRTrace.WriteLine("  Number of File Refs:    {0}", num_file_references);
     zoneType = binaryReader.ReadByte();
     string typeName = (zoneType < WorldZoneTypeNames.Length) ? WorldZoneTypeNames[zoneType] : "unknown";
     SRTrace.WriteLine("  Zone Type:              {0} ({1})", zoneType, typeName);
     int unused = binaryReader.ReadByte();
     SRTrace.WriteLine("  Unused:                 {0}", unused);
     if (unused != 0)
         throw new SRZoneFileException("Expected unused field to be zero.");
     int interiorTriggerPtr = binaryReader.ReadInt32();
     SRTrace.WriteLine("  Interior Trigger Ptr:   0x{0:X8}  (run-time)", interiorTriggerPtr);
     if (interiorTriggerPtr != 0)
         throw new SRZoneFileException("Expected interior trigger pointer to be zero.");
     int numberOfTriggers = binaryReader.ReadInt16();
     SRTrace.WriteLine("  Number of Triggers:     {0,-10}  (run-time)", numberOfTriggers);
     if (numberOfTriggers != 0)
         throw new SRZoneFileException("Expected number of triggers to be zero.");
     int extraObjects = binaryReader.ReadInt16();
     SRTrace.WriteLine("  Extra Objects:          {0}", extraObjects);
     if (extraObjects != 0)
         throw new SRZoneFileException("Expected extra objects to be zero.");
     binaryReader.BaseStream.Seek(24, SeekOrigin.Current);
     SRTrace.WriteLine("");
     SRTrace.WriteLine("  MESH FILE REFERENCES:  [file offset 0x{0:X8}]", binaryReader.BaseStream.Position);
     references = new List<SRZoneMeshFileReference>(num_file_references);
     for (int i = 0; i < num_file_references; i++)
         references.Add(new SRZoneMeshFileReference(binaryReader, i, vFileHeader));
 }