예제 #1
0
파일: ParserUtil.cs 프로젝트: vogelb/ambeth
        // ============================================================================================
        #region Methods
        // ============================================================================================

        /// <summary>
        /// Analyze the given assemblies.
        /// </summary>
        /// <param name="assemblies">List of assemblies; optional</param>
        /// <param name="moduleMap">Dictionary with the module name of each class file or null (then the assembly is used to get the module
        /// information)); key is the full qualified class name in LOWER CASE and value the module name</param>
        /// <returns>A list of found types as TypeDescription entities; never null (but may be empty)</returns>
        public static IList <TypeDescription> AnalyzeAssemblies(IList <Assembly> assemblies, IDictionary <string, string> moduleMap)
        {
            IList <TypeDescription> foundTypes = new List <TypeDescription>();

            if (assemblies == null)
            {
                return(foundTypes);
            }

            foreach (var assembly in assemblies)
            {
                try
                {
                    string source = GetSource(assembly);
                    foreach (Type type in assembly.GetTypes())
                    {
                        var typeType = ParserUtil.GetTypeType(type);
                        if (typeType != null && !IsTypeSkipped(type))
                        {
                            TypeDescription typeDescription = AnalyzeType(type, typeType, source, moduleMap);
                            foundTypes.Add(typeDescription);
                        }
                    }
                }
                catch (ReflectionTypeLoadException ex)
                {
                    Console.WriteLine("Assembly '" + assembly.FullName + "' can't be parsed due to: " + ex.LoaderExceptions[0].Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Assembly '" + assembly.FullName + "' can't be parsed due to: " + ex.Message);
                }
            }

            return(foundTypes);
        }
예제 #2
0
파일: ParserUtil.cs 프로젝트: vogelb/ambeth
 /// <summary>
 /// Add all runtime visible attributes from the given type to the given description.
 /// </summary>
 /// <param name="givenType">Type to get the method infos from; mandatory</param>
 /// <param name="typeDescription">Description to write the attribute infos to; mandatory</param>
 private static void AddAnnotations(Type givenType, TypeDescription typeDescription)
 {
     GetAnnotationInfo(givenType, typeDescription.Annotations);
 }