using system;
using system.text;
using system.text.regularexpressions;
namespace myluntan
{
// <summary>
// ubb 的摘要说明。
// </summary>
public class ubb
{
public ubb()
{
}
公共静态方法#region 公共静态方法
// <summary>
// ubb代码处理函数
// </summary>
// <param name="sdetail">输入字符串</param>
// <returns>输出字符串</returns>
public string ubbtohtml(string sdetail)
{
regex r;
match m;
处理空格#region 处理空格
sdetail = sdetail.replace(" ", "!amp;nbsp;");
#endregion
处理单引号#region 处理单引号
sdetail = sdetail.replace("'", "!rsquo;");
#endregion
处理双引号#region 处理双引号
sdetail = sdetail.replace("\"", "!amp;quot;");
#endregion
html标记符#region html标记符
sdetail = sdetail.replace("<", "!amp;lt;");
sdetail = sdetail.replace(">", "!amp;gt;");
#endregion
处理换行#region 处理换行
//处理换行,在每个新行的前面添加两个全角空格
r = new regex(@"(\r\n((!amp;nbsp;)| )+)(@<正文>\s+)", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<br> " + m.groups["正文"].tostring());
}
//处理换行,在每个新行的前面添加两个全角空格
sdetail = sdetail.replace("\r\n", "<br>");
#endregion
处标记#region 处标记
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>");
}
#endregion
处标记#region 处标记
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>");
}
#endregion
处标记#region 处标记
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>");
}
#endregion
处[p][/p]标记#region 处[p][/p]标记
//处[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>");
}
#endregion
处标记#region 处标记
//处标记
r = new regex(@"(\[sup\])([ \s\t]*@)(\[\/sup\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<sup>" + m.groups[2].tostring() + "</sup>");
}
#endregion
处标记#region 处标记
//处标记
r = new regex(@"(\[sub\])([ \s\t]*@)(\[\/sub\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<sub>" + m.groups[2].tostring() + "</sub>");
}
#endregion
处[url][/url]标记#region 处[url][/url]标记
//处[url][/url]标记
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=/ddvipcom/\"" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[2].tostring() + "</a>");
}
#endregion
处[url=xxx][/url]标记#region 处[url=xxx][/url]标记
//处[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=/ddvipcom/\"" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[3].tostring() + "</a>");
}
#endregion
处 [/email]标记#region 处 [/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=/ddvipcom/\"mailto:" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[2].tostring() + "</a>");
}
#endregion
处[email=xxx][/email]标记#region 处[email=xxx][/email]标记
//处[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=/ddvipcom/\"mailto:" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[3].tostring() + "</a>");
}
#endregion
处[size=x][/size]标记#region 处[size=x][/size]标记
//处[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>");
}
#endregion
处[color=x][/color]标记#region 处[color=x][/color]标记
//处[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>");
}
#endregion
处标记#region 处标记
//处标记
r = new regex(@"(\[font=([\s]+)\])([ \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>");
}
#endregion
处理图片链接#region 处理图片链接
//处理图片链接
r = new regex("\\[picture\\](\\d+@)\\[\\/picture\\]", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<a href=/ddvipcom/\"showimage.aspx@type=all!amp;action=forumimage!amp;imageid=" + m.groups[1].tostring() +
"\" target=\"_blank\"><img border=0 title=\"点击打开新窗口查看\" src=http://www.ddvip.com/\"showimage.aspx@action=forumimage!amp;imageid=" + m.groups[1].tostring() +
"\"></a>");
}
#endregion
处理[align=x][/align]#region 处理[align=x][/align]
//处理[align=x][/align]
r = new regex(@"(\[align=([\s]+)\])([ \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>");
}
#endregion
处[h=x][/h]标记#region 处[h=x][/h]标记
//处[h=x][/h]标记
r = new regex(@"(\[h=([1-6])\])([ \s\t]*@)(\[\/h\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<h" + m.groups[2].tostring() + ">" +
m.groups[3].tostring() + "</h" + m.groups[2].tostring() + ">");
}
#endregion
处理#region 处理
//处理
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>");
}
#endregion
处[shadow=x][/shadow]标记#region 处[shadow=x][/shadow]标记
//处[shadow=x][/shadow]标记
r = new regex(@"(\[shadow=)(\d*@),(#*\w*@),(\d*@)\]([\s\t]*@)(\[\/shadow\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<table width=" + m.groups[2].tostring() + " style=filter:shadow(color=" + m.groups[3].tostring() + ", strength=" + m.groups[4].tostring() + ")>" +
m.groups[5].tostring() + "</table>");
}
#endregion
处[glow=x][/glow]标记#region 处[glow=x][/glow]标记
//处[glow=x][/glow]标记
r = new regex(@"(\[glow=)(\d*@),(#*\w*@),(\d*@)\]([\s\t]*@)(\[\/glow\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<table width=" + m.groups[2].tostring() + " style=filter:glow(color=" + m.groups[3].tostring() + ", strength=" + m.groups[4].tostring() + ")>" +
m.groups[5].tostring() + "</table>");
}
#endregion
处[center][/center]标记#region 处[center][/center]标记
r = new regex(@"(\[center\])([ \s\t]*@)(\[\/center\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<center>" + m.groups[2].tostring() + "</center>");
}
#endregion
处[img][/img]标记#region 处[img][/img]标记
r = new regex(@"(\[img\])(http|https|ftp):\/\/([ \s\t]*@)(\[\/img\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<br><a onfocus=this.blur() href=/ddvipcom/" + m.groups[2].tostring() + ":/" + m.groups[3].tostring() + " target=_blank><img src=http://www.ddvip.com/" + m.groups[2].tostring() + ":/" + m.groups[3].tostring() + " border=0 alt=按此在新窗口浏览图片 onload=javascript:if(screen.width-333<this.width)this.width=screen.width-333></a>");
}
#endregion
处[em]标记#region 处[em]标记
r = new regex(@"(\[em([\s\t]*@)\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<img src=http://www.ddvip.com/pic/em" + m.groups[2].tostring() + ".gif border=0 align=middle>");
}
#endregion
处[flash=x][/flash]标记#region 处[flash=x][/flash]标记
//处[mp=x][/mp]标记
r = new regex(@"(\[flash=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/flash\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<a href=/ddvipcom/" + m.groups[4].tostring() + " target=_blank><img src=http://www.ddvip.com/pic/swf.gif border=0 alt=点击开新窗口欣赏该flash动画!> [全屏欣赏]</a><br><br><object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "><param name=movie value=" + m.groups[4].tostring() + "><param name=quality value=high><param name=menu value=false><embed src=http://www.ddvip.com/" + m.groups[4].tostring() + " quality=high menu=false pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + ">" + m.groups[4].tostring() + "</embed></object>");
}
#endregion
处[dir=x][/dir]标记#region 处[dir=x][/dir]标记
//处[dir=x][/dir]标记
r = new regex(@"(\[dir=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/dir\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<object classid=clsid:166b1bca-3f9c-11cf-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "><param name=src value=" + m.groups[4].tostring() + "><embed src=http://www.ddvip.com/" + m.groups[4].tostring() + " pluginspage=http://www.macromedia.com/shockwave/download/ width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "></embed></object>");
}
#endregion
处[rm=x][/rm]标记#region 处[rm=x][/rm]标记
//处[rm=x][/rm]标记
r = new regex(@"(\[rm=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/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[2].tostring() + " height=" + m.groups[3].tostring() + "><param name=src value=" + m.groups[4].tostring() + "><param name=console value=clip1><param name=controls value=imagewindow><param name=autostart value=true></object><br><object classid=clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa height=32 id=video2 width=" + m.groups[2].tostring() + "><param name=src value=" + m.groups[4].tostring() + "><param name=autostart value=-1><param name=controls value=controlpanel><param name=console value=clip1></object>");
}
#endregion
处[mp=x][/mp]标记#region 处[mp=x][/mp]标记
//处[mp=x][/mp]标记
r = new regex(@"(\[mp=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/mp\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<object align=middle classid=clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=object id=mediaplayer width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + " ><param name=showstatusbar value=-1><param name=filename value=" + m.groups[4].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=http://www.ddvip.com/" + m.groups[4].tostring() + " width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "></embed></object>");
}
#endregion
处[qt=x][/qt]标记#region 处[qt=x][/qt]标记
//处[qt=x][/qt]标记
r = new regex(@"(\[qt=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/qt\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<embed src=http://www.ddvip.com/" + m.groups[4].tostring() + " width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + " autoplay=true loop=false controller=true playeveryframe=false cache=false scale=tofit bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>");
}
#endregion
处#region 处
//引用内容
//标记
r = new regex(@"(\[quote\])([ \s\t]*@)(\[\/quote\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<table cellpadding=0 cellspacing=0 border=1 width=94% bordercolor=#000000 bgcolor=#f2f8ff align=center style=font-size: 9pt><tr><td ><table width=100% cellpadding=5 cellspacing=1 border=0><tr><td >" + m.groups[2].tostring() + "</table></table><br>");
}
#endregion
处[move][/move]标记#region 处[move][/move]标记
r = new regex(@"(\[move\])([ \s\t]*@)(\[\/move\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<marquee scrollamount=3>" + m.groups[2].tostring() + "</marquee>");
}
#endregion
处标记#region 处标记
r = new regex(@"(\[fly\])([ \s\t]*@)(\[\/fly\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<marquee width=80% behavior=alternate scrollamount=3>" + m.groups[2].tostring() + "</marquee>");
}
#endregion
处[image][/image]标记#region 处[image][/image]标记
//处[image][/image]标记
r = new regex(@"(\[image\])([ \s\t]*@)(\[\/image\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<img src=http://www.ddvip.com/\"" + m.groups[2].tostring() + "\" border=0 align=middle><br>");
}
#endregion
return sdetail;
}
#endregion
}
}
using system.text;
using system.text.regularexpressions;
namespace myluntan
{
// <summary>
// ubb 的摘要说明。
// </summary>
public class ubb
{
public ubb()
{
}
公共静态方法#region 公共静态方法
// <summary>
// ubb代码处理函数
// </summary>
// <param name="sdetail">输入字符串</param>
// <returns>输出字符串</returns>
public string ubbtohtml(string sdetail)
{
regex r;
match m;
处理空格#region 处理空格
sdetail = sdetail.replace(" ", "!amp;nbsp;");
#endregion
处理单引号#region 处理单引号
sdetail = sdetail.replace("'", "!rsquo;");
#endregion
处理双引号#region 处理双引号
sdetail = sdetail.replace("\"", "!amp;quot;");
#endregion
html标记符#region html标记符
sdetail = sdetail.replace("<", "!amp;lt;");
sdetail = sdetail.replace(">", "!amp;gt;");
#endregion
处理换行#region 处理换行
//处理换行,在每个新行的前面添加两个全角空格
r = new regex(@"(\r\n((!amp;nbsp;)| )+)(@<正文>\s+)", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<br> " + m.groups["正文"].tostring());
}
//处理换行,在每个新行的前面添加两个全角空格
sdetail = sdetail.replace("\r\n", "<br>");
#endregion
处标记#region 处标记
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>");
}
#endregion
处标记#region 处标记
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>");
}
#endregion
处标记#region 处标记
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>");
}
#endregion
处[p][/p]标记#region 处[p][/p]标记
//处[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>");
}
#endregion
处标记#region 处标记
//处标记
r = new regex(@"(\[sup\])([ \s\t]*@)(\[\/sup\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<sup>" + m.groups[2].tostring() + "</sup>");
}
#endregion
处标记#region 处标记
//处标记
r = new regex(@"(\[sub\])([ \s\t]*@)(\[\/sub\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<sub>" + m.groups[2].tostring() + "</sub>");
}
#endregion
处[url][/url]标记#region 处[url][/url]标记
//处[url][/url]标记
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=/ddvipcom/\"" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[2].tostring() + "</a>");
}
#endregion
处[url=xxx][/url]标记#region 处[url=xxx][/url]标记
//处[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=/ddvipcom/\"" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[3].tostring() + "</a>");
}
#endregion
处 [/email]标记#region 处 [/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=/ddvipcom/\"mailto:" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[2].tostring() + "</a>");
}
#endregion
处[email=xxx][/email]标记#region 处[email=xxx][/email]标记
//处[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=/ddvipcom/\"mailto:" + m.groups[2].tostring() + "\" target=\"_blank\">" +
m.groups[3].tostring() + "</a>");
}
#endregion
处[size=x][/size]标记#region 处[size=x][/size]标记
//处[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>");
}
#endregion
处[color=x][/color]标记#region 处[color=x][/color]标记
//处[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>");
}
#endregion
处标记#region 处标记
//处标记
r = new regex(@"(\[font=([\s]+)\])([ \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>");
}
#endregion
处理图片链接#region 处理图片链接
//处理图片链接
r = new regex("\\[picture\\](\\d+@)\\[\\/picture\\]", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<a href=/ddvipcom/\"showimage.aspx@type=all!amp;action=forumimage!amp;imageid=" + m.groups[1].tostring() +
"\" target=\"_blank\"><img border=0 title=\"点击打开新窗口查看\" src=http://www.ddvip.com/\"showimage.aspx@action=forumimage!amp;imageid=" + m.groups[1].tostring() +
"\"></a>");
}
#endregion
处理[align=x][/align]#region 处理[align=x][/align]
//处理[align=x][/align]
r = new regex(@"(\[align=([\s]+)\])([ \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>");
}
#endregion
处[h=x][/h]标记#region 处[h=x][/h]标记
//处[h=x][/h]标记
r = new regex(@"(\[h=([1-6])\])([ \s\t]*@)(\[\/h\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<h" + m.groups[2].tostring() + ">" +
m.groups[3].tostring() + "</h" + m.groups[2].tostring() + ">");
}
#endregion
处理#region 处理
//处理
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>");
}
#endregion
处[shadow=x][/shadow]标记#region 处[shadow=x][/shadow]标记
//处[shadow=x][/shadow]标记
r = new regex(@"(\[shadow=)(\d*@),(#*\w*@),(\d*@)\]([\s\t]*@)(\[\/shadow\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<table width=" + m.groups[2].tostring() + " style=filter:shadow(color=" + m.groups[3].tostring() + ", strength=" + m.groups[4].tostring() + ")>" +
m.groups[5].tostring() + "</table>");
}
#endregion
处[glow=x][/glow]标记#region 处[glow=x][/glow]标记
//处[glow=x][/glow]标记
r = new regex(@"(\[glow=)(\d*@),(#*\w*@),(\d*@)\]([\s\t]*@)(\[\/glow\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<table width=" + m.groups[2].tostring() + " style=filter:glow(color=" + m.groups[3].tostring() + ", strength=" + m.groups[4].tostring() + ")>" +
m.groups[5].tostring() + "</table>");
}
#endregion
处[center][/center]标记#region 处[center][/center]标记
r = new regex(@"(\[center\])([ \s\t]*@)(\[\/center\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<center>" + m.groups[2].tostring() + "</center>");
}
#endregion
处[img][/img]标记#region 处[img][/img]标记
r = new regex(@"(\[img\])(http|https|ftp):\/\/([ \s\t]*@)(\[\/img\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<br><a onfocus=this.blur() href=/ddvipcom/" + m.groups[2].tostring() + ":/" + m.groups[3].tostring() + " target=_blank><img src=http://www.ddvip.com/" + m.groups[2].tostring() + ":/" + m.groups[3].tostring() + " border=0 alt=按此在新窗口浏览图片 onload=javascript:if(screen.width-333<this.width)this.width=screen.width-333></a>");
}
#endregion
处[em]标记#region 处[em]标记
r = new regex(@"(\[em([\s\t]*@)\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<img src=http://www.ddvip.com/pic/em" + m.groups[2].tostring() + ".gif border=0 align=middle>");
}
#endregion
处[flash=x][/flash]标记#region 处[flash=x][/flash]标记
//处[mp=x][/mp]标记
r = new regex(@"(\[flash=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/flash\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<a href=/ddvipcom/" + m.groups[4].tostring() + " target=_blank><img src=http://www.ddvip.com/pic/swf.gif border=0 alt=点击开新窗口欣赏该flash动画!> [全屏欣赏]</a><br><br><object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "><param name=movie value=" + m.groups[4].tostring() + "><param name=quality value=high><param name=menu value=false><embed src=http://www.ddvip.com/" + m.groups[4].tostring() + " quality=high menu=false pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + ">" + m.groups[4].tostring() + "</embed></object>");
}
#endregion
处[dir=x][/dir]标记#region 处[dir=x][/dir]标记
//处[dir=x][/dir]标记
r = new regex(@"(\[dir=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/dir\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<object classid=clsid:166b1bca-3f9c-11cf-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "><param name=src value=" + m.groups[4].tostring() + "><embed src=http://www.ddvip.com/" + m.groups[4].tostring() + " pluginspage=http://www.macromedia.com/shockwave/download/ width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "></embed></object>");
}
#endregion
处[rm=x][/rm]标记#region 处[rm=x][/rm]标记
//处[rm=x][/rm]标记
r = new regex(@"(\[rm=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/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[2].tostring() + " height=" + m.groups[3].tostring() + "><param name=src value=" + m.groups[4].tostring() + "><param name=console value=clip1><param name=controls value=imagewindow><param name=autostart value=true></object><br><object classid=clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa height=32 id=video2 width=" + m.groups[2].tostring() + "><param name=src value=" + m.groups[4].tostring() + "><param name=autostart value=-1><param name=controls value=controlpanel><param name=console value=clip1></object>");
}
#endregion
处[mp=x][/mp]标记#region 处[mp=x][/mp]标记
//处[mp=x][/mp]标记
r = new regex(@"(\[mp=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/mp\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<object align=middle classid=clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=object id=mediaplayer width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + " ><param name=showstatusbar value=-1><param name=filename value=" + m.groups[4].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=http://www.ddvip.com/" + m.groups[4].tostring() + " width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + "></embed></object>");
}
#endregion
处[qt=x][/qt]标记#region 处[qt=x][/qt]标记
//处[qt=x][/qt]标记
r = new regex(@"(\[qt=)(\d*@),(\d*@)\]([\s\t]*@)(\[\/qt\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<embed src=http://www.ddvip.com/" + m.groups[4].tostring() + " width=" + m.groups[2].tostring() + " height=" + m.groups[3].tostring() + " autoplay=true loop=false controller=true playeveryframe=false cache=false scale=tofit bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>");
}
#endregion
处#region 处
//引用内容
//标记
r = new regex(@"(\[quote\])([ \s\t]*@)(\[\/quote\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<table cellpadding=0 cellspacing=0 border=1 width=94% bordercolor=#000000 bgcolor=#f2f8ff align=center style=font-size: 9pt><tr><td ><table width=100% cellpadding=5 cellspacing=1 border=0><tr><td >" + m.groups[2].tostring() + "</table></table><br>");
}
#endregion
处[move][/move]标记#region 处[move][/move]标记
r = new regex(@"(\[move\])([ \s\t]*@)(\[\/move\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<marquee scrollamount=3>" + m.groups[2].tostring() + "</marquee>");
}
#endregion
处标记#region 处标记
r = new regex(@"(\[fly\])([ \s\t]*@)(\[\/fly\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(), "<marquee width=80% behavior=alternate scrollamount=3>" + m.groups[2].tostring() + "</marquee>");
}
#endregion
处[image][/image]标记#region 处[image][/image]标记
//处[image][/image]标记
r = new regex(@"(\[image\])([ \s\t]*@)(\[\/image\])", regexoptions.ignorecase);
for (m = r.match(sdetail); m.success; m = m.nextmatch())
{
sdetail = sdetail.replace(m.groups[0].tostring(),
"<img src=http://www.ddvip.com/\"" + m.groups[2].tostring() + "\" border=0 align=middle><br>");
}
#endregion
return sdetail;
}
#endregion
}
}