Fix C# code benchmark timing regression
This commit is contained in:
@@ -147,7 +147,7 @@ namespace Il2CppInspector
|
|||||||
|
|
||||||
// Analyze data
|
// Analyze data
|
||||||
List<Il2CppInspector> il2cppInspectors;
|
List<Il2CppInspector> il2cppInspectors;
|
||||||
using (var timer = new Benchmark("Analyze IL2CPP data"))
|
using (var il2cppTimer = new Benchmark("Analyze IL2CPP data"))
|
||||||
il2cppInspectors = Il2CppInspector.LoadFromFile(options.BinaryFile, options.MetadataFile);
|
il2cppInspectors = Il2CppInspector.LoadFromFile(options.BinaryFile, options.MetadataFile);
|
||||||
|
|
||||||
if (il2cppInspectors == null)
|
if (il2cppInspectors == null)
|
||||||
@@ -158,60 +158,60 @@ namespace Il2CppInspector
|
|||||||
foreach (var il2cpp in il2cppInspectors) {
|
foreach (var il2cpp in il2cppInspectors) {
|
||||||
// Create model
|
// Create model
|
||||||
Il2CppModel model;
|
Il2CppModel model;
|
||||||
using (var timer1 = new Benchmark("Create type model"))
|
using (var modelTimer = new Benchmark("Create type model"))
|
||||||
model = new Il2CppModel(il2cpp);
|
model = new Il2CppModel(il2cpp);
|
||||||
|
|
||||||
// C# signatures output
|
// C# signatures output
|
||||||
using var timer2 = new Benchmark("Generate C# code");
|
using (var signaturesDumperTimer = new Benchmark("Generate C# code")) {
|
||||||
|
var writer = new Il2CppCSharpDumper(model) {
|
||||||
|
ExcludedNamespaces = options.ExcludedNamespaces.ToList(),
|
||||||
|
SuppressMetadata = options.SuppressMetadata,
|
||||||
|
MustCompile = options.MustCompile
|
||||||
|
};
|
||||||
|
|
||||||
var writer = new Il2CppCSharpDumper(model) {
|
var imageSuffix = i++ > 0 ? "-" + (i - 1) : "";
|
||||||
ExcludedNamespaces = options.ExcludedNamespaces.ToList(),
|
|
||||||
SuppressMetadata = options.SuppressMetadata,
|
|
||||||
MustCompile = options.MustCompile
|
|
||||||
};
|
|
||||||
|
|
||||||
var imageSuffix = i++ > 0 ? "-" + (i - 1) : "";
|
var csOut = options.CSharpOutPath;
|
||||||
|
if (csOut.ToLower().EndsWith(".cs"))
|
||||||
|
csOut = csOut.Insert(csOut.Length - 3, imageSuffix);
|
||||||
|
else
|
||||||
|
csOut += imageSuffix;
|
||||||
|
|
||||||
var csOut = options.CSharpOutPath;
|
if (options.CreateSolution) {
|
||||||
if (csOut.ToLower().EndsWith(".cs"))
|
writer.WriteSolution(csOut, unityPath, unityAssembliesPath);
|
||||||
csOut = csOut.Insert(csOut.Length - 3, imageSuffix);
|
continue;
|
||||||
else
|
}
|
||||||
csOut += imageSuffix;
|
|
||||||
|
|
||||||
if (options.CreateSolution) {
|
switch (options.LayoutSchema.ToLower(), options.SortOrder.ToLower()) {
|
||||||
writer.WriteSolution(csOut, unityPath, unityAssembliesPath);
|
case ("single", "index"):
|
||||||
continue;
|
writer.WriteSingleFile(csOut, t => t.Index);
|
||||||
}
|
break;
|
||||||
|
case ("single", "name"):
|
||||||
|
writer.WriteSingleFile(csOut, t => t.Name);
|
||||||
|
break;
|
||||||
|
|
||||||
switch (options.LayoutSchema.ToLower(), options.SortOrder.ToLower()) {
|
case ("namespace", "index"):
|
||||||
case ("single", "index"):
|
writer.WriteFilesByNamespace(csOut, t => t.Index, options.FlattenHierarchy);
|
||||||
writer.WriteSingleFile(csOut, t => t.Index);
|
break;
|
||||||
break;
|
case ("namespace", "name"):
|
||||||
case ("single", "name"):
|
writer.WriteFilesByNamespace(csOut, t => t.Name, options.FlattenHierarchy);
|
||||||
writer.WriteSingleFile(csOut, t => t.Name);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case ("namespace", "index"):
|
case ("assembly", "index"):
|
||||||
writer.WriteFilesByNamespace(csOut, t => t.Index, options.FlattenHierarchy);
|
writer.WriteFilesByAssembly(csOut, t => t.Index, options.SeparateAssemblyAttributesFiles);
|
||||||
break;
|
break;
|
||||||
case ("namespace", "name"):
|
case ("assembly", "name"):
|
||||||
writer.WriteFilesByNamespace(csOut, t => t.Name, options.FlattenHierarchy);
|
writer.WriteFilesByAssembly(csOut, t => t.Name, options.SeparateAssemblyAttributesFiles);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ("assembly", "index"):
|
case ("class", _):
|
||||||
writer.WriteFilesByAssembly(csOut, t => t.Index, options.SeparateAssemblyAttributesFiles);
|
writer.WriteFilesByClass(csOut, options.FlattenHierarchy);
|
||||||
break;
|
break;
|
||||||
case ("assembly", "name"):
|
|
||||||
writer.WriteFilesByAssembly(csOut, t => t.Name, options.SeparateAssemblyAttributesFiles);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ("class", _):
|
case ("tree", _):
|
||||||
writer.WriteFilesByClass(csOut, options.FlattenHierarchy);
|
writer.WriteFilesByClassTree(csOut, options.SeparateAssemblyAttributesFiles);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ("tree", _):
|
|
||||||
writer.WriteFilesByClassTree(csOut, options.SeparateAssemblyAttributesFiles);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDA Python script output
|
// IDA Python script output
|
||||||
|
|||||||
Reference in New Issue
Block a user