Exemple #1
0
        /// <summary>
        /// Loads entries from the given pack file.
        /// </summary>
        /// <param name="filePath"></param>
        private void Load(string filePath)
        {
            var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
            var br = new BinaryReader(fs, Encoding.ASCII);

            lock (_syncLock)
            {
                _fileStreams.Add(fs);
                _binaryReaders.Add(br);
            }

            var header = PackHeader.ReadFrom(br, filePath);

            for (var i = 0; i < header.ListFileCount; ++i)
            {
                var entry    = PackedFileEntry.ReadFrom(header, br);
                var fullPath = entry.FullName.ToLower();

                lock (_syncLock)
                {
                    _entries[fullPath] = entry;

                    var key = entry.FileName.ToLower();

                    if (!_entriesNamed.ContainsKey(key))
                    {
                        _entriesNamed[key] = new List <PackedFileEntry>();
                    }
                    _entriesNamed[key].Add(entry);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Loads entries from the given pack file.
        /// </summary>
        /// <param name="filePath"></param>
        private void Load(string filePath)
        {
            _fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
            _br = new BinaryReader(_fs, Encoding.ASCII);

            this.Header = PackHeader.ReadFrom(_br, filePath);

            for (var i = 0; i < this.Header.FileCount2; ++i)
            {
                var entry = PackedFileEntry.ReadFrom(this.Header, _br);
                this.AddEntry(entry);
            }
        }