public void BuildText(Site site, PageResources allResources, MarkdownPipeline markdownPipeline) { switch (Type) { case ResourceType.None: SetHtmlTextAsEmpty(); return; case ResourceType.Markdown: BuildMarkdown(site, allResources, markdownPipeline); break; case ResourceType.RichText: try { HtmlText = RtfUtility.RtfToHtml(File.ReadAllText(FullPath)); } catch (Exception e) { throw new BuildException(e, $"Error when parsing \"{FullPath}\" into RTF"); } break; case ResourceType.Html: try { HtmlText = HtmlUtility.Parse(File.ReadAllText(FullPath)); } catch (Exception e) { throw new BuildException(e, $"Error when parsing HTML at \"{FullPath}\""); } break; case ResourceType.Generator: // Generators are processed during the gather stage. return; default: throw new ArgumentOutOfRangeException(); } }