// TODO: Figure out what ubulk does. public UAsset(Stream uassetStream, Stream uexpStream = null, Stream ubulkStream = null, bool keepOpen = false) { using var reader = new BinaryReader(uassetStream, Encoding.UTF8, keepOpen); Summary = LSerializer.Deserialize <FPackageFileSummary>(reader); foreach (var import in Summary.Imports) { import.Ref(Summary); } foreach (var export in Summary.Exports) { export.Ref(Summary); using var ms = GetUEventStream(export, uassetStream, uexpStream); using var msr = new BinaryReader(ms, Encoding.UTF8, false); export.Objects.Add(new UObject(msr, Summary, true, export)); } }
public UAsset(Stream uassetStream, Stream uexpStream = null, Stream ubulkStream = null, bool keepOpen = false) { using (BinaryReader data = new BinaryReader(uassetStream, Encoding.UTF8, keepOpen)) { Summary = LSerializer.Deserialize <FPackageFileSummary>(data); FObjectImport[] imports = Summary.Imports; for (int i = 0; i < imports.Length; i++) { imports[i].Ref(Summary); } FObjectExport[] exports = Summary.Exports; foreach (FObjectExport fObjectExport in exports) { fObjectExport.Ref(Summary); using (MemoryStream input = GetUEventStream(fObjectExport, uassetStream, uexpStream)) { using (BinaryReader data2 = new BinaryReader(input, Encoding.UTF8, leaveOpen: false)) { fObjectExport.Objects.Add(new UObject(data2, Summary, pad: true, fObjectExport)); } } } } }