public void InjectBefore( string sourceTypeName, string sourceMethodName, string targetTypeName, string targetMethodName, int instructionIndex, bool includeCallingObject = false, int includeArgumentCount = 0, bool passArgumentsByRef = false, bool useFullName = false) { MethodBody targetMethodBody = CecilHelper .GetMethodDefinition( this._targetModule, targetTypeName, targetMethodName, useFullName).Body; Instruction instruction = targetMethodBody.Instructions[instructionIndex]; this.InjectBefore( sourceTypeName, sourceMethodName, targetMethodBody, instruction, includeCallingObject, includeArgumentCount, passArgumentsByRef, useFullName); }
public void ReplaceByNopAt(string typeName, string methodName, int instructionIndex) { MethodDefinition method = CecilHelper.GetMethodDefinition(this._targetModule, typeName, methodName); MethodBody methodBody = method.Body; this.ReplaceByNop(methodBody, methodBody.Instructions[instructionIndex]); }
public void ClearAllButLast(string typeName, string methodName) { MethodDefinition method = CecilHelper.GetMethodDefinition(this._targetModule, typeName, methodName); MethodBody methodBody = method.Body; this.ClearAllButLast(methodBody); }
public void InjectBefore( string sourceTypeName, string sourceMethodName, MethodBody targetMethodBody, Instruction targetInstruction, bool includeCallingObject = false, int includeArgumentCount = 0, bool passArgumentsByRef = false, bool useFullName = false) { MethodDefinition sourceMethod = CecilHelper.GetMethodDefinition(this._sourceModule, sourceTypeName, sourceMethodName, useFullName); MethodReference sourceMethodReference = CecilHelper.GetMethodReference(this._targetModule, sourceMethod); this.InjectBefore( sourceMethodReference, targetMethodBody, targetInstruction, includeCallingObject, includeArgumentCount, passArgumentsByRef); }
private MethodBody GetMethodBody(string typeName, string methodName) => CecilHelper.GetMethodDefinition(this._targetModule, typeName, methodName).Body;
public void MakeMethodPublic(string typeName, string methodName) { MethodDefinition method = CecilHelper.GetMethodDefinition(this._targetModule, typeName, methodName); method.IsPublic = true; }
public void MakeFieldPublic(string typeName, string fieldName) { FieldDefinition field = CecilHelper.GetFieldDefinition(this._targetModule, typeName, fieldName); field.IsPublic = true; }