YongHu_UI/Model/StringGenerator.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;

namespace YongHu_UI.Model
{
    /// <summary>
    /// 字符串生成器
    /// </summary>
    public class StringGenerator
    {
        /// <summary>
        /// create a random key
        /// </summary>
        static readonly Random Random = new Random(~unchecked((int)DateTime.Now.Ticks));
        static readonly char[] NumberList = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
        static readonly char[] CharList = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
        static readonly char[] MixedList = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; //remove I & O

        /// <summary>
        /// 生成随机数字
        /// </summary>
        /// <param name="Length">生成长度</param>
        public static string Number(int Length)
        {
            return Create(Length, false, NumberList);
        }

        /// <summary>
        /// 生成随机字母与数字
        /// </summary>
        /// <param name="Length">生成长度</param>
        public static string Mixed(int Length)
        {
            return Create(Length, false, MixedList);
        }

        /// <summary>
        /// 生成随机纯字母随机数
        /// </summary>
        /// <param name="Length">生成长度</param>
        public static string Char(int Length)
        {
            return Create(Length, false, CharList);
        }

        /// <summary>
        /// 指定字符串长度、线程休眠、字符列表,创建验证码
        /// </summary>
        /// <param name="Length">Length.</param>
        /// <param name="Sleep">If set to <c>true</c> sleep.</param>
        /// <param name="List">List create CAPTCHA based on</param>
        /// <returns>The create.</returns>
        private static string Create(int Length, bool Sleep, char[] List)
        {
            if (Sleep)
                Thread.Sleep(3);
            char[] Pattern = List;
后面还有 11 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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