예제 #1
0
        private void CreateTree()
        {
            AssemblyNode currentNode = null;

            Type[] types = Metadata.GetAssemblyTypes(_assembly);
            for (int i = 0; i < types.Length; i++)
            {
                currentNode = _tree.GetOrAdd(new AssemblyNode(TypeNode.Namespace, types[i], _nameFuncs[TypeNode.Namespace](types[i])));
                currentNode = currentNode.Childrens.GetOrAdd(new AssemblyNode(TypeNode.Type, types[i], _nameFuncs[TypeNode.Type](types[i])));
                currentNode.Childrens.AddRange(GetMembers(types[i]));
            }
        }
예제 #2
0
        private MethodInfo[] DeleteExtensionMethods(MethodInfo[] methods)
        {
            AssemblyNode currentNode = null;

            MethodInfo[] extensionMethods = methods.Where(method => method.IsDefined(typeof(ExtensionAttribute))).ToArray();
            for (int i = 0; i < extensionMethods.Length; i++)
            {
                Type extensionType = extensionMethods[i].GetParameters()[0].ParameterType;
                currentNode = _tree.GetOrAdd(new AssemblyNode(TypeNode.Namespace, extensionType, _nameFuncs[TypeNode.Namespace](extensionType)));
                currentNode = currentNode.Childrens.GetOrAdd(new AssemblyNode(TypeNode.Type, extensionType, _nameFuncs[TypeNode.Type](extensionType)));
                currentNode.Childrens.Add(new AssemblyNode(TypeNode.Method, extensionMethods[i], _nameFuncs[TypeNode.Method](extensionMethods[i])));
            }
            return(methods.Except(extensionMethods).ToArray());
        }