Esempio n. 1
0
        public void Generate(string applicationPath, IEnumerable <DocumentationCategory> categories, string outputFolder)
        {
            if (!string.IsNullOrEmpty(CodePath))
            {
                var root  = Path.Combine(applicationPath, CodePath);
                var files = Directory.EnumerateFiles(root, "*.cs", SearchOption.AllDirectories);
                var file  = new StringBuilder();

                var roots = categories.Where(category => category.IncludeInTableOfContents).Select(category => new Category
                {
                    Name          = category.Name,
                    NiceName      = DocumentationGenerator.GetNiceName(category.Name),
                    Id            = DocumentationGenerator.GetId(category.Name),
                    Documentation = category,
                    Sections      = Sections
                                    .Select(sectionName => new Section
                    {
                        Name     = sectionName,
                        NiceName = DocumentationGenerator.GetNiceName(sectionName),
                        Id       = DocumentationGenerator.GetId(sectionName),
                        Types    = GetTypes(category, sectionName, files)
                    })
                                    .ToList()
                });

                foreach (var category in roots)
                {
                    var contents = GenerateCategory(category);
                    file.Append(contents);
                }

                var tableOfContents = Templates.File.Replace(_categoriesTag, file.ToString());
                DocumentationGenerator.WriteFile(outputFolder, OutputFile, tableOfContents);
            }
        }
Esempio n. 2
0
        public void Generate(string outputFolder)
        {
            var types = DocumentationGenerator.FindTypes(type => !type.IsEnum && DocumentationGenerator.IsTypeIncluded(type, IncludedTypes, IncludedNamespaces, ExcludedNamespaces));

            var warnings = GenerateLogDescriptions(types, _warningFieldSuffix, MessageTemplate);
            var errors   = GenerateLogDescriptions(types, _errorFieldSuffix, MessageTemplate);

            var content = DocumentTemplate
                          .Replace(_logWarningsTag, warnings)
                          .Replace(_logErrorsTag, errors);

            DocumentationGenerator.WriteFile(outputFolder, OutputFile, content);
        }
Esempio n. 3
0
        public void Generate(IEnumerable <DocumentationCategory> allCategories, string outputFolder)
        {
            Id            = DocumentationGenerator.GetId(Name);
            NiceName      = DocumentationGenerator.GetNiceName(Name);
            AllCategories = allCategories;

            var types = GetTypes();
            var index = new StringBuilder();
            var files = new List <string>();
            var first = true;

            foreach (var type in types)
            {
                var typeIndex = type.GenerateIndex(this);
                var typeFile  = type.GenerateFile(this);

                if (!first)
                {
                    index.Append(Templates.TypeSeparator);
                }

                index.Append(typeIndex);
                first = false;

                DocumentationGenerator.WriteFile(outputFolder, type.Filename, typeFile);
            }

            var contents = Templates.CategoryFile
                           .Replace(DocumentationGenerator.CategoryNameTag, Name)
                           .Replace(DocumentationGenerator.CategoryNiceNameTag, NiceName)
                           .Replace(DocumentationGenerator.CategoryIdTag, Id)
                           .Replace(_typesTag, index.ToString());

            var filename = CategoryFilename
                           .Replace(DocumentationGenerator.CategoryNameTag, Name)
                           .Replace(DocumentationGenerator.CategoryNiceNameTag, NiceName)
                           .Replace(DocumentationGenerator.CategoryIdTag, Id);

            DocumentationGenerator.WriteFile(outputFolder, filename, contents);
        }