/// <summary>
        /// Opens a SAVETREE.DAT file.
        /// Always uses FileUsage.UseDisk so possible to write back to original file.
        /// </summary>
        /// <param name="saveTreePath">Full path to SAVETREE.DAT file.</param>
        /// <param name="readOnly">Flag to open file in read-only mode.</param>
        public bool Open(string saveTreePath, bool readOnly = true)
        {
            // Open file proxy
            if (!saveTreeFile.Load(saveTreePath, FileUsage.UseDisk, readOnly))
            {
                return(false);
            }

            // Get reader
            BinaryReader reader = saveTreeFile.GetReader();

            // Read header
            Header = new SaveTreeHeader();
            Header.Read(reader);

            // Read location detail
            // Note: SaveTreeLocationDetail below doesn't seem to be what this data actually is. The value for
            // recordlength at 18 is actually the player environment. (1 = outside, 2 = building, 3 = dungeon)
            // For now, resetting the stream to 18 and reading the value as recordlength to keep saves opening
            // correctly until this record is better understood.
            reader.BaseStream.Position = 18;
            LocationDetail             = new SaveTreeLocationDetail(reader);

            // Read remaining records
            ReadRecords(reader);

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Opens a SAVETREE.DAT file.
        /// Always uses FileUsage.UseDisk so possible to write back to original file.
        /// </summary>
        /// <param name="saveTreePath">Full path to SAVETREE.DAT file.</param>
        /// <param name="readOnly">Flag to open file in read-only mode.</param>
        public bool Open(string saveTreePath, bool readOnly = true)
        {
            // Open file proxy
            if (!saveTreeFile.Load(saveTreePath, FileUsage.UseDisk, readOnly))
            {
                return(false);
            }

            // Get reader
            BinaryReader reader = saveTreeFile.GetReader();

            // Read header
            Header = new SaveTreeHeader();
            Header.Read(reader);

            // Read building records
            BuildingRecords = new SaveTreeBuildingRecords(reader);

            // Read remaining records
            ReadRecords(reader);

            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Opens a SAVETREE.DAT file.
        /// Always uses FileUsage.UseDisk so possible to write back to original file.
        /// </summary>
        /// <param name="saveTreePath">Full path to SAVETREE.DAT file.</param>
        /// <param name="readOnly">Flag to open file in read-only mode.</param>
        public bool Open(string saveTreePath, bool readOnly = true)
        {
            // Open file proxy
            if (!saveTreeFile.Load(saveTreePath, FileUsage.UseDisk, readOnly))
                return false;

            // Get reader
            BinaryReader reader = saveTreeFile.GetReader();

            // Read header
            Header = new SaveTreeHeader();
            Header.Read(reader);

            // Read location detail
            LocationDetail = new SaveTreeLocationDetail(reader);

            // Read remaining records
            ReadRecords(reader);

            return true;
        }