Web/UBB.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/**********************************************
 * 类作用:   UBB代码辅助类
 * 建立人:   abaal
 * 建立时间: 2008-09-03 
 * Copyright (C) 2007-2008 abaal
 * All rights reserved
 * http://blog.csdn.net/abaal888
 ***********************************************/

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace Svnhost.Common
{
    public class UBB
    {
        public static string UbbToHtml(string ubb)
        {
            if (ubb == null) return null;
            //ubb = HttpUtility.HtmlEncode(ubb);
            Regex rex = new Regex(@"(\[Quote=([\s\S]*)\])(.[^\[]*)(\[\/Quote\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<fieldset><legend>$2</legend>$3</fieldset>");


            rex = new Regex(@"(\[b\])(.[^\[]*)(\[\/b\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<strong>$2</strong>");

            rex = new Regex(@"(\[i\])(.[^\[]*)(\[\/i\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<i>$2</i>");

            rex = new Regex(@"(\[u\])(.[^\[]*)(\[\/u\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<u>$2</u>");

            rex = new Regex(@"(\[img\])(.[^\[]*)(\[\/img\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<a href=\"$2\" target=\"_blank\"><img src=\"$2\" width=\"16\" height=\"16\" alt=\"查看原图\" border=\"0\" /></a>");

            rex = new Regex(@"(\[url\])(.[^\[]*)(\[\/url\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<a href=\"$2\" target=\"_blank\">$2</a>");
            rex = new Regex(@"(\[url\=)(.*?)\](.[^\[]*)(\[\/url\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<a href=\"$2\" target=\"_blank\">$3</a>");

            rex = new Regex(@"(\[email\])(.[^\[]*)(\[\/email\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<a href=\"mailto:$2\">$2</a>");

            rex = new Regex(@"(\[quote\])(.[^\[]*)(\[\/quote\])", RegexOptions.IgnoreCase | RegexOptions.IgnoreCase);
            ubb = rex.Replace(ubb, "<fieldset><legend>引用内容</legend>$2</fieldset>");

            //心情图片(待实现)
            string[] img = { "[:)]", "[#_#]", "[8*)]", "[:D]", "[:-)]", "[:P]", "[B_)]", "[B_I]", "[^_*]", "[:$]", "[:|]", "[:(]", "[:.(]", "[:_(]", "[):(]", "[:V]", "[*_*]", "[:^]", "[:?]", "[:!]", "[=:|]", "[:%]", "[:O]", "[:X]", "[|-)]", "[:Z]", "[:9]", "[:T]", "[:-*]", "[*_/]", "[:#|]", "[:69]", "[//shuang]", "[//qiang]", "[//ku]", "[//zan]", "[//heart]", "[//break]", "[//F]", "[//W]", "[//mail]", "[//strong]", "[//weak]", "[//share]", "[//phone]", "[//mobile]", "[//kiss]", "[//V]", "[//sun]", "[//moon]", "[//star]", "[(!)]", "[//TV]", "[//clock]", "[//gift]", "[//cash]", "[//coffee]", "[//rice]", "[//watermelon]", "[//tomato]", "[//pill]", "[//pig]", "[//football]", "[//shit]" };
            for (int i = 0; i < img.Length; i++)
            {
                ubb = ubb.Replace(img[i], "<img src=\"/images/em/" + i.ToString() + ".gif\" />");
            }
            //if (ubb.Length > 980)
            //{
            //    ubb = ubb.Substring(0, 980);
            //    if (ubb.LastIndexOf(">") > 950)
            //    {
后面还有 7 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。