Пример #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>();
        }
Пример #2
0
        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>();
        }
Пример #4
0
        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));
        }
Пример #5
0
 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);
 }
Пример #6
0
        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));
 }
Пример #28
0
 private static IMethodInfo Build(MethodDefinition method, IDocumentationMetadata metadata)
 {
     return(new MethodInfo(method, metadata));
 }
Пример #29
0
 private static IPropertyInfo Build(PropertyDefinition property, IDocumentationMetadata metadata)
 {
     return(new PropertyInfo(property, metadata));
 }
Пример #30
0
 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);
 }