⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendmsg.aspx.cs

📁 校友录的总体功能分为三个子功能模块:管理功能模块,用户注册功能模块,用户个性化服务
💻 CS
📖 第 1 页 / 共 3 页
字号:

        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='100%' border='0' cellspacing='0' cellpadding='6' bgcolor=''><td><b>以下内容为程序代码:</b><br>$2</td></table>");

        my = new Regex(@"(\[CODE\])(.[^\[]*)(\[\/CODE\])", RegexOptions.IgnoreCase);
        str = my.Replace(str, @"<table width='100%' border='0' cellspacing='0' cellpadding='6' bgcolor=''><td><b>以下内容为程序代码:</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=#000000 align=center><tr><td><table width=100% cellpadding=5 cellspacing=1 border=0><TR><TD BGCOLOR=''>$2</table></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</i>");

        my = new Regex(@"(\[B\])(.[^\[]*)(\[\/U\])", RegexOptions.IgnoreCase);
        str = my.Replace(str, @"<u>$2</u>");

        my = new Regex(@"(\[B\])(.[^\[]*)(\[\/B\])", RegexOptions.IgnoreCase);
        str = my.Replace(str, @"<b>$2</b>");
        my = new Regex(@"(\[U\])(.[^\[]*)(\[\/U\])", RegexOptions.IgnoreCase);
        str = my.Replace(str, @"<u>$2</u>");

        my = new Regex(@"(\[FLY\])(.[^\[]*)(\[\/FLY\])", RegexOptions.IgnoreCase);
        str = my.Replace(str, @"<marquee onmouseover='this.stop();' onmouseout='this.start();'>$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</center>");

        //   r = new Regex(@"(\r\n((&nbsp;)| )+)(?<正文> +)", RegexOptions.IgnoreCase);

        ////处[size=x][/size]标记
        //my = new Regex(@"(\[SIZE=([1-7])\])([ \t]*?)(\[\/SIZE\])", RegexOptions.IgnoreCase);
        //for (m = r.Match(str); m.Success; m = m.NextMatch())
        //{
        //    str = str.Replace(m.Groups[0].ToString(),
        //     "<FONT SIZE=" + m.Groups[2].ToString() + ">" +
        //     m.Groups[3].ToString() + "</FONT>");
        //}








        return str;
    }



    public static string TransStringTool(string aTransString)
    {
        string returnString = "";
        aTransString = aTransString.Replace("&", "&amp;");
        aTransString = aTransString.Replace("<", "&lt;");
        aTransString = aTransString.Replace(">", "&gt;");
        aTransString = aTransString.Replace(" ", "&nbsp;");//空格
        aTransString = aTransString.Replace("\n", "<br>");//回车

        returnString = aTransString;
        return returnString;

    }

    
    /// <summary>
    /// UBB代码处理函数
    /// </summary>
    /// <param name="sDetail">输入字符串</param>
    /// <returns>输出字符串</returns>
    public string UBBToHTML(string sDetail)
    {
        Regex r;
        Match m;
        
      //#region 处理空格
      //  sDetail = sDetail.Replace(" ", "&nbsp;");
      //  #endregion
        #region 处理单引号
        sDetail = sDetail.Replace("'", "’");
        #endregion
        #region 处理双引号
        sDetail = sDetail.Replace("\"", "&quot;");
        #endregion
        #region html标记符
        sDetail = sDetail.Replace("<", "&lt;");
        sDetail = sDetail.Replace(">", "&gt;");
         #endregion
      

        

   //     处理换行,在每个新行的前面添加两个全角空格
        r = new Regex(@"(\r\n((&nbsp;)| )+)(?<正文> +)", RegexOptions.IgnoreCase);
    
        #region 处理换行
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(), "<BR>  " + m.Groups["正文"].ToString());
        }
     //   处理换行,在每个新行的前面添加两个全角空格
        sDetail = sDetail.Replace("\r\n", "<BR>");
        #endregion
        #region 处[b][/b]标记
         r = new Regex(@"(\[B\])([^\t]*?)(\[\/B\])",RegexOptions.IgnoreCase);
         for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
         {
          sDetail = sDetail.Replace(m.Groups[0].ToString(),"<b>" + m.Groups[2].ToString() + "</b>");
         }
        #endregion
        #region 处[i][/i]标记
         r = new Regex(@"(\[I\])([^\t]*?)(\[\/I\])",RegexOptions.IgnoreCase);
         for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
         {
          sDetail = sDetail.Replace(m.Groups[0].ToString(),"<i>" + m.Groups[2].ToString() + "</i>");
         }
  
        #endregion
        #region 处[u][/u]标记
         r = new Regex(@"(\[U\])([^\t]*?)(\[\/U\])",RegexOptions.IgnoreCase);
         for (m = r.Match(sDetail); m.Success; m = m.NextMatch()) 
         {
          sDetail = sDetail.Replace(m.Groups[0].ToString(),"<u>" + m.Groups[2].ToString() + "</u>");
         }
        #endregion
        #region 处[p][/p]标记
     //   处[p][/p]标记
        r = new Regex(@"((\r\n)*\[p\])(.*?)((\r\n)*\[\/p\])", RegexOptions.IgnoreCase | RegexOptions.Singleline);
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(), "<P class=\"pstyle\">" + m.Groups[3].ToString() + "</P>");
        }
        #endregion
        #region 处[sup][/sup]标记
     //   处[sup][/sup]标记
        r = new Regex(@"(\[sup\])([ \t]*?)(\[\/sup\])", RegexOptions.IgnoreCase);
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(), "<SUP>" + m.Groups[2].ToString() + "</SUP>");
        }
        #endregion
        #region 处[sub][/sub]标记
      ///  处[sub][/sub]标记
        r = new Regex(@"(\[sub\])([ \t]*?)(\[\/sub\])", RegexOptions.IgnoreCase);
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(), "<SUB>" + m.Groups[2].ToString() + "</SUB>");
        }
        #endregion
        ///////////////////////////////////////////////////////////////
        //#region 处[url][/url]标记
        ///// 处[url][/url]标记
        ////处[url][/url]标记
        //r = new Regex(@"(\[URL\])([^\t]*?)(\[\/URL\])", RegexOptions.IgnoreCase);
        //for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        //{
        //    sDetail = sDetail.Replace(m.Groups[0].ToString(),
        //     "<a href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
        //     m.Groups[2].ToString() + "</a>");
        //}
        //#endregion
        //#region 处[url=xxx][/url]标记
        ////  处[url=xxx][/url]标记
        ////处[url=xxx][/url]标记
        //r = new Regex(@"(\[URL=([^\t]+)\])([^\t]*?)(\[\/URL\])", RegexOptions.IgnoreCase);
        //for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        //{
        //    sDetail = sDetail.Replace(m.Groups[0].ToString(),
        //     "<a href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
        //     m.Groups[3].ToString() + "</a>");
        //}

        //#endregion
        //////////////////////////////////////////////////
        r = new Regex(@"(\[URL\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        sDetail = r.Replace(sDetail, @"<A HREF=""http://$2"" TARGET=_blank>$2</A>");

        r = new Regex(@"(\[URL=(http:\/\/.[^\[]*)\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        sDetail = r.Replace(sDetail, @"<A HREF=""$2"" TARGET=_blank>$3</A>");

        r = new Regex(@"(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        sDetail = r.Replace(sDetail, @"<A HREF=""http://$2"" TARGET=_blank>$3</A>");
        //////////////////////////////////////////////
        //r= new Regex(@"(\[URL\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        //sDetail = r.Replace(sDetail, @"<A HREF=""http://$2"" TARGET=_blank>$2</A>");
        //r = new Regex(@"(\[URL=(http:\/\/.[^\[]*)\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        //sDetail = r.Replace(sDetail, @"<A HREF=""$2"" TARGET=_blank>$3</A>");
        //r = new Regex(@"(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        //sDetail = r.Replace(sDetail, @"<A HREF=""http://$2"" TARGET=_blank>$3</A>"); 
        //////////////////////////////////////////////////////

        //r = new Regex(@"(\[URL\])(http:\/\/.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        //sDetail = r.Replace(sDetail, @"<A HREF=""$2"" TARGET=_blank>$2</A>");

        //r = new Regex(@"(\[URL\])(.[^\[]*)(\[\/URL\])", RegexOptions.IgnoreCase);
        //sDetail = r.Replace(sDetail, @"<A HREF=""http://$2"" TARGET=_blank>$2</A>");
        #region 处[email][/email]标记
     //   处[email][/email]标记
        r = new Regex(@"(\[email\])([ \t]*?)(\[\/email\])", RegexOptions.IgnoreCase);
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(),
             "<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
             m.Groups[2].ToString() + "</A>");
        }
        #endregion
        #region 处[email=xxx][/email]标记
      //  处[email=xxx][/email]标记
        r = new Regex(@"(\[email=([ \t]+)\])([ \t]*?)(\[\/email\])", RegexOptions.IgnoreCase);
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(),
             "<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\">" +
             m.Groups[3].ToString() + "</A>");
        }
        #endregion
        #region 处[size=x][/size]标记
        // 处[size=x][/size]标记
        r = new Regex(@"(\[SIZE=([1-7])\])([ \S\t]*?)(\[\/SIZE\])", RegexOptions.IgnoreCase);
        //@"(\[SIZE=([1-7])\])([^\t]*?)(\[\/SIZE\])"
        //@"(\[SIZE=([1-7])\])([ \S\t]*?)(\[\/SIZE\])"
        //@"(\[SIZE=4\])(.[^\[]*)(\[\/SIZE\])"
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(),
             "<FONT SIZE=" + m.Groups[2].ToString() + ">" +
             m.Groups[3].ToString() + "</FONT>");
        }
        #endregion
        #region 处[color=x][/color]标记
        /// 处[color=x][/color]标记  (,
        r = new Regex(@"(\[COLOR=([\S]+)\])([ \S\t]*?)(\[\/COLOR\])", RegexOptions.IgnoreCase);
        //@"(\[COLOR=([ ]+)\])([^\t]*?)(\[\/COLOR\])"
        //@"(\[COLOR=([\S]+)\])([ \S\t]*?)(\[\/COLOR\])"---VERY GOOD
        // @"(\[COLOR=(.[^\[]*)\])(.[^\[]*)(\[\/COLOR\])"
        //@"(\[COLOR=(.[^\[]*)\])([^\t]*?)(\[\/COLOR\])"------------------good
        for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
        {
            sDetail = sDetail.Replace(m.Groups[0].ToString(),
             "<FONT COLOR=" + m.Groups[2].ToString() + ">" +

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -