Posted November 3, 20213 yr var module = ModuleDefMD.Load(@"C:\Temp\DemoDLL.dll"); var type = module.GetTypes().FirstOrDefault(t => t.Name == "Demo"); // Create the Main signature var main = new MethodDefUser("Main", MethodSig.CreateStatic(module.CorLibTypes.Void, new SZArraySig(module.CorLibTypes.String))) { Attributes = MethodAttributes.Static, ImplAttributes = MethodImplAttributes.IL | MethodImplAttributes.Managed }; // Add Main param main.ParamDefs.Add(new ParamDefUser("args", 1)); // Create Main body var mainBody = new CilBody(); main.Body = mainBody; // Instance of Execute method var exec = type.Methods.FirstOrDefault(m => m.Name == "Execute"); var exec = type.Methods.FirstOrDefault(m => m.Name == "Execute"); // - This Line Execute How add 2 arguments to the Execute(string line, string key)
Create an account or sign in to comment