A .NET library for reading, creating, and manipulating game_pak files from the MMORPG ArcheAge.
dotnet add package AAPakFile
Requires .NET 10.0 or later. AOT-compatible.
All operations are exposed through the static PackageFile class. Every method is async and accepts an optional CancellationToken and IProgress<T> for progress reporting.
await PackageFile.ExportToFolderAsync("game_pak", outputPath: "extracted/");await PackageFile.ExportToZipArchiveAsync("game_pak", "extracted.zip");Files present in the package but absent from the source folder are left untouched.
await PackageFile.ImportFromFolderAsync("game_pak", sourceFolder: "mods/");await PackageFile.ImportFromZipArchiveAsync("game_pak", "mods.zip");await PackageFile.CreateFromFolderAsync("output.pak", sourceFolder: "files/");await using var reader = await PackageFile.OpenReaderAsync("game_pak");
foreach (var entry in reader.Entries)
{
Console.WriteLine(entry.FileName);
}await using var stream = await PackageFile.OpenFileAsync("game_pak", "game/textures/sky.dds");await using var editor = await PackageFile.OpenEditorAsync("game_pak");
await editor.AddOrReplaceAsync("game/textures/sky.dds", File.OpenRead("sky.dds"));
await editor.SaveAsync();// Quick — stops on the first invalid file
var result = await PackageFile.VerifyPackageAsync("game_pak");
Console.WriteLine(result.IsValid ? "OK" : $"Corrupt: {result.InvalidFile}");
// Full — reports every file
await foreach (var fileResult in PackageFile.VerifyAllFilesAsync("game_pak"))
{
if (!fileResult.IsValid)
Console.WriteLine($"Corrupt: {fileResult.FileName}");
}Deleted and replaced files leave gaps; compaction reclaims that space.
// Safe: writes to a temp file, then atomically replaces the original.
// Requires ~same free disk space as the package.
await PackageFile.CompactAsync("game_pak");
// Fast: shifts data in-place. No extra disk space required,
// but the file is unrecoverable if interrupted mid-operation.
await PackageFile.CompactInPlaceAsync("game_pak");MIT — see LICENSE.