VPK (Valve Pak) files are uncompressed archives used to package game content. This library allows you to read and extract files out of these paks.
Usage:
using var package = new Package();
// Open a vpk file
package.Read("pak01_dir.vpk");
// Can also pass in a stream
package.Read(File.OpenRead("pak01_dir.vpk"));
// Optionally verify hashes and signatures of the file if there are any
package.VerifyHashes();
// Find a file, this returns a PackageEntry
var file = package.FindEntry("path/to/file.txt");
if (file != null) {
// Read a file to a byte array
package.ReadEntry(file, out byte[] fileContents);
}
Do note that files such as pak01_001.vpk
are just data files, you have to open pak01_dir.vpk
.