当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyDefinition.GetMethod方法代码示例

本文整理汇总了C#中Mono.Cecil.AssemblyDefinition.GetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyDefinition.GetMethod方法的具体用法?C# AssemblyDefinition.GetMethod怎么用?C# AssemblyDefinition.GetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Cecil.AssemblyDefinition的用法示例。


在下文中一共展示了AssemblyDefinition.GetMethod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TerraHax_onHook

 void TerraHax_onHook(AssemblyDefinition asm)
 {
     #region Lighting
     asm.GetMethod("Lighting", "LightColor").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(typeof(TerraHax).GetField("fullbright"))),
         Instruction.Create(OpCodes.Brfalse, asm.GetMethod("Lighting", "LightColor").Body.Instructions[0]),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight")),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "wetLightR")),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight2"))
         );
     asm.GetMethod("Lighting", "LightColorG").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(typeof(TerraHax).GetField("fullbright"))),
         Instruction.Create(OpCodes.Brfalse, asm.GetMethod("Lighting", "LightColorG").Body.Instructions[0]),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight")),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "wetLightR")),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight2"))
         );
     asm.GetMethod("Lighting", "LightColorB").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(typeof(TerraHax).GetField("fullbright"))),
         Instruction.Create(OpCodes.Brfalse, asm.GetMethod("Lighting", "LightColorB").Body.Instructions[0]),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight")),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "wetLightR")),
         Instruction.Create(OpCodes.Ldc_R4, 1f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight2"))
         );
     asm.GetMethod("Lighting", "LightColor2").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(typeof(TerraHax).GetField("fullbright"))),
         Instruction.Create(OpCodes.Brfalse, asm.GetMethod("Lighting", "LightColor2").Body.Instructions[0]),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight")),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "wetLightR")),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight2"))
         );
     asm.GetMethod("Lighting", "LightColorG2").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(typeof(TerraHax).GetField("fullbright"))),
         Instruction.Create(OpCodes.Brfalse, asm.GetMethod("Lighting", "LightColorG2").Body.Instructions[0]),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight")),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "wetLightR")),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight2"))
         );
     asm.GetMethod("Lighting", "LightColorB2").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(typeof(TerraHax).GetField("fullbright"))),
         Instruction.Create(OpCodes.Brfalse, asm.GetMethod("Lighting", "LightColorB2").Body.Instructions[0]),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight")),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "wetLightR")),
         Instruction.Create(OpCodes.Ldc_R4, 0f),
         Instruction.Create(OpCodes.Stsfld, asm.GetField("Lighting", "negLight2"))
         );
     #endregion
     #region Player
     Instruction getItem = asm.GetMethod("Player", "GetItem").Body.Instructions[0];
     asm.GetMethod("Player", "GetItem").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldarg_1),
         Instruction.Create(OpCodes.Ldsfld, asm.GetField("Main", "myPlayer")),
         Instruction.Create(OpCodes.Bne_Un, getItem),
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(GetField("pickupItems"))),
         Instruction.Create(OpCodes.Brfalse, getItem),
         Instruction.Create(OpCodes.Newobj, asm.GetMethod("Item", ".ctor")),
         Instruction.Create(OpCodes.Ret)
         );
     Instruction getHurt = asm.GetMethod("Player", "Hurt").Body.Instructions[0];
     asm.GetMethod("Player", "Hurt").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldarg_0),
         Instruction.Create(OpCodes.Ldfld, asm.GetField("Player", "whoAmi")),
         Instruction.Create(OpCodes.Ldsfld, asm.GetField("Main", "myPlayer")),
         Instruction.Create(OpCodes.Bne_Un, getHurt),
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(GetField("godMode"))),
         Instruction.Create(OpCodes.Brfalse, getHurt),
         Instruction.Create(OpCodes.Ldc_R8, 0.0),
         Instruction.Create(OpCodes.Ret)
         );
     Instruction killMe = asm.GetMethod("Player", "KillMe").Body.Instructions[0];
     asm.GetMethod("Player", "KillMe").Body.GetILProcessor().Insert(Target.START,
         Instruction.Create(OpCodes.Ldarg_0),
         Instruction.Create(OpCodes.Ldfld, asm.GetField("Player", "whoAmi")),
         Instruction.Create(OpCodes.Ldsfld, asm.GetField("Main", "myPlayer")),
         Instruction.Create(OpCodes.Bne_Un, killMe),
         Instruction.Create(OpCodes.Ldsfld, asm.MainModule.Import(GetField("godMode"))),
         Instruction.Create(OpCodes.Brfalse, killMe),
         Instruction.Create(OpCodes.Ret)
         );
     #endregion
 }
开发者ID:darkunderdog,项目名称:TerraHax,代码行数:98,代码来源:TerraHax.cs


注:本文中的Mono.Cecil.AssemblyDefinition.GetMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。