private void SendToc() { HHExtractor extr = null; try { string filePath = this.GetRequestPhysicalPath(); extr = new HHExtractor(filePath); extr.OpenFile(); string htmlToc = extr.GetTocAsHtml(this.GetAppPath()); m_context.Response.Write(htmlToc); this.SetCacheability(); } catch (Exception ex) { throw new Exception("Cannot send TOC.", ex); } finally { if (extr != null) { extr.CloseAllFiles(); } } }
private void SendFramesIndex() { HHExtractor extr = null; try { string filePath = this.GetRequestPhysicalPath(); extr = new HHExtractor(filePath); extr.OpenFile(); string defaultTopic = extr.DefaultTopic; bool hasTableOfContents = extr.HasTableOfContents; if (hasTableOfContents) { StringBuilder sb = new StringBuilder(); sb.Append("<html>\n"); sb.Append(" <head>\n"); sb.Append(" <title>"); sb.Append(extr.Title); sb.Append("</title>\n"); sb.Append(" <script language=JavaScript>\n"); sb.Append(" if (top.location != self.location)\n"); sb.Append(" top.location = self.location;\n"); sb.Append(" </script>\n"); sb.Append(" </head>\n"); sb.Append(" <frameset cols='250,*' framespacing=6 bordercolor=#6699CC>\n"); sb.Append(" <frame name=contents src='toc' frameborder=0 scrolling=no>\n"); sb.Append(" <frame name=main src='"+ defaultTopic + "' frameborder=1>\n"); sb.Append(" </frameset>\n"); sb.Append("</html>\n"); m_context.Response.Write(sb.ToString()); } else { m_context.Response.Redirect(m_context.Request.CurrentExecutionFilePath + "/" + defaultTopic); } this.SetCacheability(); } catch (Exception ex) { throw new Exception("Cannot send frame index.", ex); } finally { if (extr != null) { extr.CloseAllFiles(); } } }