예제 #1
0
 /// <summary>
 /// Returns a DependencyCollection suitable to the -excludeMembers command line flag (the DependencyCollection of the TypeDefinition or a new MemberDependencyCollection for the member).
 /// </summary>
 /// <param name="dependencies">The DependencyCollection of the TypeDeclaration</param>
 /// <param name="member">The member of the TypeDeclaration.</param>
 /// <param name="memberType">The kind of member to be dealt with.</param>
 /// <returns></returns>
 private static DependencyCollection RetrieveAppropriateDependencyCollection(TypeDependencyCollection dependencies, IMemberDefinition member, MemberType memberType)
 {
     DependencyCollection memberDependencies = dependencies;
     if (!excludeMembers)
     {
         memberDependencies = dependencies.AddMemberDependencyCollection(member, memberType);
     }
     return memberDependencies;
 }
예제 #2
0
        /// <summary>
        /// Collects the dependency information for a given TypeDefinition.
        /// </summary>
        /// <param name="typeDef">The TypeDefinition to investigate.</param>
        /// <param name="parentNode">The XmlNode to which the output will be attached.</param>       
        private static void VisitType(TypeDefinition typeDef, XmlNode parentNode)
        {
            // prepare a collection for the dependencies of the typeDefintion
            TypeDependencyCollection dependencies = new TypeDependencyCollection(typeDef);

            SourceFile sourceFile = new SourceFile();
            VisitAttributes(typeDef.CustomAttributes, dependencies, sourceFile);
            VisitGenericParameters(typeDef.GenericParameters, dependencies, sourceFile);
           
            // visit all members
            foreach (MethodDefinition method in typeDef.Methods) // also Constructors and Properties reside in this collection
            {
                DependencyCollection methDependencies = RetrieveAppropriateDependencyCollection(dependencies, method, MemberType.Method);
                VisitMethod(method, methDependencies);
            }
            foreach (FieldDefinition field in typeDef.Fields)
            {
                DependencyCollection fieldDependencies = RetrieveAppropriateDependencyCollection(dependencies, field, MemberType.Field);
                VisitAttributes(field.CustomAttributes, fieldDependencies, sourceFile);
                InsertDependentTypes(field.FieldType, fieldDependencies, sourceFile);
            }
            foreach (EventDefinition eventDef in typeDef.Events)
            {
                DependencyCollection eventDependencies = RetrieveAppropriateDependencyCollection(dependencies, eventDef, MemberType.Event);
                VisitAttributes(eventDef.CustomAttributes, eventDependencies, sourceFile);
                InsertDependentTypes(eventDef.EventType, eventDependencies, sourceFile);
            }

            // Write the output for the given type
            outputWriter.AddXmlForTypeDefinition(parentNode, dependencies);

            foreach (TypeDefinition nestedType in typeDef.NestedTypes)
            {
                VisitType(nestedType, parentNode);
            }
        }
예제 #3
0
파일: ILAnalyzer.cs 프로젝트: fotisp/conqat
        /// <summary>
        /// Collects the dependency information for a given TypeDefinition.
        /// </summary>
        /// <param name="typeDef">The TypeDefinition to investigate.</param>
        /// <param name="parentNode">The XmlNode to which the output will be attached.</param>       
        private static void VisitType(TypeDefinition typeDef, XmlNode parentNode)
        {
            // prepare a collection for the dependencies of the typeDefintion
            TypeDependencyCollection dependencies = new TypeDependencyCollection(typeDef);

            SourceFile sourceFile = new SourceFile();
            VisitAttributes(typeDef.CustomAttributes, dependencies, sourceFile);
            VisitGenericParameters(typeDef.GenericParameters, dependencies, sourceFile);

            // visit all members
            foreach (MethodDefinition method in typeDef.Methods) // also Constructors and Properties reside in this collection
            {
                DependencyCollection methDependencies = RetrieveAppropriateDependencyCollection(dependencies, method, MemberType.Method);
                VisitMethod(method, methDependencies);
            }
            foreach (FieldDefinition field in typeDef.Fields)
            {
                DependencyCollection fieldDependencies = RetrieveAppropriateDependencyCollection(dependencies, field, MemberType.Field);
                VisitAttributes(field.CustomAttributes, fieldDependencies, sourceFile);
                InsertDependentTypes(field.FieldType, fieldDependencies, sourceFile);
            }
            foreach (EventDefinition eventDef in typeDef.Events)
            {
                DependencyCollection eventDependencies = RetrieveAppropriateDependencyCollection(dependencies, eventDef, MemberType.Event);
                VisitAttributes(eventDef.CustomAttributes, eventDependencies, sourceFile);
                InsertDependentTypes(eventDef.EventType, eventDependencies, sourceFile);
            }

            // Write the output for the given type
            outputWriter.AddXmlForTypeDefinition(parentNode, dependencies);

            foreach (TypeDefinition nestedType in typeDef.NestedTypes)
            {
                VisitType(nestedType, parentNode);
            }
        }
예제 #4
0
파일: ILAnalyzer.cs 프로젝트: fotisp/conqat
 /// <summary>
 /// Returns a DependencyCollection suitable to the -excludeMembers command line flag (the DependencyCollection of the TypeDefinition or a new MemberDependencyCollection for the member).
 /// </summary>
 /// <param name="dependencies">The DependencyCollection of the TypeDeclaration</param>
 /// <param name="member">The member of the TypeDeclaration.</param>
 /// <param name="memberType">The kind of member to be dealt with.</param>
 /// <returns></returns>
 private static DependencyCollection RetrieveAppropriateDependencyCollection(TypeDependencyCollection dependencies, IMemberDefinition member, MemberType memberType)
 {
     DependencyCollection memberDependencies = dependencies;
     if (!excludeMembers)
     {
         memberDependencies = dependencies.AddMemberDependencyCollection(member, memberType);
     }
     return memberDependencies;
 }