diff --git a/UAssetAPI.Benchmark/Program.cs b/UAssetAPI.Benchmark/Program.cs index 7f11b0ba..d9133c40 100644 --- a/UAssetAPI.Benchmark/Program.cs +++ b/UAssetAPI.Benchmark/Program.cs @@ -103,7 +103,9 @@ public static void Run(string[] args) if (Path.GetExtension(assetPath) == ".usmap") { timer.Start(); - mappings = new Usmap(assetPath); + mappings = new Usmap(); + mappings.SkipBlueprintSchemas = true; + mappings.Read(mappings.PathToReader(assetPath)); timer.Stop(); Console.WriteLine("Mappings parsed in " + NumberToTwoDecimalPlaces(timer.Elapsed.TotalMilliseconds) + " ms"); break; diff --git a/UAssetAPI/Unversioned/Usmap.cs b/UAssetAPI/Unversioned/Usmap.cs index 5e5409df..5b277d10 100644 --- a/UAssetAPI/Unversioned/Usmap.cs +++ b/UAssetAPI/Unversioned/Usmap.cs @@ -344,6 +344,11 @@ public bool AreFNamesCaseInsensitive } } + /// + /// Whether or not to skip blueprint schemas serialized in this mappings file. Only useful for testing. + /// + public bool SkipBlueprintSchemas = false; + /// /// .usmap name map /// @@ -612,7 +617,7 @@ public bool TryGetPropertyData(FName propertyName, AncestryInfo ancestry, Unr /// /// The path to the input file. /// A new MemoryStream that stores the binary data of the input file. - public MemoryStream PathToStream(string p) + public static MemoryStream PathToStream(string p) { using (FileStream origStream = File.Open(p, FileMode.Open)) { @@ -802,6 +807,11 @@ public void Read(UsmapBinaryReader compressedReader) } } + if (SkipBlueprintSchemas && schemaName.Length >= 2 && schemaName.EndsWith("_C")) + { + continue; + } + var newSchema = new UsmapSchema(schemaName, schemaSuperName, numProps, props); schemaIndexMap[i] = newSchema; Schemas[schemaName] = newSchema; @@ -943,9 +953,9 @@ public Usmap(string path) } /// - /// Reads a .usmap file from a BinaryReader and initializes a new instance of the class to store its data in memory. + /// Reads a .usmap file from a UsmapBinaryReader and initializes a new instance of the class to store its data in memory. /// - /// The file's BinaryReader that this instance will read from. + /// The file's UsmapBinaryReader that this instance will read from. /// Throw when the asset cannot be parsed correctly. public Usmap(UsmapBinaryReader reader) {