当前位置: 首页 > news >正文

农村电子商务网站建设手机百度app下载安装

农村电子商务网站建设,手机百度app下载安装,电商网站设计文档,淄博企业网站建设哪家专业Harmony是一个开放源代码库#xff0c;旨在在运行时替换、修饰或修改任何现有C#xff03;方法。它的主要用在用Mono语言编写的游戏和插件#xff0c;但是该技术可以与任何.NET版本一起使用。它还照顾对同一方法的多次更改#xff08;它们累积而不是覆盖#xff09;。它为… Harmony是一个开放源代码库旨在在运行时替换、修饰或修改任何现有C方法。它的主要用在用Mono语言编写的游戏和插件但是该技术可以与任何.NET版本一起使用。它还照顾对同一方法的多次更改它们累积而不是覆盖。它为每个原始方法创建DynamicMethod方法并向其织入代码该代码在开始和结束时调用自定义方法。它还允许您编写过滤器来处理原始的IL代码从而可以对原始方法进行更详细的操作。文档可以在这里找到。最新2.0版本终于支持.net core.Harmony支持手动Patch和自动PatchAll织入织入位置可以是执行前Prefix、执行后Postfix和终结嚣Finalizer也可以更详细的手动修改ILTranspiler支持构造函数、Getter/Setter、虚/非虚方法、静态方法手动模式class NoneGenericClass {private readonly bool _isRunning true;private int _counter 1;public int DoSomething(){Console.WriteLine(nameof(DoSomething));if (_isRunning){_counter;}return _counter * 10;}public static int DoSomething2(){Console.WriteLine(nameof(DoSomething2));return 3333;}public IEnumerableint GetNumbers(){Console.WriteLine(nameof(GetNumbers));yield return 1;yield return 2;yield return 3;} }static class NoneGenericClassPatcher {public static void Patch(){var harmony new Harmony(nameof(NoneGenericClassPatcher));harmony.Patch(typeof(NoneGenericClass).GetMethod(nameof(NoneGenericClass.DoSomething)),new HarmonyMethod(GetMethod(nameof(MyPrefix))),new HarmonyMethod(GetMethod(nameof(MyPostfix))),new HarmonyMethod(GetMethod(nameof(MyTranspiler))),new HarmonyMethod(GetMethod(nameof(MyFinalizer))));Console.WriteLine(new NoneGenericClass().DoSomething());Console.WriteLine();harmony.Patch(typeof(NoneGenericClass).GetMethod(nameof(NoneGenericClass.GetNumbers)),new HarmonyMethod(GetMethod(nameof(MyPrefix))),new HarmonyMethod(GetMethod(nameof(PassthroughPostfix))),new HarmonyMethod(GetMethod(nameof(MyTranspiler))),new HarmonyMethod(GetMethod(nameof(MyFinalizer))));Console.WriteLine(string.Join(, , new NoneGenericClass().GetNumbers())); //BUG有Finalizer方法时PassthroughPostfix不生效Console.WriteLine();harmony.Patch(typeof(NoneGenericClass).GetMethod(nameof(NoneGenericClass.DoSomething2)),new HarmonyMethod(GetMethod(nameof(StaticPrefix))),new HarmonyMethod(GetMethod(nameof(MyPostfix))),new HarmonyMethod(GetMethod(nameof(MyTranspiler))),new HarmonyMethod(GetMethod(nameof(MyFinalizer))));Console.WriteLine(NoneGenericClass.DoSomething2());}static MethodInfo GetMethod(string name) typeof(NoneGenericClassPatcher).GetMethod(name, BindingFlags.Static | BindingFlags.Public);public static bool MyPrefix(out Stopwatch __state, ref bool ____isRunning){__state Stopwatch.StartNew();Console.WriteLine(${nameof(MyPrefix)} {____isRunning});return true;}public static bool StaticPrefix(out Stopwatch __state){__state Stopwatch.StartNew();Console.WriteLine(${nameof(StaticPrefix)});return true;}public static void MyPostfix(Stopwatch __state, ref int __result, MethodBase __originalMethod){Console.WriteLine(${__state.ElapsedMilliseconds} {__result});Console.WriteLine(nameof(MyPostfix));}public static IEnumerableint PassthroughPostfix(IEnumerableint values){yield return 0;foreach (var value in values)if (value 1)yield return value * 10;yield return 99;Console.WriteLine(nameof(PassthroughPostfix));}// looks for STDFLD someField and inserts CALL MyExtraMethod before itpublic static IEnumerableCodeInstruction MyTranspiler(IEnumerableCodeInstruction instructions){Console.WriteLine(nameof(MyTranspiler));//var found false;foreach (var instruction in instructions){//if (instruction.opcode OpCodes.Stfld instruction.operand f_someField)//{// yield return new CodeInstruction(OpCodes.Call, m_MyExtraMethod);// found true;//}yield return instruction;}//if (found false)// ReportError(Cannot find Stdfld someField in OriginalType.OriginalMethod);}public static void MyFinalizer(Exception __exception){Console.WriteLine(${nameof(MyFinalizer)} {__exception});} } 自动模式public class Annotations {private readonly bool _isRunning;public IEnumerableint GetNumbers(){Console.WriteLine(nameof(GetNumbers));yield return 1;yield return 2;yield return 3;} }[HarmonyPatch(typeof(Annotations))] [HarmonyPatch(nameof(Annotations.GetNumbers))] public class AnnotationsPatcher {static AccessTools.FieldRefAnnotations, bool isRunningRef AccessTools.FieldRefAccessAnnotations, bool(_isRunning);public static void Patch(){var harmony new Harmony(nameof(AnnotationsPatcher));harmony.PatchAll();Console.WriteLine(string.Join(, , new Annotations().GetNumbers()));}static bool Prefix(Annotations __instance){Console.WriteLine(Prefix);return true;}/// summaryNot working/summarystatic IEnumerableint Postfix(IEnumerableint values){yield return 0;foreach (var value in values)if (value 1)yield return value * 10;yield return 99;Console.WriteLine(nameof(Postfix));}// looks for STDFLD someField and inserts CALL MyExtraMethod before itpublic static IEnumerableCodeInstruction Transpiler(IEnumerableCodeInstruction instructions){Console.WriteLine(nameof(Transpiler));//var found false;foreach (var instruction in instructions){//if (instruction.opcode OpCodes.Stfld instruction.operand f_someField)//{// yield return new CodeInstruction(OpCodes.Call, m_MyExtraMethod);// found true;//}yield return instruction;}//if (found false)// ReportError(Cannot find Stdfld someField in OriginalType.OriginalMethod);} } 运行代码static void Main(string[] args) {NoneGenericClassPatcher.Patch();Console.WriteLine();AnnotationsPatcher.Patch(); } 输出结果MyTranspiler MyPrefix True DoSomething 20 MyPostfix MyFinalizerMyTranspiler MyPrefix True MyFinalizer GetNumbers 1, 2, 3MyTranspiler StaticPrefix DoSomething2 3333 MyPostfix MyFinalizerTranspiler Prefix GetNumbers Postfix 0, 20, 30, 99
http://www.huolong8.cn/news/210694/

相关文章:

  • 建筑导航网站微信网站全称
  • 山东住房和城乡建设部网站wordpress js加载很慢
  • 做ps图标什么网站最好新公司建网站
  • c2c代表网站汕头免费自助建站模板
  • 苍南网站设计公司杭州前十强装修公司有哪几家
  • 中山精品网站建设价位个人网页素材
  • 网页此站点不安全wordpress 安装主题慢
  • 公司网站域名无法解析汕头建站程序
  • 沈阳学网站制作学校怎么用Visio studio做网站
  • 网站建设报价是多少wordpress 直达链接
  • 淘宝做基础销量网站建设网站需要投入
  • 软件开发流程培训深圳网站seo教程
  • 国外做3d模型的网站上海网站建设市场分析
  • 做网站需要会的软件中英文网站模板源码
  • 网站布局怎么写wordpress主题修改
  • 最好的网站设计公相城区建设局网站
  • 网站设计与开发培训贵阳百度快照优化排名
  • 便利的龙岗网站设计商城网站除了域名备案还要
  • wordpress4.6字体seo网站优化方案案例
  • 如何给客户更好的做网站分析怎么恢复wordpress设定值
  • 网站设计的目的那些网站专门做棋牌推广的
  • 用ps做糖果店网站模板上海seo搜索优化
  • 上海网站建设定制开发群晖wordpress 外网很慢
  • 专业制作开发公司网站怎么在网站做gif
  • 做网站的数据库的步骤有知道做网站的吗
  • 佛山企业网站自助建站开发游戏需要多少钱
  • 电脑做视频的网站吗湖南做电商网站需要什么条件
  • 如何设置wordpress不自动更新开封做网站优化
  • 对网站建设有什么样好的建设意见网站推广营销方案
  • 海口招商建设有限公司网站济南正规的网站制作