转载--完整的UBB代码(C#版)

在某论坛上看到用C#写的UBB代码,很值得收藏
None.gif using  System;
None.gif
using  System.Text;
None.gif
using  System.Text.RegularExpressions;
None.gif
None.gif
namespace  myluntan
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif
/**//// <summary>
InBlock.gif
/// UBB 的摘要说明。
ExpandedSubBlockEnd.gif
/// </summary>

InBlock.gifpublic class UBB
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif  
public UBB()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
//
InBlock.gif   
// TODO: 在此处添加构造函数逻辑
InBlock.gif   
//
ExpandedSubBlockEnd.gif
  }

InBlock.gif    
ContractedSubBlock.gifExpandedSubBlockStart.gif  
公共静态方法#region 公共静态方法
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// <summary>
InBlock.gif  
/// UBB代码处理函数
InBlock.gif  
/// </summary>
InBlock.gif  
/// <param name="sDetail">输入字符串</param>
ExpandedSubBlockEnd.gif  
/// <returns>输出字符串</returns>

InBlock.gif  public string UBBToHTML(string sDetail)
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   Regex r;
InBlock.gif   Match m;
ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理空格#region 处理空格
InBlock.gif   sDetail 
= sDetail.Replace(" ","&nbsp;");
ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理单引号#region 处理单引号
InBlock.gif   sDetail 
= sDetail.Replace("'","");
ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理双引号#region 处理双引号
InBlock.gif   sDetail 
= sDetail.Replace("\"","&quot;");
ExpandedSubBlockEnd.gif
   #endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
html标记符#region html标记符
InBlock.gif   sDetail 
= sDetail.Replace("<","&lt;");
InBlock.gif   sDetail 
= sDetail.Replace(">","&gt;");
InBlock.gif   
ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理换行#region 处理换行
InBlock.gif   
//处理换行,在每个新行的前面添加两个全角空格
InBlock.gif
   r = new Regex(@"(\r\n((&nbsp;)| )+)(?<正文>\S+)",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<BR>  " + m.Groups["正文"].ToString());
ExpandedSubBlockEnd.gif   }

InBlock.gif   
//处理换行,在每个新行的前面添加两个全角空格
InBlock.gif
   sDetail = sDetail.Replace("\r\n","<BR>");
ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[b][/b]标记#region 处[b][/b]标记
InBlock.gif   r 
= new Regex(@"(\[b\])([ \S\t]*?)(\[\/b\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<B>" + m.Groups[2].ToString() + "</B>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[i][/i]标记#region 处[i][/i]标记
InBlock.gif   r 
= new Regex(@"(\[i\])([ \S\t]*?)(\[\/i\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<I>" + m.Groups[2].ToString() + "</I>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[u][/u]标记#region 处[u][/u]标记
InBlock.gif   r 
= new Regex(@"(\[U\])([ \S\t]*?)(\[\/U\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<U>" + m.Groups[2].ToString() + "</U>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[p][/p]标记#region 处[p][/p]标记
InBlock.gif   
//处[p][/p]标记
InBlock.gif
   r = new Regex(@"((\r\n)*\[p\])(.*?)((\r\n)*\[\/p\])",RegexOptions.IgnoreCase|RegexOptions.Singleline);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<P class=\"pstyle\">" + m.Groups[3].ToString() + "</P>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[sup][/sup]标记#region 处[sup][/sup]标记
InBlock.gif   
//处[sup][/sup]标记
InBlock.gif
   r = new Regex(@"(\[sup\])([ \S\t]*?)(\[\/sup\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<SUP>" + m.Groups[2].ToString() + "</SUP>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[sub][/sub]标记#region 处[sub][/sub]标记
InBlock.gif   
//处[sub][/sub]标记
InBlock.gif
   r = new Regex(@"(\[sub\])([ \S\t]*?)(\[\/sub\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<SUB>" + m.Groups[2].ToString() + "</SUB>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[url][/url]标记#region 处[url][/url]标记
InBlock.gif   
//处[url][/url]标记
InBlock.gif
   r = new Regex(@"(\[url\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">"
InBlock.gif
+m.Groups[2].ToString() + "</A>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[url=xxx][/url]标记#region 处[url=xxx][/url]标记
InBlock.gif   
//处[url=xxx][/url]标记
InBlock.gif
   r = new Regex(@"(\[url=([ \S\t]+)\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" 
InBlock.gif
+ m.Groups[3].ToString() + "</A>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[email][/email]标记#region 处[email][/email]标记
InBlock.gif   
//处[email][/email]标记
InBlock.gif
   r = new Regex(@"(\[email\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
InBlock.gif     m.Groups[
2].ToString() + "</A>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[email=xxx][/email]标记#region 处[email=xxx][/email]标记
InBlock.gif   
//处[email=xxx][/email]标记
InBlock.gif
   r = new Regex(@"(\[email=([ \S\t]+)\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
InBlock.gif     m.Groups[
3].ToString() + "</A>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[size=x][/size]标记#region 处[size=x][/size]标记
InBlock.gif   
//处[size=x][/size]标记
InBlock.gif
   r = new Regex(@"(\[size=([1-7])\])([ \S\t]*?)(\[\/size\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<FONT SIZE=" + m.Groups[2].ToString() + ">" + 
InBlock.gif     m.Groups[
3].ToString() + "</FONT>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[color=x][/color]标记#region 处[color=x][/color]标记
InBlock.gif   
//处[color=x][/color]标记
InBlock.gif
   r = new Regex(@"(\[color=([\S]+)\])([ \S\t]*?)(\[\/color\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<FONT COLOR=" + m.Groups[2].ToString() + ">" + 
InBlock.gif     m.Groups[
3].ToString() + "</FONT>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[font=x][/font]标记#region 处[font=x][/font]标记
InBlock.gif   
//处[font=x][/font]标记
InBlock.gif
   r = new Regex(@"(\[font=([\S]+)\])([ \S\t]*?)(\[\/font\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<FONT FACE=" + m.Groups[2].ToString() + ">" + 
InBlock.gif     m.Groups[
3].ToString() + "</FONT>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理图片链接#region 处理图片链接
InBlock.gif   
//处理图片链接
InBlock.gif
   r = new Regex("\\[picture\\](\\d+?)\\[\\/picture\\]",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<A href=\"ShowImage.aspx?Type=ALL&Action=forumImage&ImageID=" 
InBlock.gif
+m.Groups[1].ToString() +
InBlock.gif     
"\" target=\"_blank\"><IMG border=0 Title=\"点击打开新窗口查看\" src=\"ShowImage.aspx?Action=forumImage&ImageID=" + m.Groups[1].ToString() +
InBlock.gif     
"\"></A>");
ExpandedSubBlockEnd.gif
   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理[align=x][/align]#region 处理[align=x][/align]
InBlock.gif   
//处理[align=x][/align]
InBlock.gif
   r = new Regex(@"(\[align=([\S]+)\])([ \S\t]*?)(\[\/align\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<P align=" + m.Groups[2].ToString() + ">" + 
InBlock.gif     m.Groups[
3].ToString() + "</P>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[H=x][/H]标记#region 处[H=x][/H]标记
InBlock.gif   
//处[H=x][/H]标记
InBlock.gif
   r = new Regex(@"(\[H=([1-6])\])([ \S\t]*?)(\[\/H\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<H" + m.Groups[2].ToString() + ">" + 
InBlock.gif     m.Groups[
3].ToString() + "</H" + m.Groups[2].ToString() + ">");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处理[list=x][*][/list]#region 处理[list=x][*][/list]
InBlock.gif   
//处理[list=x][*][/list]
InBlock.gif
   r = new Regex(@"(\[list(=(A|a|I|i| ))?\]([ \S\t]*)\r\n)((\[\*\]([ \S\t]*\r\n))*?)(\[\/list\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    
string strLI = m.Groups[5].ToString();
InBlock.gif    Regex rLI 
= new Regex(@"\[\*\]([ \S\t]*\r\n?)",RegexOptions.IgnoreCase);
InBlock.gif    Match mLI;
InBlock.gif    
for (mLI = rLI.Match(strLI); mLI.Success; mLI = mLI.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif     strLI 
= strLI.Replace(mLI.Groups[0].ToString(),"<LI>" + mLI.Groups[1]);
ExpandedSubBlockEnd.gif    }

InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<UL TYPE=\"" + m.Groups[3].ToString() + "\"><B>" + m.Groups[4].ToString() + "</B>" + 
InBlock.gif     strLI 
+ "</UL>");
ExpandedSubBlockEnd.gif   }

InBlock.gif
ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[SHADOW=x][/SHADOW]标记#region 处[SHADOW=x][/SHADOW]标记
InBlock.gif   
//处[SHADOW=x][/SHADOW]标记
InBlock.gif
   r = new Regex(@"(\[SHADOW=)(\d*?),(#*\w*?),(\d*?)\]([\S\t]*?)(\[\/SHADOW\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<TABLE WIDTH=" + m.Groups[2].ToString() + "  
InBlock.gif
STYLE=FILTER:SHADOW(COLOR=" + m.Groups[3].ToString() + "
InBlock.gifSTRENGTH
=" + m.Groups[4].ToString() + ")>" + 
InBlock.gif
     m.Groups[5].ToString() + "</TABLE>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[glow=x][/glow]标记#region 处[glow=x][/glow]标记
InBlock.gif   
//处[glow=x][/glow]标记
InBlock.gif
   r = new Regex(@"(\[glow=)(\d*?),(#*\w*?),(\d*?)\]([\S\t]*?)(\[\/glow\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<TABLE WIDTH=" + m.Groups[2].ToString() + "  STYLE=FILTER:GLOW(COLOR=" + m.Groups[3].ToString() + ", STRENGTH=" + m.Groups[4].ToString() + ")>" + 
InBlock.gif     m.Groups[
5].ToString() + "</TABLE>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[center][/center]标记#region 处[center][/center]标记
InBlock.gif   r 
= new Regex(@"(\[center\])([ \S\t]*?)(\[\/center\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<CENTER>" + m.Groups[2].ToString() + "</CENTER>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[IMG][/IMG]标记#region 处[IMG][/IMG]标记
InBlock.gif   r 
= new Regex(@"(\[IMG\])(http|https|ftp):\/\/([ \S\t]*?)(\[\/IMG\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<br><a οnfοcus=this.blur() href=" + m.Groups[2].ToString() + "://" + m.Groups[3].ToString() + " target=_blank><IMG SRC=" + m.Groups[2].ToString() + "://" + m.Groups[3].ToString() + " border=0 alt=按此在新窗口浏览图片 οnlοad=javascript:if(screen.width-333<this.width)this.width=screen.width-333></a>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[em]标记#region 处[em]标记
InBlock.gif   r 
= new Regex(@"(\[em([\S\t]*?)\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<img src=pic/em" + m.Groups[2].ToString() + ".gif border=0 align=middle>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[flash=x][/flash]标记#region 处[flash=x][/flash]标记
InBlock.gif   
//处[mp=x][/mp]标记
InBlock.gif
   r = new Regex(@"(\[flash=)(\d*?),(\d*?)\]([\S\t]*?)(\[\/flash\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<a href=" + m.Groups[4].ToString() + " TARGET=_blank><IMG SRC=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=" + 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>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[dir=x][/dir]标记#region 处[dir=x][/dir]标记
InBlock.gif   
//处[dir=x][/dir]标记
InBlock.gif
   r = new Regex(@"(\[dir=)(\d*?),(\d*?)\]([\S\t]*?)(\[\/dir\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<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=" + m.Groups[4].ToString() + " pluginspage=http://www.macromedia.com/shockwave/download/ width=" + m.Groups[2].ToString() + " height=" + m.Groups[3].ToString() + "></embed></object>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[rm=x][/rm]标记#region 处[rm=x][/rm]标记
InBlock.gif   
//处[rm=x][/rm]标记
InBlock.gif
   r = new Regex(@"(\[rm=)(\d*?),(\d*?)\]([\S\t]*?)(\[\/rm\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<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>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[mp=x][/mp]标记#region 处[mp=x][/mp]标记
InBlock.gif   
//处[mp=x][/mp]标记
InBlock.gif
   r = new Regex(@"(\[mp=)(\d*?),(\d*?)\]([\S\t]*?)(\[\/mp\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<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=" + m.Groups[4].ToString() + "  width=" + m.Groups[2].ToString() + " height=" + m.Groups[3].ToString() + "></embed></object>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[qt=x][/qt]标记#region 处[qt=x][/qt]标记
InBlock.gif   
//处[qt=x][/qt]标记
InBlock.gif
   r = new Regex(@"(\[qt=)(\d*?),(\d*?)\]([\S\t]*?)(\[\/qt\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<embed src=" + 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/>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[QUOTE][/QUOTE]标记#region 处[QUOTE][/QUOTE]标记
InBlock.gif   r 
= new Regex(@"(\[QUOTE\])([ \S\t]*?)(\[\/QUOTE\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    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>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[move][/move]标记#region 处[move][/move]标记
InBlock.gif   r 
= new Regex(@"(\[move\])([ \S\t]*?)(\[\/move\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<MARQUEE scrollamount=3>" + m.Groups[2].ToString() + "</MARQUEE>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[FLY][/FLY]标记#region 处[FLY][/FLY]标记
InBlock.gif   r 
= new Regex(@"(\[FLY\])([ \S\t]*?)(\[\/FLY\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),"<MARQUEE width=80% behavior=alternate scrollamount=3>" + m.Groups[2].ToString() + "</MARQUEE>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif   
处[image][/image]标记#region 处[image][/image]标记
InBlock.gif   
//处[image][/image]标记
InBlock.gif
   r = new Regex(@"(\[image\])([ \S\t]*?)(\[\/image\])",RegexOptions.IgnoreCase);
InBlock.gif   
for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    sDetail 
= sDetail.Replace(m.Groups[0].ToString(),
InBlock.gif     
"<img src=\"" + m.Groups[2].ToString() + "\" border=0 align=middle><br>");
ExpandedSubBlockEnd.gif   }

ExpandedSubBlockEnd.gif   
#endregion

InBlock.gif
InBlock.gif   
return sDetail;
ExpandedSubBlockEnd.gif  }

ExpandedSubBlockEnd.gif  
#endregion

ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif}

转载于:https://www.cnblogs.com/ioleon13/archive/2006/06/09/421728.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值