Sry.Framework.Web/HttpUtils.cs
(开头部分) 14KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.Web;
using System.IO;
using System.Runtime.InteropServices;
using System.Reflection;
namespace Sry.Framework.Web
{
public class HttpUtils
{
public static byte[] GetImageBytes(string mapUrl)
{
WebClient oClient = new WebClient();
byte[] bytes = oClient.DownloadData(mapUrl);
return bytes;
}
/// <summary>
/// 获取匹配结果
/// </summary>
/// <param name="input">源字符串</param>
/// <param name="pattern">验证字符串</param>
/// <param name="find"></param>
/// <returns></returns>
public static Match GetMatch(string input, string pattern, string find)
{
string _pattn = Regex.Escape(pattern);
_pattn = _pattn.Replace(@"\[变量]", @"[\s\S]*?");
_pattn = Regex.Replace(_pattn, @"((\\r\\n)|(\\ ))+", @"\s*", RegexOptions.Compiled);
if (Regex.Match(pattern.TrimEnd(), Regex.Escape(find) + "$", RegexOptions.Compiled).Success)
_pattn = _pattn.Replace(@"\" + find, @"(?<TARGET>[\s\S]+)");
else
_pattn = _pattn.Replace(@"\" + find, @"(?<TARGET>[\s\S]+?)");
Regex r = new Regex(_pattn, RegexOptions.IgnoreCase | RegexOptions.Compiled);
Match m = r.Match(input);
return m;
}
public static string GetIP()
{
string uip = null;
if (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) //判断是否有代理
{
uip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
uip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
}
return uip;
}
/// <summary>
/// Escape的加密
/// </summary>
/// <param name="str"></param>
后面还有 327 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。