mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-24 17:57:56 -03:00
Add config to control whether json values are escaped
This commit is contained in:
parent
4741d46ba9
commit
1d31daac3f
4 changed files with 9 additions and 3 deletions
|
@ -17,5 +17,6 @@
|
|||
public double ForceVersion { get; set; } = 24.3;
|
||||
public bool ForceDump { get; set; } = false;
|
||||
public bool NoRedirectedPointer { get; set; } = false;
|
||||
public bool EscapeJsonValues { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Il2CppDumper
|
|||
il2Cpp = il2CppExecutor.il2Cpp;
|
||||
}
|
||||
|
||||
public void WriteScript(string outputDir)
|
||||
public void WriteScript(string outputDir, bool escapeJsonValues)
|
||||
{
|
||||
var json = new ScriptJson();
|
||||
// 生成唯一名称
|
||||
|
@ -373,6 +373,10 @@ namespace Il2CppDumper
|
|||
address = $"0x{x.Address:X}"
|
||||
}).ToArray();
|
||||
var jsonOptions = new JsonSerializerOptions() { WriteIndented = true, IncludeFields = true };
|
||||
if (!escapeJsonValues)
|
||||
{
|
||||
jsonOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping;
|
||||
}
|
||||
File.WriteAllText(outputDir + "stringliteral.json", JsonSerializer.Serialize(stringLiterals, jsonOptions), new UTF8Encoding(false));
|
||||
//写入文件
|
||||
File.WriteAllText(outputDir + "script.json", JsonSerializer.Serialize(json, jsonOptions));
|
||||
|
|
|
@ -262,7 +262,7 @@ namespace Il2CppDumper
|
|||
{
|
||||
Console.WriteLine("Generate struct...");
|
||||
var scriptGenerator = new StructGenerator(executor);
|
||||
scriptGenerator.WriteScript(outputDir);
|
||||
scriptGenerator.WriteScript(outputDir, config.EscapeJsonValues);
|
||||
Console.WriteLine("Done!");
|
||||
}
|
||||
if (config.GenerateDummyDll)
|
||||
|
|
|
@ -13,5 +13,6 @@
|
|||
"ForceIl2CppVersion": false,
|
||||
"ForceVersion": 16,
|
||||
"ForceDump": false,
|
||||
"NoRedirectedPointer": false
|
||||
"NoRedirectedPointer": false,
|
||||
"EscapeJsonValues": true
|
||||
}
|
Loading…
Add table
Reference in a new issue