public static void Execute() { ModuleDefMD typeModule = ModuleDefMD.Load(typeof(TamperClass).Module); TypeDef typeDef = typeModule.ResolveTypeDef(MDToken.ToRID(typeof(TamperClass).MetadataToken)); IEnumerable <IDnlibDef> members = InjectHelper.Inject(typeDef, Program.Module.GlobalType, Program.Module); MethodDef init = (MethodDef)members.Single(method => method.Name == "NoTampering"); init.GetRenamed(); Program.Module.GlobalType.FindOrCreateStaticConstructor().Body.Instructions.Insert(0, Instruction.Create(OpCodes.Call, init)); foreach (MethodDef method in Program.Module.GlobalType.Methods) { if (method.Name.Equals(".ctor")) { Program.Module.GlobalType.Remove(method); break; } } HasBeenTampered = true; }