www.pudn.com > UDS1.1_51aspx.rar > UBB.cs


using System; 
using System.Text.RegularExpressions; 
 
namespace UDS.Components 
{ 
	///  
	/// UBB 的摘要说明。 
	///  
	public class UBB 
	{ 
		private static string dvHTMLEncode(string fString) 
		{ 
			if(fString!=string.Empty) 
			{ 
				fString.Replace("<","<"); 
				fString.Replace(">","&rt;"); 
				fString.Replace(((char)34).ToString(), """); 
				fString.Replace(((char)39).ToString(), "'"); 
				fString.Replace(((char)13).ToString(), ""); 
				fString.Replace(((char)10).ToString(), "
"); } return(fString); } public static string txtMessage(string str) { str = dvHTMLEncode(str); if(str!="") { Regex my=new Regex(@"(\[IMG\])(.[^\[]*)(\[\/IMG\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"按此在新窗口浏览图片screen.width-333)this.width=screen.width-333"">"); my=new Regex(@"\[DIR=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/DIR]",RegexOptions.IgnoreCase); str=my.Replace(str,@""); my=new Regex(@"\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]",RegexOptions.IgnoreCase); str=my.Replace(str,@""); my=new Regex(@"\[MP=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/MP]",RegexOptions.IgnoreCase); str=my.Replace(str,@""); my=new Regex(@"\[RM=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/RM]",RegexOptions.IgnoreCase); str=my.Replace(str,@"
"); my=new Regex(@"(\[FLASH\])(.[^\[]*)(\[\/FLASH\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[ZIP\])(.[^\[]*)(\[\/ZIP\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
点击下载该文件"); my=new Regex(@"(\[RAR\])(.[^\[]*)(\[\/RAR\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
点击下载该文件"); my=new Regex(@"(\[UPLOAD=(.[^\[]*)\])(.[^\[]*)(\[\/UPLOAD\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
此主题相关图片如下:
按此在新窗口浏览图片screen.width-333)this.width=screen.width-333"">"); my= new Regex(@"(\[URL\])(http:\/\/.[^\[]*)(\[\/URL\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my= new Regex(@"(\[ATT\])(http:\/\/.[^\[]*)(\[\/ATT\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"上传文件:$2"); my=new Regex(@"(\[URL\])(.[^\[]*)(\[\/URL\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[URL=(http:\/\/.[^\[]*)\])(.[^\[]*)(\[\/URL\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$3"); my=new Regex(@"(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$3"); my=new Regex(@"(\[EMAIL\])(\S+\@.[^\[]*)(\[\/EMAIL\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"^(HTTP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str=my.Replace(str,@"$1"); my=new Regex(@"(HTTP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$",RegexOptions.IgnoreCase); str=my.Replace(str,@"$1"); my=new Regex(@"[^>=""](HTTP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my=new Regex(@"^(FTP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my= new Regex(@"(FTP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my=new Regex(@"[^>=""](FTP://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my= new Regex(@"^(RTSP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my= new Regex(@"(RTSP://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my=new Regex(@"[^>=""](RTSP://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my=new Regex(@"^(MMS://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my= new Regex(@"(MMS://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my=new Regex(@"[^>=""](MMS://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)",RegexOptions.IgnoreCase); str = my.Replace(str,@"$1"); my=new Regex(@"(\[HTML\])(.[^\[]*)(\[\/HTML\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
以下内容为程序代码:
$2
"); my=new Regex(@"(\[CODE\])(.[^\[]*)(\[\/CODE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
以下内容为程序代码:
$2
"); my=new Regex(@"(\[COLOR=(.[^\[]*)\])(.[^\[]*)(\[\/COLOR\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$3"); my=new Regex(@"(\[FACE=(.[^\[]*)\])(.[^\[]*)(\[\/FACE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$3"); my=new Regex(@"(\[ALIGN=(.[^\[]*)\])(.*)(\[\/ALIGN\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
$3
"); my=new Regex(@"(\[QUOTE\])(.*)(\[\/QUOTE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
$2

"); my=new Regex(@"(\[MOVE\])(.*)(\[\/MOVE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"\[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/GLOW]",RegexOptions.IgnoreCase); str=my.Replace(str,@"$4
"); my=new Regex(@"\[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/SHADOW]",RegexOptions.IgnoreCase); str=my.Replace(str,@"$4
"); my=new Regex(@"(\[I\])(.[^\[]*)(\[\/I\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[U\])(.[^\[]*)(\[\/U\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[B\])(.[^\[]*)(\[\/B\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[FLY\])(.[^\[]*)(\[\/FLY\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[SIZE=1\])(.[^\[]*)(\[\/SIZE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[SIZE=2\])(.[^\[]*)(\[\/SIZE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[SIZE=3\])(.[^\[]*)(\[\/SIZE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[SIZE=4\])(.[^\[]*)(\[\/SIZE\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"$2"); my=new Regex(@"(\[CENTER\])(.[^\[]*)(\[\/CENTER\])",RegexOptions.IgnoreCase); str=my.Replace(str,@"
$2
"); } return(str); } } }