static void WriteHelpTableOfContents(List <HelpItem> items, string contentsTemplatePath, string inputDir, string tocTempOut) { string contentsTemplate = TextFile.AsString(contentsTemplatePath); TextWriter s = new StreamWriter(tocTempOut); AppendTextFileToStream(s, inputDir + "toc-preamble.txt"); AppendTextFileToStream(s, inputDir + "toc-error-preamble.txt"); foreach (HelpItem hi in items) { if (('E' == hi.helpID[0] || 'A' == hi.helpID[0]) && "ERROR" != hi.problem.Substring(0, 5)) { string cs = DoReplacements(contentsTemplate, hi); s.Write(cs); } } AppendTextFileToStream(s, inputDir + "toc-error-postamble.txt"); AppendTextFileToStream(s, inputDir + "toc-info-preamble.txt"); foreach (HelpItem hi in items) { if ('I' == hi.helpID[0] && "ERROR" != hi.problem.Substring(0, 5)) { string cs = DoReplacements(contentsTemplate, hi); s.Write(cs); } } AppendTextFileToStream(s, inputDir + "toc-info-postamble.txt"); AppendTextFileToStream(s, inputDir + "toc-warning-preamble.txt"); foreach (HelpItem hi in items) { if ('W' == hi.helpID[0] && "ERROR" != hi.problem.Substring(0, 5)) { string cs = DoReplacements(contentsTemplate, hi); s.Write(cs); } } AppendTextFileToStream(s, inputDir + "toc-warning-postamble.txt"); AppendTextFileToStream(s, inputDir + "toc-postamble.txt"); s.Close(); }
static void WriteHelpFiles(List <HelpItem> items, string templatePath, string tmpDir, string helpDir) { string template = TextFile.AsString(templatePath); foreach (HelpItem hi in items) { if ('P' != hi.helpID[0] && "ERROR" != hi.problem.Substring(0, 5)) { string s = DoReplacements(template, hi); string fname = HelpFileName(helpDir, hi.helpID); WriteFile(fname, s); } } }
static int AppendTextFileToStream(TextWriter outs, string path) { outs.Write(TextFile.AsString(path)); return(0); }