无为清净楼资源网 Design By www.qnjia.com
复制代码 代码如下:
using System;
using System.Web;
using System.Web.UI;
using System.Text.RegularExpressions;
namespace STH.function
{
/// <summary>
/// UbbCode 的摘要说明。
/// </summary>
public class UbbCode
{
Root theroot=new Root();
HttpContext context = HttpContext.Current;
public UbbCode()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public String unhtml(string str)
{
str = context.Server.HtmlEncode(str);
str = str.Replace("&","&");
return str;
}
public String turnit(string str)
{
Regex r;
Match m;
str = str.Replace("[","[|");
str = str.Replace("]","|]");
r = new Regex(@"(http|mms|rtsp|ftp|https)(:\/\/)");
for (m = r.Match(str); m.Success; m = m.NextMatch())
{
str = str.Replace(m.Groups[0].ToString(), m.Groups[1].ToString() + "$"+m.Groups[2].ToString());
}
return str;
}
public String turnof(string str)
{
Regex r;
Match m;
str = str.Replace("[|","[");
str = str.Replace("|]","]");
r = new Regex(@"(http|mms|rtsp|ftp|https)(\$:\/\/)");
for (m = r.Match(str); m.Success; m = m.NextMatch())
{
str = str.Replace(m.Groups[0].ToString(), m.Groups[1].ToString() + m.Groups[2].ToString().Replace("$",""));
}
return str;
}
public String UBB(string sDetail)
{
Regex r;
Match m;
sDetail = sDetail.Replace("[swf]","[swf=300,250]");
sDetail = sDetail.Replace("[rm]","[rm=300,250]");
sDetail = sDetail.Replace("[mp]","[mp=300,250]");
sDetail = unhtml(sDetail);
sDetail = sDetail.Replace("\n","<br />");
//sDetail = sDetail.Replace(" "," ");
//[code]标签
r = new Regex(@"(\[code\])([\s\S]+?)(\[\/code\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<textarea style=\"border: 1px solid #94BBE2;width:98%;OVERFLOW: hidden;cursor:default;\" rows=\"15\" onclick=\"this.style.posHeight=this.scrollHeight\">" + turnit(m.Groups[2].ToString().Replace("<br />","\n")) + "</textarea>");
}
int i=1;
r = new Regex(@"(\[html\])([\s\S]+?)(\[\/html\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
i=i+1;
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<TEXTAREA rows=\"12\" style=\"width:98%\" id=\"rid"+i+"\">" + turnit(m.Groups[2].ToString().Replace("<br />","\n")) + "</TEXTAREA><INPUT onclick=\"runEx('rid"+i+"')\" type=button value=\"Have A Try\" class=\"input1\"> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行] ");
//sDetail = sDetail.Replace("<br />","");
}
sDetail=turnhtm(sDetail);
return turnof(sDetail);
}
public String turnhtm(string sDetail)
{
Regex r;
Match m;
//////////[b][/b]
r = new Regex(@"(\[b\])([ \S\t]*?)(\[\/b\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<B>" + m.Groups[2].ToString() + "</B>");
}
//////////////////////转换笑脸///////////////////////////
r = new Regex(@"(\[face=)([0-9]*)\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<img src='"+theroot.foderpath()+"images/face/"+ m.Groups[2].ToString() +".gif'>");
}
r = new Regex(@"(\[i\])([ \S\t]*?)(\[\/i\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<I>" + m.Groups[2].ToString() + "</I>");
}
r = new Regex(@"(\[U\])([ \S\t]*?)(\[\/U\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<U>" + m.Groups[2].ToString() + "</U>");
}
//处[p][/p]标记
r = new Regex(@"((\r\n)*\[p\])(.+?)((\r\n)*\[\/p\])",RegexOptions.IgnoreCase|RegexOptions.Singleline);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<P class=\"pstyle\">" + m.Groups[3].ToString() + "</P>");
}
//处[quote][/quote]标记
r = new Regex(@"(\[quote\])([\s\S]+?)(\[\/quote\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"Quote:<br /><p class=\"qstyle\">" + m.Groups[2].ToString() + "</p>");
}
//处标记
r = new Regex(@"(\[url\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[2].ToString() + "</A>");
}
//处[url=xxx][/url]标记
r = new Regex(@"(\[url=([ \S\t]+)\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[3].ToString() + "</A>");
}
//处[email][/email]标记
r = new Regex(@"(\[email\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[2].ToString() + "</A>");
}
//处[down][/down]标记
r = new Regex(@"(\[down\])([ \S\t]*?)(\[\/down\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\"><img src=images/download.gif width=16 height=16 title='点击下载' border=0></A>");
}
//处[w][/w]标记
r = new Regex(@"(\[w\])([ \S\t]*?)(\[\/w\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<iframe src=\"" + m.Groups[2].ToString() + "\" frameborder='0' width='100%' height='300' style='border:1 solid #999999;margin-top:4px;margin-bottom:4px'></iframe><a href=\"" + m.Groups[2].ToString() + "\" title=\"在新窗口中浏览\" target=_blank>"+m.Groups[2]+"</A>");
}
//处[email=xxx][/email]标记
r = new Regex(@"(\[email=([ \S\t]+)\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[3].ToString() + "</A>");
}
//处[size=x][/size]标记
r = new Regex(@"(\[size=([1-7])\])([ \S\t]*?)(\[\/size\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT SIZE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
//处[color=x][/color]标记
r = new Regex(@"(\[color=([\S]+)\])([ \S\t]*?)(\[\/color\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT COLOR=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
//处[font=x][/font]标记
r = new Regex(@"(\[font=(\w+)\])([ \S\t]*?)(\[\/font\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT FACE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
//处理图片链接
r = new Regex(@"(\[img\])(.+?)(\[\/img\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
if(m.Groups[0].ToString().IndexOf("http://")>=0)
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<img src=\""+m.Groups[2].ToString()+"\" border=\"0\" class=\"imgborder\" onload=\"if(this.width>600) {this.width=600};\" ondblclick=\"window.open('"+m.Groups[2].ToString()+"')\" title=\"双击在新窗口中打开\" />");
}
else
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<img src=\""+theroot.foderpath()+"drawimg.aspx?f="+m.Groups[2].ToString()+"\" border=\"0\" class=\"imgborder\" onload=\"if(this.width>600) {this.width=600};\" ondblclick=\"window.open('"+m.Groups[2].ToString()+"')\" title=\"双击在新窗口中打开\" />");
}
}
//处理
r = new Regex(@"(\[align=(\w+)\])([ \S\t]*?)(\[\/align\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<P align=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</P>");
}
//处理[list=x][*][/list]
r = new Regex(@"(\[list(=(A|a|I|i| ))?\]([ \S\t]*)\r\n)((\[\*\]([ \S\t]*\r\n))*?)(\[\/list\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
string strLI = m.Groups[5].ToString();
Regex rLI = new Regex(@"\[\*\]([ \S\t]*\r\n?)",RegexOptions.IgnoreCase);
Match mLI;
for (mLI = rLI.Match(strLI); mLI.Success; mLI = mLI.NextMatch())
{
strLI = strLI.Replace(mLI.Groups[0].ToString(),"<LI>" + mLI.Groups[1]);
}
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<UL TYPE=\"" + m.Groups[3].ToString() + "\"><B>" + m.Groups[4].ToString() + "</B>" +
strLI + "</UL>");
}
r = new Regex(@"\[swf=([0-9]*),([0-9]*)\](.+?)\[\/swf\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"><param name=movie value='"+ m.Groups[3].ToString() +"'><param name=quality value=high><embed src='"+ m.Groups[3].ToString() +"' quality=high pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"></embed></object>");
}
r = new Regex(@"\[rm=([0-9]*),([0-9]*)\](.+?)\[\/rm\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"><PARAM NAME=SRC VALUE='"+ m.Groups[3].ToString() +"'><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=false><PARAM NAME=loop VALUE=true></OBJECT><br /><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width="+ m.Groups[1].ToString() +"><PARAM NAME=SRC VALUE='"+ m.Groups[3].ToString() +"'><PARAM NAME=AUTOSTART VALUE=false><PARAM NAME=loop VALUE=true><PARAM NAME=CONTROLS VALUE=controlpanel><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>");
}
r = new Regex(@"\[mp=([0-9]*),([0-9]*)\](.+?)\[\/mp\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' class='OBJECT' id=MediaPlayer width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +" ><param name=ShowStatusBar value=-1><PARAM NAME=AUTOSTART VALUE=false><param name=loop value=true><param name=Filename value='"+ m.Groups[3].ToString() +"'><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src='"+ m.Groups[2].ToString() +"' width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"></embed></object>");
}
/////////////处理链接
r = new Regex(@"([^>=""\?\'])((http|mms|rtsp|ftp|https):\/\/([A-Za-z0-9\.\/=\?%\-&_~`@':+!]+))",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),m.Groups[1]+"<a href='" + m.Groups[2].ToString() + "' target=_blank>" + m.Groups[2].ToString() + "</a>");
}
r = new Regex(@"(^|\s|<br />|<p>)((http|https|ftp|rtsp|mms)(:\/\/)([A-Za-z0-9\.\/=\?%\-&_~`@':+!]+))",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),m.Groups[1]+"<a href='" + m.Groups[2].ToString() + "' target=_blank>" + m.Groups[2].ToString() + "</a>");
}
return sDetail;
}
}
}
using System;
using System.Web;
using System.Web.UI;
using System.Text.RegularExpressions;
namespace STH.function
{
/// <summary>
/// UbbCode 的摘要说明。
/// </summary>
public class UbbCode
{
Root theroot=new Root();
HttpContext context = HttpContext.Current;
public UbbCode()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public String unhtml(string str)
{
str = context.Server.HtmlEncode(str);
str = str.Replace("&","&");
return str;
}
public String turnit(string str)
{
Regex r;
Match m;
str = str.Replace("[","[|");
str = str.Replace("]","|]");
r = new Regex(@"(http|mms|rtsp|ftp|https)(:\/\/)");
for (m = r.Match(str); m.Success; m = m.NextMatch())
{
str = str.Replace(m.Groups[0].ToString(), m.Groups[1].ToString() + "$"+m.Groups[2].ToString());
}
return str;
}
public String turnof(string str)
{
Regex r;
Match m;
str = str.Replace("[|","[");
str = str.Replace("|]","]");
r = new Regex(@"(http|mms|rtsp|ftp|https)(\$:\/\/)");
for (m = r.Match(str); m.Success; m = m.NextMatch())
{
str = str.Replace(m.Groups[0].ToString(), m.Groups[1].ToString() + m.Groups[2].ToString().Replace("$",""));
}
return str;
}
public String UBB(string sDetail)
{
Regex r;
Match m;
sDetail = sDetail.Replace("[swf]","[swf=300,250]");
sDetail = sDetail.Replace("[rm]","[rm=300,250]");
sDetail = sDetail.Replace("[mp]","[mp=300,250]");
sDetail = unhtml(sDetail);
sDetail = sDetail.Replace("\n","<br />");
//sDetail = sDetail.Replace(" "," ");
//[code]标签
r = new Regex(@"(\[code\])([\s\S]+?)(\[\/code\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<textarea style=\"border: 1px solid #94BBE2;width:98%;OVERFLOW: hidden;cursor:default;\" rows=\"15\" onclick=\"this.style.posHeight=this.scrollHeight\">" + turnit(m.Groups[2].ToString().Replace("<br />","\n")) + "</textarea>");
}
int i=1;
r = new Regex(@"(\[html\])([\s\S]+?)(\[\/html\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
i=i+1;
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<TEXTAREA rows=\"12\" style=\"width:98%\" id=\"rid"+i+"\">" + turnit(m.Groups[2].ToString().Replace("<br />","\n")) + "</TEXTAREA><INPUT onclick=\"runEx('rid"+i+"')\" type=button value=\"Have A Try\" class=\"input1\"> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行] ");
//sDetail = sDetail.Replace("<br />","");
}
sDetail=turnhtm(sDetail);
return turnof(sDetail);
}
public String turnhtm(string sDetail)
{
Regex r;
Match m;
//////////[b][/b]
r = new Regex(@"(\[b\])([ \S\t]*?)(\[\/b\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<B>" + m.Groups[2].ToString() + "</B>");
}
//////////////////////转换笑脸///////////////////////////
r = new Regex(@"(\[face=)([0-9]*)\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<img src='"+theroot.foderpath()+"images/face/"+ m.Groups[2].ToString() +".gif'>");
}
r = new Regex(@"(\[i\])([ \S\t]*?)(\[\/i\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<I>" + m.Groups[2].ToString() + "</I>");
}
r = new Regex(@"(\[U\])([ \S\t]*?)(\[\/U\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<U>" + m.Groups[2].ToString() + "</U>");
}
//处[p][/p]标记
r = new Regex(@"((\r\n)*\[p\])(.+?)((\r\n)*\[\/p\])",RegexOptions.IgnoreCase|RegexOptions.Singleline);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<P class=\"pstyle\">" + m.Groups[3].ToString() + "</P>");
}
//处[quote][/quote]标记
r = new Regex(@"(\[quote\])([\s\S]+?)(\[\/quote\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"Quote:<br /><p class=\"qstyle\">" + m.Groups[2].ToString() + "</p>");
}
//处标记
r = new Regex(@"(\[url\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[2].ToString() + "</A>");
}
//处[url=xxx][/url]标记
r = new Regex(@"(\[url=([ \S\t]+)\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[3].ToString() + "</A>");
}
//处[email][/email]标记
r = new Regex(@"(\[email\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[2].ToString() + "</A>");
}
//处[down][/down]标记
r = new Regex(@"(\[down\])([ \S\t]*?)(\[\/down\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\"><img src=images/download.gif width=16 height=16 title='点击下载' border=0></A>");
}
//处[w][/w]标记
r = new Regex(@"(\[w\])([ \S\t]*?)(\[\/w\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<iframe src=\"" + m.Groups[2].ToString() + "\" frameborder='0' width='100%' height='300' style='border:1 solid #999999;margin-top:4px;margin-bottom:4px'></iframe><a href=\"" + m.Groups[2].ToString() + "\" title=\"在新窗口中浏览\" target=_blank>"+m.Groups[2]+"</A>");
}
//处[email=xxx][/email]标记
r = new Regex(@"(\[email=([ \S\t]+)\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
m.Groups[3].ToString() + "</A>");
}
//处[size=x][/size]标记
r = new Regex(@"(\[size=([1-7])\])([ \S\t]*?)(\[\/size\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT SIZE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
//处[color=x][/color]标记
r = new Regex(@"(\[color=([\S]+)\])([ \S\t]*?)(\[\/color\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT COLOR=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
//处[font=x][/font]标记
r = new Regex(@"(\[font=(\w+)\])([ \S\t]*?)(\[\/font\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT FACE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
//处理图片链接
r = new Regex(@"(\[img\])(.+?)(\[\/img\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
if(m.Groups[0].ToString().IndexOf("http://")>=0)
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<img src=\""+m.Groups[2].ToString()+"\" border=\"0\" class=\"imgborder\" onload=\"if(this.width>600) {this.width=600};\" ondblclick=\"window.open('"+m.Groups[2].ToString()+"')\" title=\"双击在新窗口中打开\" />");
}
else
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<img src=\""+theroot.foderpath()+"drawimg.aspx?f="+m.Groups[2].ToString()+"\" border=\"0\" class=\"imgborder\" onload=\"if(this.width>600) {this.width=600};\" ondblclick=\"window.open('"+m.Groups[2].ToString()+"')\" title=\"双击在新窗口中打开\" />");
}
}
//处理
r = new Regex(@"(\[align=(\w+)\])([ \S\t]*?)(\[\/align\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<P align=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</P>");
}
//处理[list=x][*][/list]
r = new Regex(@"(\[list(=(A|a|I|i| ))?\]([ \S\t]*)\r\n)((\[\*\]([ \S\t]*\r\n))*?)(\[\/list\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
string strLI = m.Groups[5].ToString();
Regex rLI = new Regex(@"\[\*\]([ \S\t]*\r\n?)",RegexOptions.IgnoreCase);
Match mLI;
for (mLI = rLI.Match(strLI); mLI.Success; mLI = mLI.NextMatch())
{
strLI = strLI.Replace(mLI.Groups[0].ToString(),"<LI>" + mLI.Groups[1]);
}
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<UL TYPE=\"" + m.Groups[3].ToString() + "\"><B>" + m.Groups[4].ToString() + "</B>" +
strLI + "</UL>");
}
r = new Regex(@"\[swf=([0-9]*),([0-9]*)\](.+?)\[\/swf\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"><param name=movie value='"+ m.Groups[3].ToString() +"'><param name=quality value=high><embed src='"+ m.Groups[3].ToString() +"' quality=high pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"></embed></object>");
}
r = new Regex(@"\[rm=([0-9]*),([0-9]*)\](.+?)\[\/rm\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"><PARAM NAME=SRC VALUE='"+ m.Groups[3].ToString() +"'><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=false><PARAM NAME=loop VALUE=true></OBJECT><br /><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width="+ m.Groups[1].ToString() +"><PARAM NAME=SRC VALUE='"+ m.Groups[3].ToString() +"'><PARAM NAME=AUTOSTART VALUE=false><PARAM NAME=loop VALUE=true><PARAM NAME=CONTROLS VALUE=controlpanel><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>");
}
r = new Regex(@"\[mp=([0-9]*),([0-9]*)\](.+?)\[\/mp\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<object classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' class='OBJECT' id=MediaPlayer width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +" ><param name=ShowStatusBar value=-1><PARAM NAME=AUTOSTART VALUE=false><param name=loop value=true><param name=Filename value='"+ m.Groups[3].ToString() +"'><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src='"+ m.Groups[2].ToString() +"' width="+ m.Groups[1].ToString() +" height="+ m.Groups[2].ToString() +"></embed></object>");
}
/////////////处理链接
r = new Regex(@"([^>=""\?\'])((http|mms|rtsp|ftp|https):\/\/([A-Za-z0-9\.\/=\?%\-&_~`@':+!]+))",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),m.Groups[1]+"<a href='" + m.Groups[2].ToString() + "' target=_blank>" + m.Groups[2].ToString() + "</a>");
}
r = new Regex(@"(^|\s|<br />|<p>)((http|https|ftp|rtsp|mms)(:\/\/)([A-Za-z0-9\.\/=\?%\-&_~`@':+!]+))",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),m.Groups[1]+"<a href='" + m.Groups[2].ToString() + "' target=_blank>" + m.Groups[2].ToString() + "</a>");
}
return sDetail;
}
}
}
标签:
asp.net,c#,UBB
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年11月17日
2024年11月17日
- 中国武警男声合唱团《辉煌之声1天路》[DTS-WAV分轨]
- 紫薇《旧曲新韵》[320K/MP3][175.29MB]
- 紫薇《旧曲新韵》[FLAC/分轨][550.18MB]
- 周深《反深代词》[先听版][320K/MP3][72.71MB]
- 李佳薇.2024-会发光的【黑籁音乐】【FLAC分轨】
- 后弦.2012-很有爱【天浩盛世】【WAV+CUE】
- 林俊吉.2012-将你惜命命【美华】【WAV+CUE】
- 晓雅《分享》DTS-WAV
- 黑鸭子2008-飞歌[首版][WAV+CUE]
- 黄乙玲1989-水泼落地难收回[日本天龙版][WAV+CUE]
- 周深《反深代词》[先听版][FLAC/分轨][310.97MB]
- 姜育恒1984《什么时候·串起又散落》台湾复刻版[WAV+CUE][1G]
- 那英《如今》引进版[WAV+CUE][1G]
- 蔡幸娟.1991-真的让我爱你吗【飞碟】【WAV+CUE】
- 群星.2024-好团圆电视剧原声带【TME】【FLAC分轨】