App_Code/Utils.cs

(开头部分) 22KB

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

using System;
using System.Text;
using System.Web;
using System.Text.RegularExpressions;

    public class Utils
    {
        /// <summary>
        /// 获取AppSeting字符串函数
        /// </summary>
        /// <param name="Str">所要获取的字符串</param>
        /// <returns></returns>
        public static string GetAppSeting(string key)
        {
            // 下载于www.51aspx.com
            if (key == null || key == "")
                return "";
            string outstr = "";
            outstr = System.Configuration.ConfigurationManager.AppSettings[key];
            if (outstr == null || outstr == "")
                return "";

            return outstr;
        }

        /// <summary>
        /// 编码转换UnicodeToGB,如,\u548c换成中文汉字
        /// </summary>
        /// <param name="content">输入内容</param>
        /// <returns>输出内容</returns>
        private string UnicodeToGB(string content)
        {
            Regex objRegex = new Regex("&#(?<UnicodeCode>[\\d]{5});", RegexOptions.IgnoreCase);
            Match objMatch = objRegex.Match(content);
            System.Text.StringBuilder sb = new System.Text.StringBuilder(content);
            while (objMatch.Success)
            {
                string code = Convert.ToString(Convert.ToInt32(objMatch.Result("${UnicodeCode}")), 16);
                byte[] array = new byte[2];
                array[0] = (byte)Convert.ToInt32(code.Substring(2), 16);
                array[1] = (byte)Convert.ToInt32(code.Substring(0, 2), 16);

                sb.Replace(objMatch.Value, System.Text.Encoding.Unicode.GetString(array));

                objMatch = objMatch.NextMatch();
            }
            return sb.ToString();
        }


        /// <summary>
        /// 获取字符传的位数,位数不能少于1
        /// </summary>
        public static string getstr(string str1,int leng)
        {
            string tmp = str1;
            if (leng>0)
            {
                if (tmp.Length > leng)
                {
后面还有 623 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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