ioncodes / dnpatch

.NET Patcher library using dnlib
MIT License
313 stars 48 forks source link

Improve BuildMemberRef to autobuild memberRef from _module references. #13

Closed SlowLogicBoy closed 7 years ago

ioncodes commented 7 years ago

An example would be nice aswell as a short description

SlowLogicBoy commented 7 years ago

var memberRef = p.BuildMemberRef("System", "STAThread", ".ctor", Patcher.MemberRefType.Static) BuildMemberRef would search for System.STAThread type in references.

var typeDef = FindTypeInReferences(namespace, class);
var memberRef = BuildMemberRefToType(typeDef, memberName); //memberName in this case = ".ctor"
return memberRef;

Something like that.

This would find and automagically add arguments and return types for that memberRef.

I mean add in new MemberRefUser(module, ".ctor", methodSig, staThread); methodSig

ioncodes commented 7 years ago

Will do this in the next days, need to make a concept for that first.

ioncodes commented 7 years ago

https://github.com/ioncodes/dnpatch/commit/efd3dbd83237e2c8229db25c60e12654a69453f1