public SRZoneMeshFileReference(XmlNode parentNode, int index, SRVFileHeader vFileHeader)
 {
     this.vFileHeader = vFileHeader;
     ReadXml(parentNode, index);
 }
 // CONSTRUCTORS
 public SRZoneMeshFileReference(SRVFileHeader vFileHeader)
 {
     this.vFileHeader = vFileHeader;
 }
 public SRZoneMeshFileReference(SRBinaryReader binaryReader, int index, SRVFileHeader vFileHeader)
 {
     this.vFileHeader = vFileHeader;
     Read(binaryReader, index);
 }
Example #4
0
 public SRWorldZoneHeader(XmlNode parentNode, SRVFileHeader vFileHeader)
 {
     this.vFileHeader = vFileHeader;
     ReadXml(parentNode);
 }
Example #5
0
 public SRWorldZoneHeader(SRBinaryReader binaryReader, SRVFileHeader vFileHeader)
 {
     this.vFileHeader = vFileHeader;
     Read(binaryReader);
 }
Example #6
0
 // CONSTRUCTORS
 public SRWorldZoneHeader(SRVFileHeader vFileHeader)
 {
     this.vFileHeader = vFileHeader;
 }
 /// <summary>
 /// Reads the zone file into memory.
 /// </summary>
 /// <param name="xmlFile">File system path to the ".xml" zone file.</param>
 public void ReadXmlFile(string xmlFile)
 {
     try
     {
         XmlDocument xmlDocument = new XmlDocument();
         // Must preserve whitespace during read so that values that begin and/or end
         // with whitespace are not trimmed (e.g. "<tag> </tag>").
         xmlDocument.PreserveWhitespace = true;
         xmlDocument.Load(xmlFile);
         if (xmlDocument.SelectSingleNode("/root/" + XmlZoneDataTagName) != null)
         {
             sectionList = new List<SRZoneSection>();
             XmlNodeList selectNodeList = xmlDocument.SelectNodes("/root/" + XmlZoneDataTagName + "/" + SRZoneSection.XmlTagName);
             int index = 0;
             foreach (XmlNode selectNode in selectNodeList)
                 sectionList.Add(new SRZoneSection(selectNode, index++));
         }
         XmlNode zoneHeaderNode = xmlDocument.SelectSingleNode("/root/" + XmlZoneHeaderTagName);
         if (zoneHeaderNode != null)
         {
             vFileHeader = new SRVFileHeader(zoneHeaderNode);
             worldZoneHeader = new SRWorldZoneHeader(zoneHeaderNode, vFileHeader);
         }
     }
     catch (Exception e)
     {
         // Add context information for the error message
         e.Data["Action"] = "reading XML file";
         throw;
     }
 }
        // READERS / WRITERS
        /// <summary>
        /// Reads the zone header file into memory.
        /// </summary>
        /// <param name="czhFile">File system path to the ".czn_pc" zone file.</param>
        public void ReadHeaderFile(string czhFile)
        {
            SRTrace.WriteLine("");
            SRTrace.WriteLine("-------------------------------------------------------------------------------");
            SRTrace.WriteLine("ZONE HEADER FILE:  " + Path.GetFileName(czhFile));

            FileStream stream = null;
            try
            {
                stream = new FileStream(czhFile, FileMode.Open, FileAccess.Read);
                SRBinaryReader binaryReader = new SRBinaryReader(stream);
                vFileHeader = new SRVFileHeader(binaryReader);
                worldZoneHeader = new SRWorldZoneHeader(binaryReader, vFileHeader);
            }
            catch (Exception e)
            {
                // Add context information for the error message
                e.Data["Action"] = "reading Zone Header file";
                throw;
            }
            finally
            {
                if (stream != null)
                    stream.Close();
            }
        }