MxWeiXinPF.Web/test.aspx.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MxWeiXinPF.Web
{
    public partial class test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetRemoteImage("https://mp.weixin.qq.com/cgi-bin/getimgdata?token=1818104102&msgid=200318139&mode=large&source=&fileId=0&ow=1681793591");
               
            }
        }

        /// <summary>
        /// 替换下载远程图片及入库操作
        /// </summary>
        /// <param name="strInput">内容</param>
        /// <returns>返回string类型;替换后的内容</returns>
        public static string ReplaceRemoteUrl(string strInput)
        {
            string tempFilePath = "";
            string outStr;
            outStr = strInput;

            //获取远程图片url集合
            string _pattern = @"(http|https|ftp|rtsp|mms):(\/\/|\\\\){1}((([\w-])+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3}))([^\?\s]*\/)(([^\?\s])+[.]{1}(gif|jpg|png|bmp))";
            MatchCollection found = null;
            RegexOptions TheOptions;
            TheOptions = RegexOptions.Singleline | RegexOptions.IgnoreCase;
            Regex r = new Regex(_pattern, TheOptions);
            found = r.Matches(strInput);
            foreach (Match m in found)
            {
                tempFilePath = "";
                if (m.Value.Length > 0)
                {
                    tempFilePath = GetRemoteImage(m.Value);
                    //如果下载成功
                    if (tempFilePath.Length > 0)
                    {
                        outStr = outStr.Replace(m.Value, tempFilePath);
                    }
                }
            }

            return outStr;
        }
        /// <summary>
        /// 下载远程图片
        /// </summary>
后面还有 38 行代码,购买后查看完整代码

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

AI 解读

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

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