Esempio n. 1
0
        /// <summary>
        /// Load all PAK files.
        /// </summary>
        private void LoadFileListing()
        {
            Dictionary <string, PakCentralDirFile> result = new Dictionary <string, PakCentralDirFile>();

            foreach (PakCentralDirFile cd in PakReaderSlim.ReadCentralDir())
            {
                result.Add(cd.filename, cd);
            }

            Files = result;
        }
Esempio n. 2
0
 /// <summary>
 /// Close the reader.
 /// </summary>
 public void Close()
 {
     Files?.Clear();
     Files = null;
     PakReaderSlim?.Close();
 }
Esempio n. 3
0
 /// <summary>
 /// Get a specific file from the loaded PAK files.
 /// </summary>
 /// <param name="filename">File name</param>
 /// <returns></returns>
 public byte[] GetFile(string filename) =>
 PakReaderSlim.ReadFileBytes(Files[PakUtil.NormalizeFilename(filename)]);
Esempio n. 4
0
 /// <summary>
 /// Initialize a new <see cref="PakReader"/> object with the specified pak path.
 /// </summary>
 /// <param name="filename">The pak path</param>
 public PakReader(string filename)
 {
     PakReaderSlim = new PakReaderSlim(filename);
     LoadFileListing();
 }