Esempio n. 1
0
        /// <summary>
        /// Load MAPS.BSA file.
        /// </summary>
        /// <param name="filePath">Absolute path to MAPS.BSA file.</param>
        /// <param name="usage">Specify if file will be accessed from disk, or loaded into RAM.</param>
        /// <param name="readOnly">File will be read-only if true, read-write if false.</param>
        /// <returns>True if successful, otherwise false.</returns>
        public bool Load(string filePath, FileUsage usage, bool readOnly)
        {
            // Validate filename
            if (!filePath.EndsWith("MAPS.BSA", StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            // Load PAK files
            string arena2Path = Path.GetDirectoryName(filePath);

            climatePak = new PakFile(Path.Combine(arena2Path, "CLIMATE.PAK"));
            politicPak = new PakFile(Path.Combine(arena2Path, "POLITIC.PAK"));

            // Load file
            isReady = false;
            if (!bsaFile.Load(filePath, usage, readOnly))
            {
                return(false);
            }

            // Create records array
            regions = new RegionRecord[RegionCount];

            // Set ready flag
            isReady = true;

            return(true);
        }
        /// <summary>
        /// Load MAPS.BSA file.
        /// </summary>
        /// <param name="FilePath">Absolute path to MAPS.BSA file.</param>
        /// <param name="Usage">Specify if file will be accessed from disk, or loaded into RAM.</param>
        /// <param name="ReadOnly">File will be read-only if true, read-write if false.</param>
        /// <returns>True if successful, otherwise false.</returns>
        public bool Load(string FilePath, FileUsage Usage, bool ReadOnly)
        {
            // Validate filename
            FilePath = FilePath.ToUpper();
            if (!FilePath.EndsWith("MAPS.BSA"))
            {
                return(false);
            }

            // Load PAK files
            string arena2Path = Path.GetDirectoryName(FilePath);

            ClimatePak = new PakFile(Path.Combine(arena2Path, "CLIMATE.PAK"));
            PoliticPak = new PakFile(Path.Combine(arena2Path, "POLITIC.PAK"));

            // Load file
            IsReady = false;
            if (!BsaFile.Load(FilePath, Usage, ReadOnly))
            {
                return(false);
            }

            // Create records array
            Regions = new RegionRecord[RegionCount];

            // Set ready flag
            IsReady = true;

            return(true);
        }
        /// <summary>
        /// Load MAPS.BSA file.
        /// </summary>
        /// <param name="filePath">Absolute path to MAPS.BSA file.</param>
        /// <param name="usage">Specify if file will be accessed from disk, or loaded into RAM.</param>
        /// <param name="readOnly">File will be read-only if true, read-write if false.</param>
        /// <returns>True if successful, otherwise false.</returns>
        public bool Load(string filePath, FileUsage usage, bool readOnly)
        {
            // Validate filename
            if (!filePath.EndsWith("MAPS.BSA", StringComparison.InvariantCultureIgnoreCase))
                return false;

            // Load PAK files
            string arena2Path = Path.GetDirectoryName(filePath);
            climatePak = new PakFile(Path.Combine(arena2Path, "CLIMATE.PAK"));
            politicPak = new PakFile(Path.Combine(arena2Path, "POLITIC.PAK"));

            // Load file
            isReady = false;
            if (!bsaFile.Load(filePath, usage, readOnly))
                return false;

            // Create records array
            regions = new RegionRecord[RegionCount];

            // Set ready flag
            isReady = true;

            return true;
        }