Ejemplo n.º 1
0
        /// <summary>
        /// Creates a readme to list which model groups are being generated.
        /// </summary>
        public static void UpdateMainReadme(Assembly executingAssembly, List <List <Manifest> > manifests, string savePath, string[] testGroupName)
        {
            // Use the manifest list to build a table of contents.
            var newTableOfContents = new StringBuilder();
            var testGroupNameIndex = 0;

            foreach (var manifest in manifests)
            {
                newTableOfContents.AppendLine("");
                newTableOfContents.AppendLine($"## {testGroupName[testGroupNameIndex]} Tests");
                foreach (var modelGroup in manifest)
                {
                    string folderName = ReadmeExtensionMethods.GenerateNameWithSpaces(modelGroup.Folder);
                    newTableOfContents.AppendLine($"- [{folderName}](Output/{testGroupName[testGroupNameIndex]}/{modelGroup.Folder}/README.md)");
                }
                testGroupNameIndex++;
            }

            // Reads the readme file template.
            string template;

            using (Stream stream = executingAssembly.GetManifestResourceStream("AssetGenerator.ReadmeTemplates.Page_Main.md"))
                using (var streamReader = new StreamReader(stream))
                {
                    template = streamReader.ReadToEnd();
                }

            // Find and replace the table of contents section with the newly built one.
            template = template.Replace($"~~TableOfContents~~", newTableOfContents.ToString());

            // Write out the readme file.
            string readmeFilePath = Path.Combine(savePath, "README.md");

            File.WriteAllText(readmeFilePath, template);
        }
Ejemplo n.º 2
0
 public Property(PropertyName enumName, string displayValue)
 {
     Name             = enumName;
     ReadmeColumnName = ReadmeExtensionMethods.GenerateNameWithSpaces(enumName.ToString());
     ReadmeValue      = displayValue;
 }