예제 #1
0
        /// <summary>
        /// 生成随机九宫格中文字符验证码
        /// </summary>
        /// <returns></returns>
        public static CaptchaInfo DrawChinaSudokuImage()
        {
            string checkCode = RandomHelper.CreateChinaCode(9);
            string str       = null;
            int    count     = 3;

            int[]  list = new int[4];
            Random rd   = new Random();

            while (count >= 0)
            {
                var v = rd.Next(9);
                if (!list.Contains(v))
                {
                    list[count] = v;
                    str        += v;
                    count--;
                }
            }
            CaptchaInfo cap = new CaptchaInfo();

            cap.Result  = str;
            cap.ImgData = CreateSudokuImage(checkCode, list);
            return(cap);
        }
예제 #2
0
 /// <summary>
 /// 生成数字字母验证码图片
 /// </summary>
 /// <param name="length">生成认证长度</param>
 public static CaptchaInfo DrawNumberImage(int length)
 {
     string checkCode = RandomHelper.Str(length);
     CaptchaInfo cap = new CaptchaInfo();
     cap.Result = checkCode;
     cap.ImgData = CreateImage(checkCode);
     return cap;
 }
예제 #3
0
 /// <summary>
 /// 生成随机中文字符图片
 /// </summary>
 /// <param name="Length"></param>
 /// <returns></returns>
 public static CaptchaInfo DrawChinaImage(int Length)
 {
     string checkCode = RandomHelper.CreateChinaCode(Length);
     CaptchaInfo cap = new CaptchaInfo();
     cap.Result = checkCode;
     cap.ImgData = CreateImage(checkCode);
     return cap;
 }
예제 #4
0
        /// <summary>
        /// 生成数字字母验证码图片
        /// </summary>
        /// <param name="length">生成认证长度</param>
        public static CaptchaInfo DrawNumberImage(int length)
        {
            string      checkCode = RandomHelper.Str(length);
            CaptchaInfo cap       = new CaptchaInfo();

            cap.Result  = checkCode;
            cap.ImgData = CreateImage(checkCode);
            return(cap);
        }
예제 #5
0
        /// <summary>
        /// 生成随机中文字符图片
        /// </summary>
        /// <param name="Length"></param>
        /// <returns></returns>
        public static CaptchaInfo DrawChinaImage(int Length)
        {
            string      checkCode = RandomHelper.CreateChinaCode(Length);
            CaptchaInfo cap       = new CaptchaInfo();

            cap.Result  = checkCode;
            cap.ImgData = CreateImage(checkCode);
            return(cap);
        }
예제 #6
0
 /// <summary>
 /// 生成随机九宫格中文字符验证码
 /// </summary>
 /// <returns></returns>
 public static CaptchaInfo DrawChinaSudokuImage()
 {
     string checkCode = RandomHelper.CreateChinaCode(9);
     string str = null;
     int count = 3;
     int[] list = new int[4];
     Random rd = new Random();
     while (count >= 0)
     {
         var v = rd.Next(9);
         if (!list.Contains(v))
         {
             list[count] = v;
             str += v;
             count--;
         }
     }
     CaptchaInfo cap = new CaptchaInfo();
     cap.Result = str;
     cap.ImgData = CreateSudokuImage(checkCode, list);
     return cap;
 }