A ubb class implemented by. net

Source: Internet
Author: User

Using system;
Using system. Text. regularexpressions;

Namespace UBB. Components
{
/// <Summary>
/// Summary of UBB.
/// </Summary>
Public class UBB
{
Private Static string dvhtmlencode (string fstring)
{
If (fstring! = String. Empty)
{
Fstring. Replace ("<", "& lt ;");
Fstring. Replace (">", "& RT ;");
Fstring. Replace (char) 34). tostring (), "& quot ;");
Fstring. Replace (char) 39). tostring (),"'");
Fstring. Replace (char) 13). tostring (),"");
Fstring. Replace (char) 10). tostring (), "<br> ");

}
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, @ "<a href =" "$2" "target = _ blank> screen. width-333) This. width = screen. width-333 ""> </a> ");

My = new RegEx (@ "\ [dir = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/DIR] ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<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 = $1 Height = $2> <Param name = SRC value =3 3> <embed src = "/$3" pluginspage = http://www.macromedia.com/shockwave/download/ width = $1 height = $2> </embed> </Object> ");

My = new RegEx (@ "\ [Qt = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/Qt] ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<embed src ="/$3 "width = $1 Height = $2 autoplay = true loop = false controller = true playeveryframe = false cache = false scale = tofit bgcolor = #000000 kioskmode = false targetcache = false pluginspage = http://www.apple.com/quicktime/> ");

My = new RegEx (@ "\ [MP = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/MP] ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<object align = middle classid = CLSID: 22d6f312-b0f6-11d0-94ab-0080c74c7e95 class = Object ID = mediaplayer width = $1 Height = $2> <Param name = showstatusbar value =-1> <Param name = filename value = $3> <embed type application/X-oleobject codebase = http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename = Mp src = "/$3 "; width = $1 Height = $2> </embed> </Object> ");

My = new RegEx (@ "\ [Rm = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/RM] ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<object classid = CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class = Object ID = raocx width = $1 Height = $2> <Param name = SRC value = $3> <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 = $1> <Param name = SRC value = $3> <Param name = autostart value =-1> <Param name = controls value = controlpanel> <Param name = console value = clip1> </Object> ");

My = new RegEx (@ "(\ [Flash \]) (. [^ \ [] *) (\ [\/Flash \])", regexoptions. ignorecase );
STR = My. replace (STR, @ "<object codebase = http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid = CLSID: d27CDB6E-AE6D-11cf-96B8-444553540000 width = 500 Height = 400> <Param name = movie value = "" $2 ""> <Param name = Quality value = high> <embed src = "" $2" "Quality = high pluginspage = 'HTTP: // www.macromedia.com/shockwave/download/index.cgi? P1_prod_version = shockwaveflash 'Type = 'application/X-Shockwave-flash' width = 500 Height = 400 >2 2 </embed> </Object> ");

My = new RegEx (@ "(\ [Zip \]) (. [^ \ [] *) (\ [\/zip \])", regexoptions. ignorecase );
STR = My. replace (STR, @ "<br/> <a href =" "$2" "> click to download this file </a> ");

My = new RegEx (@ "(\ [RAR \]) (. [^ \ [] *) (\ [\/RAR \])", regexoptions. ignorecase );
STR = My. replace (STR, @ "<br/> <a href =" "$2" "> click to download this file </a> ");

My = new RegEx (@ "(\ [upload = (. [^ \ [] *) \]) (. [^ \ [] *) (\ [\/upload \]) ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<br/> the image of this topic is as follows: <br/> <a href = "" $3 "" target = _ blank> screen. width-333) This. width = screen. width-333 ""> </a> ");

My = new RegEx (@ "(\ [url \]) (http :\/\/. [^ \ [] *) (\ [\/URL \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a href =" "$2" "target = _ blank> $2 </a> ");

My = new RegEx (@ "(\ [ATT \]) (http :\/\/. [^ \ [] *) (\ [\/att \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "Upload File: <a href =" "$2" "target = _ blank >2 2 </a> ");

My = new RegEx (@ "(\ [url \]) (. [^ \ [] *) (\ [\/URL \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a href =" "http: // $2" "target = _ blank> $2 </a> ");

My = new RegEx (@ "(\ [url = (http :\/\/. [^ \ [] *) \]) (. [^ \ [] *) (\ [\/URL \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a href =" "$2" "target = _ blank> $3 </a> ");

My = new RegEx (@ "(\ [url = (. [^ \ [] *) \]) (. [^ \ [] *) (\ [\/URL \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a href =" "http: // $2" "target = _ blank >3 3 </a> ");

My = new RegEx (@ "(\ [email \]) (\ s ++ \@. [^ \ [] *) (\ [\/Email \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a href =" "mailto: $2" ">2 2 </a> ");

My = new RegEx (@ "^ (http: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "(http: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) $ ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "[^> =" "] (http: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "^ (ftp: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "(ftp: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) $ ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "[^> =" "] (ftp: // [A-Za-z0-9 \. \/= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "^ (RTSP: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "(RTSP: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) $ ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "[^> =" "] (RTSP: // [A-Za-z0-9 \. \/= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "^ (MMS: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "(MMS: // [A-Za-z0-9 \./= \? % \-&_~ '@': +!] +) $ ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "[^> =" "] (MMS: // [A-Za-z0-9 \. \/= \? % \-&_~ '@': +!] +) ", Regexoptions. ignorecase );
STR = My. Replace (STR, @ "<a target = _ blank href ="/$1> "; $1 </a> ");

My = new RegEx (@ "(\ [HTML \]) (. [^ \ [] *) (\ [\/html \])", regexoptions. ignorecase );
STR = My. replace (STR, @ "<Table width = '000000' border = '0' cellspacing = '0' cellpadding = '6' bgcolor =''> <TD> <B> the following content is the program code.: </B> <br/> $2 </TD> </table> ");

My = new RegEx (@ "(\ [Code \]) (. [^ \ [] *) (\ [\/Code \])", regexoptions. ignorecase );
STR = My. replace (STR, @ "<Table width = '000000' border = '0' cellspacing = '0' cellpadding = '6' bgcolor =''> <TD> <B> the following content is the program code.: </B> <br/> $2 </TD> </table> ");

My = new RegEx (@ "(\ [color = (. [^ \ [] *) \]) (. [^ \ [] *) (\ [\/color \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<font color = $2> $3 </font> ");

My = new RegEx (@ "(\ [face = (. [^ \ [] *) \]) (. [^ \ [] *) (\ [\/face \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<font face = $2> $3 </font> ");

My = new RegEx (@ "(\ [align = (. [^ \ [] *) \]) (. *) (\ [\/align \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<Div align = $2> $3 </div> ");

My = new RegEx (@ "(\ [quote \]) (. *) (\ [\/quote \])", regexoptions. ignorecase );
STR = My. replace (STR, @ "<Table cellpadding = 0 cellspacing = 0 border = 0 width = 94% bgcolor = #66 CCCC align = center> <tr> <TD> <Table width = 100% cellpadding = 5 cellspacing = 1 border = 1> <tr> <TD bgcolor = ''> $2 </table> <br/> ");

My = new RegEx (@ "(\ [move \]) (. *) (\ [\/move \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<marquee scrollamount = 3> $2 </marquee> ");

My = new RegEx (@ "\ [glow = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/glow] ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<Table width = $1 style =" "filter: glow (color = $2, strength = $3) ""> $4 </table> ");

My = new RegEx (@ "\ [shadow = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/shadow] ", regexoptions. ignorecase );
STR = My. replace (STR, @ "<Table width = $1 style =" "filter: Shadow (color = $2, strength = $3) ""> $4 </table> ");

My = new RegEx (@ "(\ [I \]) (. [^ \ [] *) (\ [\/I \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<I >2 2 </I> ");

My = new RegEx (@ "(\ [U \]) (. [^ \ [] *) (\ [\/U \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<u >2 2 </u> ");

My = new RegEx (@ "(\ [B \]) (. [^ \ [] *) (\ [\/B \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<B >2 2 </B> ");

My = new RegEx (@ "(\ [fly \]) (. [^ \ [] *) (\ [\/fly \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<marquee> $2 </marquee> ");

My = new RegEx (@ "(\ [size = 1 \]) (. [^ \ [] *) (\ [\/size \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<font size = 1> $2 </font> ");

My = new RegEx (@ "(\ [size = 2 \]) (. [^ \ [] *) (\ [\/size \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<font size = 2> $2 </font> ");

My = new RegEx (@ "(\ [size = 3 \]) (. [^ \ [] *) (\ [\/size \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<font size = 3> $2 </font> ");

My = new RegEx (@ "(\ [size = 4 \]) (. [^ \ [] *) (\ [\/size \]) ", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<font size = 4> $2 </font> ");

My = new RegEx (@ "(\ [center \]) (. [^ \ [] *) (\ [\/center \])", regexoptions. ignorecase );
STR = My. Replace (STR, @ "<center >2 2 </center> ");

}
Return (STR );

}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.