From fd0b3ec7974288d8ff53ef989ebfee38bb2e97be Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 2 Aug 2020 22:28:55 +0200 Subject: [PATCH] CLI: Add JSON output option (--json-out / -o) --- Il2CppInspector.CLI/Program.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index 2e23441..b591fcd 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -35,6 +35,9 @@ namespace Il2CppInspector.CLI [Option('h', "cpp-out", Required = false, HelpText = "C++ scaffolding / DLL injection project output path", Default = "cpp")] public string CppOutPath { get; set; } + [Option('o', "json-out", Required = false, HelpText = "JSON metadata output file", Default = "metadata.json")] + public string JsonOutPath { get; set; } + [Option('e', "exclude-namespaces", Required = false, Separator = ',', HelpText = "Comma-separated list of namespaces to suppress in C# output, or 'none' to include all namespaces", Default = new [] { "System", @@ -256,15 +259,20 @@ namespace Il2CppInspector.CLI Console.WriteLine("An error occurred: " + ex.Message); } - // IDA Python script output - using (new Benchmark("Generate IDAPython script")) { - new IDAPythonScript(appModel).WriteScriptToFile(options.PythonOutFile, Path.Combine(options.CppOutPath, "appdata/il2cpp-types.h")); - } - // C++ output using (new Benchmark("Generate C++ code")) { new CppScaffolding(appModel).Write(options.CppOutPath); } + + // JSON output + using (new Benchmark("Generate JSON metadata")) { + new JSONMetadata(appModel).Write(options.JsonOutPath); + } + + // IDA Python script output + using (new Benchmark("Generate IDAPython script")) { + new IDAPythonScript(appModel).WriteScriptToFile(options.PythonOutFile, Path.Combine(options.CppOutPath, "appdata/il2cpp-types.h")); + } } // Success exit code