示例#1
0
        private void btnInject_Click(object sender, EventArgs e)
        {
            var modulePath     = txtPath.Text;
            var assemblyEditor = new AssemblyEditor(modulePath);
            var methodPatcher  = assemblyEditor.GetPatcher <MethodPatcher>();

            if (methodPatcher == null)
            {
                return;
            }

            // TODO: KG - Check that namespaces are looking good from outside AssemblyPatcher.Core
            //AssemblyPatcher.Patchers.


            methodPatcher.AddPatch(new LogMethodNamePatch());
            //methodPatcher.AddPatch(new LogMethodParametersPatch());
            //methodPatcher.AddPatch(new LogMethodResultPatch());


            methodPatcher.AppliesTo("CalculatorLib.Calculator").AppliesTo("Add", "Add2");
            //methodPatcher.AppliesTo("CalculatorLib.Calculator").AppliesTo(typeof(Calculator).GetMethod("Add"));
            //methodPatcher.AppliesTo(typeof(Calculator)).AppliesTo("Add", "Sub");
            //methodPatcher.AppliesTo(typeof(Calculator)).AppliesTo(typeof(Calculator).GetMethod("Add"));
            if (methodPatcher.ApplyPatches())
            {
                // TODO: KG - Change path for real path here
                assemblyEditor.Write(@"E:\Dropbox\Projects\AssemblyPatcher\Main\bin\Debug\CalculatorLib2.dll");
            }
        }
示例#2
0
        private void btnEditAssembly_Click(object sender, EventArgs e)
        {
            AssemblyEditor ae = new AssemblyEditor();

            ae.ShowDialog();
            ae.Dispose();
        }