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());
        }
        /// 
        /// reads all html files from app folder and puts it inside property htmlString
        /// 
        /// 
        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;
        }
    }
}