public override void Patch(MethodDefinition source) { ILProcessor il = source.Body.GetILProcessor(); Instruction oldSet = il.GetStsfldInstruction(FontFieldName); Instruction newCall = il.CreateCallInstruction(TargetMethod); il.InsertBefore(oldSet, newCall); }
public override void Patch(MethodDefinition source) { ILProcessor il = source.Body.GetILProcessor(); il.ClearInstructions(); il.ClearVariables(); il.Append(il.CreateCallInstruction(TargetMethod)); il.Emit(OpCodes.Ret); }
public override void Patch(MethodDefinition source) { FieldDefinition fieldText = source.DeclaringType.GetField(LogoSpriteFieldName); ILProcessor il = source.Body.GetILProcessor(); Instruction target = il.GetFirstInstruction(); il.InsertBefore(target, Instruction.Create(OpCodes.Ldarg_0)); il.InsertBefore(target, Instruction.Create(OpCodes.Ldflda, fieldText)); il.InsertBefore(target, il.CreateCallInstruction(TargetMethod)); }