示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="examples">The examples.</param>
        /// <param name="metadata">The type metadata.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable<DocumentedProperty> properties,
            IEnumerable<DocumentedMethod> methods,
            IEnumerable<DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            IEnumerable<ExampleComment> examples,
            IDocumentationMetadata metadata)
            : base(MemberClassification.Type, summary, remarks, examples, metadata)
        {
            Definition = info.Definition;
            TypeClassification = info.Definition.GetTypeClassification();
            Identity = info.Identity;
            Properties = new List<DocumentedProperty>(properties);
            Fields = new List<DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            Constructors = new List<DocumentedMethod>(GetConstructors(documentedMethods));
            Methods = new List<DocumentedMethod>(GetMethods(documentedMethods));
            Operators = new List<DocumentedMethod>(GetOperators(documentedMethods));

            _extensionMethods = new List<DocumentedMethod>();
        }
        private static IAssemblyInfo Build(AssemblyDefinition assembly, IDocumentationMetadata metadata)
        {
            var types = new List <ITypeInfo>();

            foreach (var module in assembly.Modules)
            {
                foreach (var type in module.Types)
                {
                    if (type.IsSpecialName)
                    {
                        continue;
                    }
                    if (type.Name.StartsWith("_"))
                    {
                        continue;
                    }
                    if (!type.IsPublic)
                    {
                        if (!type.Name.EndsWith("NamespaceDoc"))
                        {
                            continue;
                        }
                    }
                    types.Add(Build(type, metadata));
                }
            }
            return(new AssemblyInfo(assembly, types, metadata));
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="examples">The examples.</param>
        /// <param name="metadata">The type metadata.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable <DocumentedProperty> properties,
            IEnumerable <DocumentedMethod> methods,
            IEnumerable <DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            IEnumerable <ExampleComment> examples,
            IDocumentationMetadata metadata)
            : base(MemberClassification.Type, summary, remarks, examples, metadata)
        {
            Definition         = info.Definition;
            TypeClassification = info.Definition.GetTypeClassification();
            Identity           = info.Identity;
            Properties         = new List <DocumentedProperty>(properties);
            Fields             = new List <DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            Constructors = new List <DocumentedMethod>(GetConstructors(documentedMethods));
            Methods      = new List <DocumentedMethod>(GetMethods(documentedMethods));
            Operators    = new List <DocumentedMethod>(GetOperators(documentedMethods));

            _extensionMethods = new List <DocumentedMethod>();
        }
        private static ITypeInfo Build(TypeDefinition type, IDocumentationMetadata metadata)
        {
            // Add methods.
            var methods           = new List <IMethodInfo>();
            var methodDefinitions = type.Methods.Where(x => x.IsPublic || x.IsFamily || x.IsFamilyOrAssembly);

            foreach (var method in methodDefinitions)
            {
                if (!(method.IsGetter || method.IsSetter))
                {
                    methods.Add(Build(method, metadata));
                }
            }

            // Add properties.
            var properties = new List <IPropertyInfo>();

            foreach (var property in type.Properties)
            {
                properties.Add(Build(property, metadata));
            }

            // Add fields.
            var fields           = new List <IFieldInfo>();
            var fieldDefinitions = type.Fields.Where(x => x.IsPublic || x.IsFamily || x.IsFamilyOrAssembly);

            foreach (var field in fieldDefinitions.Where(x => !x.IsSpecialName))
            {
                fields.Add(Build(field, metadata));
            }

            return(new TypeInfo(type, metadata, methods, properties, fields));
        }
 private static IAssemblyInfo Build(AssemblyDefinition assembly, IDocumentationMetadata metadata)
 {
     var types = new List<ITypeInfo>();
     foreach (var module in assembly.Modules)
     {
         foreach (var type in module.Types)
         {
             if (type.IsSpecialName)
             {
                 continue;
             }
             if (type.Name.StartsWith("_"))
             {
                 continue;
             }
             if (!type.IsPublic)
             {
                 if (!type.Name.EndsWith("NamespaceDoc"))
                 {
                     continue;    
                 }
             }
             types.Add(Build(type, metadata));
         }
     }
     return new AssemblyInfo(assembly, types, metadata);
 }
        private static ITypeInfo Build(TypeDefinition type, IDocumentationMetadata metadata)
        {
            // Add methods.
            var methods = new List<IMethodInfo>();
            var methodDefinitions = type.Methods.Where(x => x.IsPublic || x.IsFamily || x.IsFamilyOrAssembly);
            foreach (var method in methodDefinitions)
            {
                if (!(method.IsGetter || method.IsSetter))
                {
                    methods.Add(Build(method, metadata));
                }
            }

            // Add properties.
            var properties = new List<IPropertyInfo>();
            foreach (var property in type.Properties)
            {
                properties.Add(Build(property, metadata));
            }

            // Add fields.
            var fields = new List<IFieldInfo>();
            var fieldDefinitions = type.Fields.Where(x => x.IsPublic || x.IsFamily || x.IsFamilyOrAssembly);
            foreach (var field in fieldDefinitions.Where(x => !x.IsSpecialName))
            {
                fields.Add(Build(field, metadata));
            }

            return new TypeInfo(type, metadata, methods, properties, fields);
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedParameter"/> class.
 /// </summary>
 /// <param name="definition">The parameter definition.</param>
 /// <param name="comment">The parameter comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedParameter(ParameterDefinition definition, ParamComment comment, IDocumentationMetadata metadata)
     : base(MemberClassification.Parameter,  null, null, null, metadata)
 {
     _definition = definition;
     _comment = comment;
     _isOutParameter = definition.IsOut;
     _isRefParameter = definition.ParameterType is ByReferenceType;
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedAssembly"/> class.
 /// </summary>
 /// <param name="info">The assembly information.</param>
 /// <param name="namespaces">The namespaces.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedAssembly(
     IAssemblyInfo info,
     IEnumerable<DocumentedNamespace> namespaces,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Assembly,  null, null, null, metadata)
 {
     Definition = info.Definition;
     Identity = info.Identity;
     Name = GetAssemblyName(info);
     Namespaces = new List<DocumentedNamespace>(namespaces);
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Type, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity   = info.Identity;
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedAssembly"/> class.
 /// </summary>
 /// <param name="info">The assembly information.</param>
 /// <param name="namespaces">The namespaces.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedAssembly(
     IAssemblyInfo info,
     IEnumerable <DocumentedNamespace> namespaces,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Assembly, null, null, null, metadata)
 {
     _definition = info.Definition;
     _identity   = info.Identity;
     _name       = GetAssemblyName(info);
     _namespaces = new List <DocumentedNamespace>(namespaces);
 }
示例#11
0
 public AssemblyInfo(
     AssemblyDefinition definition, 
     IEnumerable<ITypeInfo> types, 
     IDocumentationMetadata metadata)
 {
     _definition = definition;
     _metadata = metadata;
     _name = definition.Name.Name;
     _identity = definition.FullName;
     _types = new List<ITypeInfo>(types);
 }
示例#12
0
 public AssemblyInfo(
     AssemblyDefinition definition,
     IEnumerable <ITypeInfo> types,
     IDocumentationMetadata metadata)
 {
     _definition = definition;
     _metadata   = metadata;
     _name       = definition.Name.Name;
     _identity   = definition.FullName;
     _types      = new List <ITypeInfo>(types);
 }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable<ExampleComment> examples,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Type, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity = info.Identity;
 }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedNamespace"/> class.
 /// </summary>
 /// <param name="identity">The Identity.</param>
 /// <param name="name">The namespace name.</param>
 /// <param name="types">The types.</param>
 /// <param name="summaryComment">The summary comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedNamespace(
     string identity,
     string name,
     IEnumerable <DocumentedType> types,
     SummaryComment summaryComment,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Namespace, summaryComment, null, null, metadata)
 {
     _identity = identity;
     _name     = name;
     _types    = new List <DocumentedType>(types);
 }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedNamespace"/> class.
 /// </summary>
 /// <param name="identity">The Identity.</param>
 /// <param name="name">The namespace name.</param>
 /// <param name="types">The types.</param>
 /// <param name="summaryComment">The summary comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedNamespace(
     string identity,
     string name,
     IEnumerable<DocumentedType> types,
     SummaryComment summaryComment,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Namespace, summaryComment, null, null, metadata)
 {
     Identity = identity;
     Name = name;
     Types = new List<DocumentedType>(types);
 }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="value">The value comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     ValueComment value,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Property, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity   = info.Identity;
     Value      = value;
 }
示例#17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="value">The value comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable<ExampleComment> examples,
     ValueComment value,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Property, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity = info.Identity;
     Value = value;
 }
示例#18
0
 public TypeInfo(
     TypeDefinition type,
     IDocumentationMetadata metadata,
     IEnumerable <IMethodInfo> methods,
     IEnumerable <IPropertyInfo> properties,
     IEnumerable <IFieldInfo> fields)
 {
     _type       = type;
     _metadata   = metadata;
     _methods    = new List <IMethodInfo>(methods);
     _properties = new List <IPropertyInfo>(properties);
     _fields     = new List <IFieldInfo>(fields);
     _identity   = CRefGenerator.GetTypeCRef(type);
 }
示例#19
0
 public DslCategory(
     string name,
     IDocumentationMetadata metadata,
     SummaryComment summary,
     IEnumerable <DocumentedMethod> methods,
     IEnumerable <DslSubCategory> categories)
 {
     _name          = name;
     _metadata      = metadata;
     _summary       = summary;
     _slug          = _name.ToSlug();
     _methods       = new List <DocumentedMethod>(methods);
     _subCategories = new List <DslSubCategory>(categories);
 }
示例#20
0
 public TypeInfo(
     TypeDefinition type,
     IDocumentationMetadata metadata,
     IEnumerable<IMethodInfo> methods, 
     IEnumerable<IPropertyInfo> properties,
     IEnumerable<IFieldInfo> fields)
 {
     _type = type;
     _metadata = metadata;
     _methods = new List<IMethodInfo>(methods);
     _properties = new List<IPropertyInfo>(properties);
     _fields = new List<IFieldInfo>(fields);
     _identity = CRefGenerator.GetTypeCRef(type);
 }
示例#21
0
 public DslCategory(
     string name,
     IDocumentationMetadata metadata,
     SummaryComment summary,
     IEnumerable<DocumentedMethod> methods,
     IEnumerable<DslSubCategory> categories)
 {
     _name = name;
     _metadata = metadata;
     _summary = summary;
     _slug = _name.ToSlug();
     _methods = new List<DocumentedMethod>(methods);
     _subCategories = new List<DslSubCategory>(categories);
 }
示例#22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info, 
     IEnumerable<DocumentedParameter> parameters,
     SummaryComment summary, 
     RemarksComment remarks, 
     IEnumerable<ExampleComment> examples,
     ReturnsComment returns,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Method, summary, remarks, examples, metadata)
 {
     _definition = info.Definition;
     _methodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     _identity = info.Identity;
     _parameters = new List<DocumentedParameter>(parameters);
     _returns = returns;
 }
示例#23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="returns">The return value comment.</param>
 /// <param name="metadata">The method metadata.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable <DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     ReturnsComment returns,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Method, summary, remarks, examples, metadata)
 {
     Definition           = info.Definition;
     MethodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     Identity             = info.Identity;
     Parameters           = new List <DocumentedParameter>(parameters);
     Returns = returns;
 }
示例#24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
        /// </summary>
        /// <param name="classification">The member classification.</param>
        /// <param name="summary">The summary comment.</param>
        /// <param name="remarks">The remarks comment.</param>
        /// <param name="examples">The example comments.</param>
        /// <param name="metadata">The metadata associated with the member.</param>
        protected DocumentedMember(
            MemberClassification classification,
            SummaryComment summary, 
            RemarksComment remarks, 
            IEnumerable<ExampleComment> examples,
            IDocumentationMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException("metadata");
            }

            _classification = classification;
            _summary = summary;
            _remarks = remarks;
            _examples = new List<ExampleComment>(examples ?? Enumerable.Empty<ExampleComment>());
            _metadata = metadata;
        }
示例#25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
        /// </summary>
        /// <param name="classification">The member classification.</param>
        /// <param name="summary">The summary comment.</param>
        /// <param name="remarks">The remarks comment.</param>
        /// <param name="examples">The example comments.</param>
        /// <param name="metadata">The metadata associated with the member.</param>
        protected DocumentedMember(
            MemberClassification classification,
            SummaryComment summary,
            RemarksComment remarks,
            IEnumerable <ExampleComment> examples,
            IDocumentationMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            Classification = classification;
            Summary        = summary;
            Remarks        = remarks;
            Examples       = new List <ExampleComment>(examples ?? Enumerable.Empty <ExampleComment>());
            Metadata       = metadata;
        }
示例#26
0
 public AssemblyViewModel(DocumentedAssembly assembly)
 {
     _metadata   = assembly.Metadata;
     _name       = assembly.Name;
     _namespaces = new List <DocumentedNamespace>(assembly.Namespaces.Where(ns => ns.HasContent));
 }
示例#27
0
 public AssemblyViewModel(DocumentedAssembly assembly)
 {
     _metadata = assembly.Metadata;
     _name = assembly.Name;
     _namespaces = new List<DocumentedNamespace>(assembly.Namespaces.Where(ns => ns.HasContent));
 }
 private static IMethodInfo Build(MethodDefinition method, IDocumentationMetadata metadata)
 {
     return(new MethodInfo(method, metadata));
 }
 private static IPropertyInfo Build(PropertyDefinition property, IDocumentationMetadata metadata)
 {
     return(new PropertyInfo(property, metadata));
 }
 private static IFieldInfo Build(FieldDefinition field, IDocumentationMetadata metadata)
 {
     return(new FieldInfo(field, metadata));
 }
示例#31
0
 private static IFieldInfo Build(FieldDefinition field, IDocumentationMetadata metadata)
 {
     return new FieldInfo(field, metadata);
 }
示例#32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AliasMetadataAdapter" /> class.
 /// </summary>
 /// <param name="metadata">The metadata.</param>
 /// <param name="isPropertyAlias">if set to <c>true</c> [is property alias].</param>
 public AliasMetadataAdapter(IDocumentationMetadata metadata, bool isPropertyAlias)
 {
     _metadata       = metadata;
     IsPropertyAlias = isPropertyAlias;
 }
示例#33
0
 public MethodInfo(MethodDefinition definition, IDocumentationMetadata metadata)
 {
     Definition = definition;
     Metadata   = metadata;
     Identity   = CRefGenerator.GetMethodCRef(definition);
 }
示例#34
0
 public PropertyInfo(PropertyDefinition definition, IDocumentationMetadata metadata)
 {
     Definition = definition;
     Metadata = metadata;
     Identity = CRefGenerator.GetPropertyCRef(definition);
 }
示例#35
0
 private static IMethodInfo Build(MethodDefinition method, IDocumentationMetadata metadata)
 {
     return new MethodInfo(method, metadata);
 }
示例#36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedParameter"/> class.
 /// </summary>
 /// <param name="definition">The parameter definition.</param>
 /// <param name="comment">The parameter comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedParameter(ParameterDefinition definition, ParamComment comment, IDocumentationMetadata metadata)
     : base(MemberClassification.Parameter, null, null, null, metadata)
 {
     _definition     = definition;
     _comment        = comment;
     _isOutParameter = definition.IsOut;
     _isRefParameter = definition.ParameterType is ByReferenceType;
 }
示例#37
0
 public FieldInfo(FieldDefinition definition, IDocumentationMetadata metadata)
 {
     Definition = definition;
     Metadata = metadata;
     Identity = CRefGenerator.GetFieldCRef(definition);
 }
示例#38
0
 public MethodInfo(MethodDefinition definition, IDocumentationMetadata metadata)
 {
     Definition = definition;
     Metadata = metadata;
     Identity = CRefGenerator.GetMethodCRef(definition);
 }
示例#39
0
 public FieldInfo(FieldDefinition definition, IDocumentationMetadata metadata)
 {
     _definition = definition;
     _metadata   = metadata;
     _identity   = CRefGenerator.GetFieldCRef(definition);
 }
示例#40
0
 public AliasMetadataAdapter(IDocumentationMetadata metadata, bool isPropertyAlias)
 {
     _metadata = metadata;
     _isPropertyAlias = isPropertyAlias;
 }
示例#41
0
 public PropertyInfo(PropertyDefinition definition, IDocumentationMetadata metadata)
 {
     _definition = definition;
     _metadata   = metadata;
     _identity   = CRefGenerator.GetPropertyCRef(definition);
 }
示例#42
0
 private static IPropertyInfo Build(PropertyDefinition property, IDocumentationMetadata metadata)
 {
     return new PropertyInfo(property, metadata);
 }