/// <summary> /// Output HTML, in this case a heading /// </summary> /// <param name="index"></param> public void OutputHtml(System.Text.StringBuilder index, int indent) { bool error = false; Exception MyException = null; try { Example.RunExample(); } catch (Exception ex) { error = true; MyException = ex; } bool found = false; foreach (ExampleFile file in Example.Files.Where(x => x.Status == ExampleFile.FileType.HtmlFile)) { // overview files should come first and be on their own... // they are intended to display on the screen and be // embedded into the index at the appropriate spot if (file.Filename.ToLower() == "overview.html") { index.AppendLine("<li>"); index.AppendLine(file.Contents); index.AppendLine("</li>"); } else { index.Append("<dt><a href=\""); index.Append(file.Filename); index.Append("\">"); index.Append(Example.Name); index.AppendLine("</a></dt>"); index.Append("<dd>"); if (error) { index.Append("<p>Error: "); index.Append(MyException.ToString()); index.Append("</p>"); } index.Append(Example.Description); index.AppendLine("</dd>"); HtmlWrapper wrapper = new HtmlWrapper(file.Contents, Example.Files); wrapper.Export(file.Filename); found = true; } } if (!found) { index.Append("<dt><u>Missing</u> "); index.Append(Example.Name); index.AppendLine("</dt>"); index.Append("<dd>"); index.Append(Example.Description); index.AppendLine("</dd>"); } }
/// <summary> /// Output HTML, in this case a heading /// </summary> /// <param name="index"></param> public void OutputHtml(System.Text.StringBuilder index, int indent) { bool error = false; Exception MyException = null; try { Example.RunExample(); } catch (Exception ex) { error = true; MyException = ex; } bool found = false; foreach (ExampleFile file in Example.Files.Where(x => x.Status == ExampleFile.FileType.HtmlFile)) { // overview files should come first and be on their own... // they are intended to display on the screen and be // embedded into the index at the appropriate spot if (file.Filename.ToLower() == "overview.html") { index.AppendLine("<li>"); index.AppendLine(file.Contents); index.AppendLine("</li>"); } else { index.Append("<dt><a href=\""); index.Append(file.Filename); index.Append("\">"); index.Append(Example.Name); index.AppendLine("</a></dt>"); index.Append("<dd>"); if (error) { index.Append("<p>Error: "); index.Append(MyException.ToString()); index.Append("</p>"); } index.Append(Example.Description); index.AppendLine("</dd>"); HtmlWrapper wrapper = new HtmlWrapper(file.Contents, Example.Files); wrapper.Export(file.Filename); found = true; } } if (!found) { index.Append("<dt><u>Missing</u> "); index.Append(Example.Name); index.AppendLine("</dt>"); index.Append("<dd>"); index.Append(Example.Description); index.AppendLine("</dd>"); } }