Public string Texttohtml (string chr)
{
If (chr = null)
Return "";
Chr = chr. Replace ("<", "& lt ");
Chr = chr. Replace (">", "& gt ");
Chr = chr. Replace ("", "<br/> ");
Chr = Regex. Replace (chr, @ "[url = (? <X> [^] *)] (? <Y> [^] *) [/url] ", @" <a href = $1 target = _ blank> $2 </a> ", RegexOptions. ignoreCase );
Chr = Regex. Replace (chr, @ "[url] (? <X> [^] *) [/url] ", @" <a href = $1 target = _ blank> $1 </a> ", RegexOptions. ignoreCase );
Chr = Regex. Replace (chr, @ "[email = (? <X> [^] *)] (? <Y> [^] *) [/email] ", @" <a href = $1> $2 </a> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[email] (? <X> [^] *) [/email] ", @" <a href = $1> $1 </a> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[flash] (? <X> [^] *) [/flash] ", @" <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 = "" $1 ""> <param name = quality VALUE = high> <embed src = "" $1" "quality = high pluginspage = http://www.macromedia.com/shockwave/download/index.cgi? P1_Prod_Version = ShockwaveFlash type = application/x-shockwave-flash width = 500 height = 400> $1 </embed> </OBJECT> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[img] (? <X> [^] *) [/img] ", @" ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[color = (? <X> [^] *)] (? <Y> [^] *) [/color] ", @" <font color = $1> $2 </font> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[face = (? <X> [^] *)] (? <Y> [^] *) [/face] ", @" <font face = $1> $2 </font> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[size = 1] (? <X> [^] *) [/size] ", @" <font size = 1> $1 </font> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[size = 2] (? <X> [^] *) [/size] ", @" <font size = 2> $1 </font> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[size = 3] (? <X> [^] *) [/size] ", @" <font size = 3> $1 </font> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[size = 4] (? <X> [^] *) [/size] ", @" <font size = 4> $1 </font> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[align = (? <X> [^] *)] (? <Y> [^] *) [/align] ", @" <align = $1> $2 </align> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[fly] (? <X> [^] *) [/fly] ", @" <marquee width = 90% behavior = alternate scrollamount = 3> $1 </marquee> ", RegexOptions. ignoreCase );
Chr = Regex. Replace (chr, @ "[move] (? <X> [^] *) [/move] ", @" <marquee scrollamount = 3> $1 </marquee> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[glow = (? <X> [^] *), (? <Y> [^] *), (? <Z> [^] *)] (? <W> [^] *) [/glow] ", @" <table width = $1 style = filter: glow (color = $2, strength = $3)> $4 </table> ", RegexOptions. ignoreCase );
Chr = Regex. Replace (chr, @ "[shadow = (? <X> [^] *), (? <Y> [^] *), (? <Z> [^] *)] (? <W> [^] *) [/shadow] ", @" <table width = $1 style = filter: shadow (color = $2, strength = $3)> $4 </table> ", RegexOptions. ignoreCase );
Chr = Regex. Replace (chr, @ "[B] (? <X> [^] *) [/B] ", @" <B> $1 </B> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[I] (? <X> [^] *) [/I] ", @" <I> $1 </I> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[u] (? <X> [^] *) [/u] ", @" <u> $1 </u> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[code] (? <X> [^] *) [/code] ", @" <pre id = code> <font size = 1 face = Verdana, arial id = code> $1 </font id = code> </pre id = code> ", RegexOptions. ignoreCase );
Chr = Regex. Replace (chr, @ "[list] (? <X> [^] *) [/list] ", @" <ul> $1 </ul> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[list = 1] (? <X> [^] *) [/list] ", @" <ol type = 1> $1 </ol id = 1> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[list = a] (? <X> [^] *) [/list] ", @" <ol type = a> $1 </ol id = a> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[*] (? <X> [^] *) [/*] ", @" <li> $1 </li> ", RegexOptions. IgnoreCase );
Chr = Regex. Replace (chr, @ "[quote] (? <X>. *) [/quote] ", @ "<center> -- reference -- <table border = 1 width = 80% cellpadding = 10 cellspacing = 0> <tr> <td> $1 </td> </tr> </table> </center> ", regexOptions. ignoreCase );
Return (chr );
}
Public string htmltoText (string chr)
{
If (chr = null)
Return "";
Chr = chr. Replace ("","");
Return (chr );
}