using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Spaces;

public partial class Include_ftb_InsertCode : System.Web.UI.Page
{
   
        protected System.Web.UI.WebControls.TextBox CodeTextBox;


        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.Expires = -1;
            if (!IsPostBack)
            {


            }

        }

        #region Web 窗体设计器生成的代码
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {

        }
        #endregion

        protected void HighlightButton_Click(object sender, System.EventArgs e)
        {
            string lanuage = LanguageDropDownList.SelectedItem.Value;

            HighLighter hl = new HighLighter();
            hl.ReplaceEnter = true;
            string path = Server.MapPath(string.Format("{0}/include/defs/", Globals.ApplicationPath));
            string html = hl.colorText(CodeText.Text, path, lanuage);
            html = html.Replace("\"", "\\\"");
            html = html.Replace("\r\n", "\"+\r\n\"");
   
            string divstr = @"<div style='BORDER-RIGHT: windowtext 0.5pt solid;PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px;PADDING-TOP: 4px; 	BORDER-LEFT: windowtext 0.5pt solid;WIDTH: 98%;	BORDER-BOTTOM: windowtext 0.5pt solid'>";
            divstr = string.Empty;
            Response.Write(@"
				<script language='javascript'>
				window.parent.returnValue = """ + divstr + html + @""";
				window.parent.close();
				</script>");

           

        }

        public void CodeHighlighter_PostRender(object sender, System.EventArgs e)
        {
            if (IsPostBack)
            {

            }

        }


    }
