コード例 #1
0
        private AssemblyType GetAssemblyType(AssemblyNamespace assemblyNamespace, Type type)
        {
            AssemblyType assemblyType = new AssemblyType();

            assemblyNamespace.AssTypes.Add(assemblyType);
            assemblyType.AssType = type.Name;
            return(assemblyType);
        }
コード例 #2
0
        public AssemblyResult Run(string filename)
        {
            assembly = Assembly.LoadFrom(filename);
            AssemblyResult assemblyResult = new AssemblyResult();

            assemblyResult.AssemblyName = assembly.FullName;

            Type[] types;
            types = assembly.GetTypes();
            foreach (Type type in types)
            {
                AssemblyNamespace assemblyNamespace = GetAssemblyNamespace(assemblyResult, type);
                if (assemblyNamespace != null)
                {
                    AssemblyType assemblyType = GetAssemblyType(assemblyNamespace, type);
                    FillInformationInAssemblyType(assembly, assemblyType, type);
                }
            }
            SortAssemblyResult(assemblyResult);
            return(assemblyResult);
        }
コード例 #3
0
 private void FillInformationInAssemblyType(Assembly assembly, AssemblyType assemblyType, Type type)
 {
     foreach (MethodInfo methodInfo in GetExtensionMethods(assembly, type))
     {
         string methodName = "$Extended$ " + methodInfo.Name;
         methodName += "(";
         bool haveParameters = false;
         foreach (ParameterInfo parameter in methodInfo.GetParameters())
         {
             haveParameters = true;
             methodName    += parameter.ParameterType.Name + " " + parameter.Name + ", ";
         }
         if (haveParameters)
         {
             methodName = methodName.Substring(0, methodName.Length - 2);
         }
         methodName += ")";
         AssemblyMethod assemblyMethod = new AssemblyMethod();
         assemblyMethod.Name = methodName;
         assemblyType.AssMethods.Add(assemblyMethod);
     }
     foreach (MethodInfo methodInfo in type.GetMethods())
     {
         string methodName = methodInfo.Name;
         methodName += "(";
         bool haveParameters = false;
         foreach (ParameterInfo parameter in methodInfo.GetParameters())
         {
             haveParameters = true;
             methodName    += parameter.ParameterType.Name + " " + parameter.Name + ", ";
         }
         if (haveParameters)
         {
             methodName = methodName.Substring(0, methodName.Length - 2);
         }
         methodName += ")";
         AssemblyMethod assemblyMethod = new AssemblyMethod();
         assemblyMethod.Name = methodName;
         assemblyType.AssMethods.Add(assemblyMethod);
     }
     assemblyType.AssMethods.Sort(delegate(AssemblyMethod x, AssemblyMethod y)
     {
         return(x.Name.CompareTo(y.Name));
     });
     foreach (FieldInfo fieldInfo in type.GetFields())
     {
         AssemblyField assemblyField = new AssemblyField();
         assemblyField.Name = fieldInfo.FieldType.Name + " " + fieldInfo.Name;
         assemblyType.AssFields.Add(assemblyField);
     }
     assemblyType.AssFields.Sort(delegate(AssemblyField x, AssemblyField y)
     {
         return(x.Name.CompareTo(y.Name));
     });
     foreach (PropertyInfo propertyInfo in type.GetProperties())
     {
         AssemblyProperty assemblyProperty = new AssemblyProperty();
         assemblyProperty.Name = propertyInfo.PropertyType.Name + " " + propertyInfo.Name;
         assemblyType.AssProperties.Add(assemblyProperty);
     }
     assemblyType.AssProperties.Sort(delegate(AssemblyProperty x, AssemblyProperty y)
     {
         return(x.Name.CompareTo(y.Name));
     });
 }