protected override void Execute(ConfuserContext context, ProtectionParameters parameters) { TypeDef rtType = context.Registry.GetService <IRuntimeService>().GetRuntimeType("Confuser.Runtime.MD5"); var marker = context.Registry.GetService <IMarkerService>(); var name = context.Registry.GetService <NameService>(); context.CurrentModuleWriterListener.OnWriterEvent += InjectHash; foreach (ModuleDef module in parameters.Targets.OfType <ModuleDef>()) { IEnumerable <IDnlibDef> members = Core.Helpers.InjectHelper.Inject(rtType, module.GlobalType, module); MethodDef cctor = module.GlobalType.FindStaticConstructor(); var init = (MethodDef)members.Single(method => method.Name == "Initialize"); cctor.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Call, init)); foreach (IDnlibDef member in members) { NameService.MarkHelperStatic(member, marker, (Protection)Parent); } } }