Jitex icon indicating copy to clipboard operation
Jitex copied to clipboard

Hook Encoding.GetString

Open chinasmu opened this issue 1 year ago • 0 comments

I want to hook the two methods of System.Text.Encoding.

public virtual string GetString(byte[] bytes) public virtual string GetString(byte[] bytes, int index, int count)

        JitexManager.MethodResolver += context =>
        {
            Trace.WriteLine($"{context.Method.DeclaringType.Name} {context.Method.Name}" );
        };

There is no output of the two methods. And I try to do the following:

        var methods = Type.GetType("System.Text.Encoding").GetMethods().Where(w => w.Name == "GetString");
        foreach (var method in methods)
        {
            MethodHelper.ForceRecompile(method); //Force recompile
        }

And the app just crashes.

Could you pls show me a good example? Thank you!

chinasmu avatar May 08 '24 14:05 chinasmu