Exemplo n.º 1
0
        public static bool TryParseIgnoredTypeParts(IEnumerable <string> values, out TypeDocumentationParts parts)
        {
            if (!values.Any())
            {
                parts = DocumentationOptions.Default.IgnoredTypeParts;
                return(true);
            }

            parts = TypeDocumentationParts.None;

            foreach (string value in values)
            {
                if (Enum.TryParse(value.Replace("-", ""), ignoreCase: true, out TypeDocumentationParts result))
                {
                    parts |= result;
                }
                else
                {
                    WriteLine($"Unknown type documentation part '{value}'.", Verbosity.Quiet);
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        internal string GetHeading(TypeDocumentationParts part)
        {
            switch (part)
            {
            case TypeDocumentationParts.Examples:
                return(ExamplesTitle);

            case TypeDocumentationParts.Remarks:
                return(RemarksTitle);

            case TypeDocumentationParts.Constructors:
                return(ConstructorsTitle);

            case TypeDocumentationParts.Fields:
                return(FieldsTitle);

            case TypeDocumentationParts.Indexers:
                return(IndexersTitle);

            case TypeDocumentationParts.Properties:
                return(PropertiesTitle);

            case TypeDocumentationParts.Methods:
                return(MethodsTitle);

            case TypeDocumentationParts.Operators:
                return(OperatorsTitle);

            case TypeDocumentationParts.Events:
                return(EventsTitle);

            case TypeDocumentationParts.ExplicitInterfaceImplementations:
                return(ExplicitInterfaceImplementationsTitle);

            case TypeDocumentationParts.ExtensionMethods:
                return(ExtensionMethodsTitle);

            case TypeDocumentationParts.Classes:
                return(ClassesTitle);

            case TypeDocumentationParts.Structs:
                return(StructsTitle);

            case TypeDocumentationParts.Interfaces:
                return(InterfacesTitle);

            case TypeDocumentationParts.Enums:
                return(EnumsTitle);

            case TypeDocumentationParts.Delegates:
                return(DelegatesTitle);

            case TypeDocumentationParts.SeeAlso:
                return(SeeAlsoTitle);

            default:
                throw new ArgumentException("", nameof(part));
            }
        }
Exemplo n.º 3
0
 public GenerateDocCommand(
     GenerateDocCommandLineOptions options,
     DocumentationDepth depth,
     RootDocumentationParts ignoredRootParts,
     NamespaceDocumentationParts ignoredNamespaceParts,
     TypeDocumentationParts ignoredTypeParts,
     MemberDocumentationParts ignoredMemberParts,
     IncludeContainingNamespaceFilter includeContainingNamespaceFilter,
     Visibility visibility,
     in ProjectFilter projectFilter) : base(projectFilter)
Exemplo n.º 4
0
        internal IEnumerable <ISymbol> GetMembers(TypeDocumentationParts ignoredParts = TypeDocumentationParts.None)
        {
            if (!TypeKind.Is(TypeKind.Enum, TypeKind.Delegate))
            {
                if (IsEnabled(TypeDocumentationParts.Constructors))
                {
                    foreach (IMethodSymbol result in GetConstructors())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.Fields))
                {
                    foreach (IFieldSymbol result in GetFields())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.Indexers))
                {
                    foreach (IPropertySymbol result in GetIndexers())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.Properties))
                {
                    foreach (IPropertySymbol result in GetProperties())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.Methods))
                {
                    foreach (IMethodSymbol result in GetMethods())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.Operators))
                {
                    foreach (IMethodSymbol result in GetOperators())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.Events))
                {
                    foreach (IEventSymbol result in GetEvents())
                    {
                        yield return(result);
                    }
                }

                if (IsEnabled(TypeDocumentationParts.ExplicitInterfaceImplementations))
                {
                    foreach (ISymbol result in GetExplicitInterfaceImplementations())
                    {
                        yield return(result);
                    }
                }

                bool IsEnabled(TypeDocumentationParts part)
                {
                    return((ignoredParts & part) == 0);
                }
            }
        }
Exemplo n.º 5
0
        public DocumentationOptions(
            IEnumerable <string> ignoredNames = null,
            string preferredCultureName       = null,
            string rootDirectoryUrl           = null,
            int maxDerivedTypes               = DefaultValues.MaxDerivedTypes,
            bool includeClassHierarchy        = DefaultValues.IncludeClassHierarchy,
            bool placeSystemNamespaceFirst    = DefaultValues.PlaceSystemNamespaceFirst,
            bool formatDeclarationBaseList    = DefaultValues.FormatDeclarationBaseList,
            bool formatDeclarationConstraints = DefaultValues.FormatDeclarationConstraints,
            bool markObsolete = DefaultValues.MarkObsolete,
            bool includeMemberInheritedFrom       = DefaultValues.IncludeMemberInheritedFrom,
            bool includeMemberOverrides           = DefaultValues.IncludeMemberOverrides,
            bool includeMemberImplements          = DefaultValues.IncludeMemberImplements,
            bool includeMemberConstantValue       = DefaultValues.IncludeMemberConstantValue,
            bool includeInheritedInterfaceMembers = DefaultValues.IncludeInheritedInterfaceMembers,
            bool includeAllDerivedTypes           = DefaultValues.IncludeInheritedInterfaceMembers,
            bool includeAttributeArguments        = DefaultValues.IncludeAttributeArguments,
            bool includeInheritedAttributes       = DefaultValues.IncludeInheritedAttributes,
            bool omitIEnumerable                                      = DefaultValues.OmitIEnumerable,
            DocumentationDepth depth                                  = DefaultValues.Depth,
            InheritanceStyle inheritanceStyle                         = DefaultValues.InheritanceStyle,
            RootDocumentationParts ignoredRootParts                   = RootDocumentationParts.None,
            NamespaceDocumentationParts ignoredNamespaceParts         = NamespaceDocumentationParts.None,
            TypeDocumentationParts ignoredTypeParts                   = TypeDocumentationParts.None,
            MemberDocumentationParts ignoredMemberParts               = MemberDocumentationParts.None,
            OmitContainingNamespaceParts omitContainingNamespaceParts = OmitContainingNamespaceParts.None,
            bool scrollToContent                                      = DefaultValues.ScrollToContent)
        {
            if (maxDerivedTypes < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxDerivedTypes), maxDerivedTypes, "Maximum number of derived items must be greater than or equal to 0.");
            }

            _ignoredMetadataNames = ignoredNames?.Select(name => MetadataName.Parse(name)).ToImmutableArray() ?? default;

            IgnoredNames                     = ignoredNames?.ToImmutableArray() ?? ImmutableArray <string> .Empty;
            PreferredCultureName             = preferredCultureName;
            RootDirectoryUrl                 = rootDirectoryUrl;
            MaxDerivedTypes                  = maxDerivedTypes;
            IncludeClassHierarchy            = includeClassHierarchy;
            PlaceSystemNamespaceFirst        = placeSystemNamespaceFirst;
            FormatDeclarationBaseList        = formatDeclarationBaseList;
            FormatDeclarationConstraints     = formatDeclarationConstraints;
            MarkObsolete                     = markObsolete;
            IncludeMemberInheritedFrom       = includeMemberInheritedFrom;
            IncludeMemberOverrides           = includeMemberOverrides;
            IncludeMemberImplements          = includeMemberImplements;
            IncludeMemberConstantValue       = includeMemberConstantValue;
            IncludeInheritedInterfaceMembers = includeInheritedInterfaceMembers;
            IncludeAllDerivedTypes           = includeAllDerivedTypes;
            IncludeAttributeArguments        = includeAttributeArguments;
            IncludeInheritedAttributes       = includeInheritedAttributes;
            OmitIEnumerable                  = omitIEnumerable;
            Depth                        = depth;
            InheritanceStyle             = inheritanceStyle;
            IgnoredRootParts             = ignoredRootParts;
            IgnoredNamespaceParts        = ignoredNamespaceParts;
            IgnoredTypeParts             = ignoredTypeParts;
            IgnoredMemberParts           = ignoredMemberParts;
            OmitContainingNamespaceParts = omitContainingNamespaceParts;
            ScrollToContent              = scrollToContent;
        }