You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace siprp
{
public partial class GetViewsHtml : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(GenerateHtml());
}
/// <summary>
/// reads all html files from app folder and puts it inside property htmlString
/// </summary>
/// <returns></returns>
public static string GenerateHtml()
{
string[] htmlFiles = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath("~/app"), "*.html", System.IO.SearchOption.AllDirectories);
StringBuilder sb = new StringBuilder();
foreach (string file in htmlFiles)
{
System.IO.StreamReader htmlFile = new System.IO.StreamReader(file);
string html = htmlFile.ReadToEnd();
sb.AppendLine(html);
htmlFile.Close();
htmlFile.Dispose();
}
var htmlString = sb.ToString();
//compress html
var compressor = new ZetaHtmlCompressor.HtmlContentCompressor();
htmlString = compressor.Compress(htmlString);
return htmlString;
}
}
}