using System; using System.IO; using System.Text; using DaveSexton.DocProject; namespace SandcastleDocumentation { public class CustomTopics { public static int Import(BuildContext context, string target) { int count; string rootFolder = context.ProjectDirectory; string sourceFolder = Path.Combine(rootFolder, "Custom Topics"); string targetFolder = Path.Combine(rootFolder, target); count = CopyAllFilesInSourceToTarget(sourceFolder, targetFolder); MergeTOC(rootFolder, sourceFolder, "*.hhc"); MergeTOC(rootFolder, sourceFolder, "*.hhk"); return count; } private static void MergeTOC(string rootFolder, string sourceFolder, string fileExtension) { System.Diagnostics.Debug.Write("---MergeTOC---"); string[] projectTOCFiles = Directory.GetFiles(rootFolder, fileExtension); string[] sourceTOCFile = Directory.GetFiles(sourceFolder, fileExtension); foreach(string tocPath in projectTOCFiles) { System.Diagnostics.Debug.Write(tocPath); StreamReader sr = new StreamReader(tocPath); string contents = sr.ReadToEnd(); sr.Close(); if (sourceTOCFile.Length > 0) { StreamReader sourceSr = new StreamReader(sourceTOCFile[0]); string newTOC = sourceSr.ReadToEnd(); sourceSr.Close(); int indexOf = contents.IndexOf("