Skip to content

Commit fad8c5f

Browse files
committed
Improve Method Dump
1 parent ab799cb commit fad8c5f

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

PawMapLoader/Res/Debug/MethodDump.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Text;
44
using Il2CppSystem;
55
using Il2CppSystem.Reflection;
6+
using Exception = System.Exception;
67

78
namespace PawMapLoader.Res.Debug
89
{
@@ -11,22 +12,30 @@ public class MethodDump
1112
public static void Create()
1213
{
1314
var strh_DumpText = new StringBuilder();
15+
strh_DumpText.AppendLine("=================== GAME DUMP ===================");
1416
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
1517
{
16-
strh_DumpText.AppendLine("==== GAME DUMP ====");
17-
strh_DumpText.AppendLine($"[] {asm.GetName().Name}");
18+
strh_DumpText.AppendLine($"[] {asm.GetName().Name} ===================");
1819
Type[] types;
1920
try {types = asm.GetTypes();} catch { continue; }
2021

2122
foreach (var type in types)
2223
{
2324
strh_DumpText.AppendLine($"|| {type.Name}");
2425

25-
foreach (var method in type.GetMethods( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
26+
foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic |
27+
BindingFlags.Static | BindingFlags.Instance |
28+
BindingFlags.DeclaredOnly))
2629
{
27-
var tempstr = string.Join(", ", method.GetParameters().Select(p => $"{p.ParameterType.Name} {p.Name}"));
28-
strh_DumpText.AppendLine($"||==> {method.Name}({tempstr})");
29-
}
30+
try
31+
{
32+
var tempstr = string.Join(", ", method.GetParameters().Select(p => $"{p.ParameterType.Name} {p.Name}"));
33+
strh_DumpText.AppendLine($"||==> {method.Name}({tempstr}) ==> ret {method.ReturnType.Name}");
34+
}
35+
catch (Exception e)
36+
{
37+
strh_DumpText.AppendLine($"||==> {method.Name}(Unk) ==> ret Unk [error: {e.Message}]");
38+
} }
3039
}
3140
}
3241
File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "GameDump.txt"), strh_DumpText.ToString());

0 commit comments

Comments
 (0)