Move Il2CppModel creation out of Il2CppSharpDumper
This commit is contained in:
@@ -17,9 +17,7 @@ namespace Il2CppInspector
|
|||||||
// Namespace prefixes whose contents should be skipped
|
// Namespace prefixes whose contents should be skipped
|
||||||
public List<string> ExcludedNamespaces { get; set; }
|
public List<string> ExcludedNamespaces { get; set; }
|
||||||
|
|
||||||
public Il2CppCSharpDumper(Il2CppInspector proc) {
|
public Il2CppCSharpDumper(Il2CppModel model) => this.model = model;
|
||||||
model = new Il2CppModel(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string formatAddress(ulong address) => model.Package.BinaryImage.Bits == 32
|
private string formatAddress(ulong address) => model.Package.BinaryImage.Bits == 32
|
||||||
? string.Format($"0x{(uint) address:X8}")
|
? string.Format($"0x{(uint) address:X8}")
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Il2CppInspector.Reflection;
|
||||||
|
|
||||||
namespace Il2CppInspector
|
namespace Il2CppInspector
|
||||||
{
|
{
|
||||||
@@ -60,8 +61,16 @@ namespace Il2CppInspector
|
|||||||
|
|
||||||
// Write output file
|
// Write output file
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var il2cpp in il2cppInspectors)
|
foreach (var il2cpp in il2cppInspectors) {
|
||||||
new Il2CppCSharpDumper(il2cpp) {ExcludedNamespaces = excludedNamespaces}.WriteFile(outFile + (i++ > 0 ? "-" + (i-1) : ""));
|
// Create model
|
||||||
|
var model = new Il2CppModel(il2cpp);
|
||||||
|
|
||||||
|
// C# signatures output
|
||||||
|
new Il2CppCSharpDumper(model) {ExcludedNamespaces = excludedNamespaces}.WriteFile(outFile + (i++ > 0 ? "-" + (i-1) : ""));
|
||||||
|
|
||||||
|
// IDA Python script output
|
||||||
|
// TODO: IDA Python script output
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Il2CppInspector.Reflection;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Il2CppInspector
|
namespace Il2CppInspector
|
||||||
@@ -50,7 +51,7 @@ namespace Il2CppInspector
|
|||||||
// Dump each image in the binary separately
|
// Dump each image in the binary separately
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var il2cpp in inspectors)
|
foreach (var il2cpp in inspectors)
|
||||||
new Il2CppCSharpDumper(il2cpp) {ExcludedNamespaces = excludedNamespaces}.WriteFile(testPath + @"\test-result" + (i++ > 0 ? "-" + (i - 1) : "") + ".cs");
|
new Il2CppCSharpDumper(new Il2CppModel(il2cpp)) {ExcludedNamespaces = excludedNamespaces}.WriteFile(testPath + @"\test-result" + (i++ > 0 ? "-" + (i - 1) : "") + ".cs");
|
||||||
|
|
||||||
// Compare test result with expected result
|
// Compare test result with expected result
|
||||||
for (i = 0; i < inspectors.Count; i++) {
|
for (i = 0; i < inspectors.Count; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user