public void Deserialize(BinaryReader reader) { Header = new PackageFileSummary(); Header.Deserialize(reader, this); reader.BaseStream.Position = Header.NameOffset; Names = new List <NameEntry>(); for (int i = 0; i < Header.NameCount; i++) { var entry = new NameEntry(); entry.Deserialize(reader, this); Names.Add(entry); } reader.BaseStream.Position = Header.ImportOffset; Imports = new List <ObjectImport>(); for (int i = 0; i < Header.ImportCount; i++) { var imp = new ObjectImport(); imp.Deserialize(reader, this); Imports.Add(imp); } reader.BaseStream.Position = Header.ExportOffset; Exports = new List <ObjectExport>(); for (int i = 0; i < Header.ExportCount; i++) { var exp = new ObjectExport(); exp.Deserialize(reader, this); Exports.Add(exp); } // 8 bytes pointed to by DependsOffset: 00 00 00 00 00 00 00 00 reader.BaseStream.Position = Header.PreloadDependencyOffset; PreloadDependencies = new List <int>(); for (int i = 0; i < Header.PreloadDependencyCount; i++) { PreloadDependencies.Add(reader.ReadInt32()); } ExportObjects = new List <AbstractExportObject>(); foreach (var exp in Exports) { reader.BaseStream.Position = exp.SerialOffset; var export = new AbstractExportObject(); export.Deserialize(reader, this); ExportObjects.Add(export); } if (!SkipPropertyDataLoad) { if (reader.BaseStream.Position != (reader.BaseStream.Length - 4)) { throw new Exception("Failed to fully deserialize UAsset"); } } }
public void Deserialize(BinaryReader reader, PackageFile package) { Index = reader.ReadInt32(); int importIndex = (-Index) - 1; int exportIndex = Index - 1; if (IsImport() && package.Imports.Count > importIndex) { ImportObject = package.Imports[importIndex]; } if (IsExport() && package.Exports.Count > exportIndex) { ExportObject = package.Exports[exportIndex]; } }