C# Parser for Unreal Engine packages & assets
DefaultFileProvider
This file provider lets you load packages locally from a given directory.
var provider = new DefaultFileProvider(gameDirectory, SearchOption.TopDirectoryOnly);
provider.Initialize();
StreamedFileProvider
This file provider lets you load packages from their stream and gives you more control over what one you want to load.
var provider = new StreamedFileProvider(gameName); // gameName is not useful for most cases
provider.Initialize(fileName, new []{fileStream}); // foreach file you wanna load
// the 'fileStream' array must contains both .utoc AND .ucas streams in case you're loading an IO Store Package
The next step is mounting files you loaded, you can do so by using the SubmitKey
method. You must provide a GUID of one of the packages and its working aes key.
Provider.SubmitKey(guid, aesKey);
Depending on the game, assets can be loaded using different languages (usually English by default). In order to load them in another language, use the following code. Keep in mind that languages hardcoded in CUE4Parse are a small amount of languages used by the most popular games, you might have to add your own language in the code to support the game you're loading.
Provider.LoadLocalization(language);
All Exports
To get a json string of all exports included in the asset
var exports = Provider.LoadObjectExports(fullPath);
var json = JsonConvert.SerializeObject(exports, Formatting.Indented);
One Export
To get a json string of one export included in the asset
var export = Provider.LoadObject(fullPathWithExportName); // FortniteGame/Content/Athena/Items/Cosmetics/Backpacks/BID_718_ProgressiveJonesy.FortCosmeticCharacterPartVariant_0
var json = JsonConvert.SerializeObject(export, Formatting.Indented);
An asset usually has its data split between multiple other assets. In order to grab them all, use TrySavePackage
which will out a IReadOnlyDictionary<string, byte[]>
for you to loop through.
if (Provider.TrySavePackage(fullPath, out var assets))
{
foreach (var kvp in assets)
{
File.WriteAllBytes(Path.Combine(directory, kvp.Key), kvp.Value);
}
}
Contributions are always welcome in order to maintain the project!