Пример #1
0
            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);
            }
Пример #2
0
            public override void Patch(MethodDefinition source)
            {
                ILProcessor il = source.Body.GetILProcessor();

                il.ClearInstructions();
                il.ClearVariables();
                il.Append(il.CreateCallInstruction(TargetMethod));
                il.Emit(OpCodes.Ret);
            }
Пример #3
0
            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));
            }