internal static void Main(string[] args) { var allFolders = Directory.GetDirectories(Environment.CurrentDirectory); var currentTaskDirectoryName = new DirectoryInfo(Environment.CurrentDirectory).Name; var mdFile = new MarkupFileTemplate(currentTaskDirectoryName); foreach (var folder in allFolders) { var xmlFiles = Directory.GetFiles(string.Format("{0}/bin/Debug", folder), "*.xml"); foreach (var xmlFile in xmlFiles) { var xmlDocument = XDocument.Load(string.Format(xmlFile)); var summary = xmlDocument.Descendants("members").Descendants("member") .Select(x => x.Element("summary")) .FirstOrDefault(); var taskName = xmlDocument.Descendants("assembly") .Select(x => x.Element("name")) .FirstOrDefault(); var task = new Task(); if (taskName != null) { task.Name = taskName.Value.Trim(new[] { ' ', '_' }); } else { task.Name = "No task name"; } if (summary != null) { task.Description = Regex.Replace(summary.Value.Trim(), @"\s+", " "); } else { task.Description = "No task description"; } mdFile.AddTask(task); } } using (var output = new StreamWriter(string.Format( @"{0}\{1}{2}", Environment.CurrentDirectory, OutputFileName, OutputFileExtention))) { output.WriteLine(mdFile.ToString()); } }
public void AddTask(Task task) { this.Tasks.Add(task); }