📄 htmlhandler.cs
字号:
using System;
using System.Web;
using System.IO;
using System.Text;
using System.Collections;
using Lion.Data.Library.HtmlEditor;
using Lion.Data.Library.HtmlEditor.Core;
namespace Lion.Data.Library.HtmlEditor.Core
{
/// <summary>
/// HtmlHandler 的摘要说明。
/// </summary>
internal class HtmlHandler
{
#region Function Custom
internal static void HtmlDialogContent(HttpContext context)
{
string Argument = Helper.Context.Server.UrlDecode(context.Request.QueryString["configfile"]);
string StyleName = context.Request.QueryString["style"];
string filename = null;
if(context.Request["filename"]==null)
throw new ArgumentNullException("filename");
else
filename = context.Request["filename"];
if(filename.IndexOf("?")!=-1)
{
filename = filename.Replace("?","&");
context.Response.Redirect("HtmlHandler.aspx?filename="+filename+"&configfile="+Argument+"&style="+StyleName,true);
return;
}
StringBuilder Sb = Helper.GetHtml(filename.StartsWith("/")?filename:"/"+filename);
Hashtable hs = ((System.Collections.Hashtable)context.Application[Argument]);
System.Xml.XmlDocument doc = (System.Xml.XmlDocument)hs["Style"];
string sBaseUrl = doc.SelectSingleNode("/Root/Style/S_Name[text()='"+ StyleName +"']").ParentNode.SelectSingleNode("S_BaseUrl").InnerText;
Sb.Replace("{configfile}",Argument);
Sb.Replace("{sStyleName}",StyleName);
//sUpLoadImgPath
string sUpLoadImgPath = doc.SelectSingleNode("/Root/Style/S_Name[text()='"+ StyleName +"']").ParentNode.SelectSingleNode("S_UpLoadImagesPath").InnerText;
if(sBaseUrl=="1")
{
sUpLoadImgPath = Helper.RelativePath2RootPath(sUpLoadImgPath);
}
else if(sBaseUrl=="2")
{
sUpLoadImgPath = Helper.RootPath2DomainPath(sUpLoadImgPath);
}
Sb.Replace("{sUpLoadImgPath}",sUpLoadImgPath);//
//sEmotImgPath
string sEmotImgPath = doc.SelectSingleNode("/Root/Style/S_Name[text()='"+ StyleName +"']").ParentNode.SelectSingleNode("S_EmotImagesPath").InnerText;
if(sBaseUrl=="1")
{
sEmotImgPath = Helper.RelativePath2RootPath(sEmotImgPath);
}
else if(sBaseUrl=="2")
{
sEmotImgPath = Helper.RootPath2DomainPath(sEmotImgPath);
}
Sb.Replace("{sEmotImgPath}",sEmotImgPath);
//sBgImgPath
string sBgImgPath = doc.SelectSingleNode("/Root/Style/S_Name[text()='"+ StyleName+"']").ParentNode.SelectSingleNode("S_BackgroundImagesPath").InnerText;
if(sBaseUrl=="1")
{
sBgImgPath = Helper.RelativePath2RootPath(sBgImgPath);
}
else if(sBaseUrl=="2")
{
sBgImgPath = Helper.RootPath2DomainPath(sBgImgPath);
}
Sb.Replace("{sBgImgPath}",sBgImgPath);
//sButtonImgPath
string sButtonImgPath = doc.SelectSingleNode("/Root/Style/S_Name[text()='"+ StyleName +"']").ParentNode.SelectSingleNode("S_ButtonImagesPath").InnerText;
if(sBaseUrl=="1")
{
sButtonImgPath = Helper.RelativePath2RootPath(sButtonImgPath);
}
else if(sBaseUrl=="2")
{
sButtonImgPath = Helper.RootPath2DomainPath(sButtonImgPath);
}
Sb.Replace("{sButtonImgPath}",sButtonImgPath);
context.Response.Expires=0;
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.ContentEncoding = Encoding.Default;
context.Response.ContentType="text/html";
context.Response.Clear();
context.Response.Write(Sb.ToString());
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -