コード例 #1
0
        static void ProcessClass(ClassDef classDef, Method startLogMethod, Method endLogMethod)
        {
            // Don't modify the class methods that we are going to emit calls to, otherwise we'll get unbounded recursion.
            //if (classDef.Name() == methodLoggerClassName)
            //    return;

            //if (classFilter.PassesFilter(classDef) == false)
            //    return;

            foreach (NestedClassDef c in classDef.GetNestedClasses())
            {
                ProcessClass(c, startLogMethod, endLogMethod);
            }
            Console.WriteLine("Processing  Class:" + classDef.Name());
            foreach (MethodDef methodDef in classDef.GetMethods())
            {
                if (methodDef.Name().ToLower() == ".ctor" || methodDef.Name().ToLower() == "dispose" || methodDef.Name().ToLower() == "initializecomponent")
                {
                    continue;
                }
                ModifyCode(classDef, methodDef, startLogMethod, endLogMethod);
            }
        }