Backup/Discuz.Plugin/VerifyImage/VerifyImage.cs

(开头部分) 4KB

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

using System;
using System.IO;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Security.Cryptography;
using Discuz.Plugin.VerifyImage;
using Discuz.Entity;

namespace Discuz.Plugin.VerifyImage.JpegImage
{

	/// <summary>
	/// 验证码图片类
	/// </summary>
	public class VerifyImage : IVerifyImage
	{
        private static byte[] randb = new byte[4];
        private static RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();

        private static Matrix m = new Matrix();
        private static Bitmap charbmp = new Bitmap(40, 40);

        //private static Font[] fonts = {
        //                                new Font(new FontFamily("Times New Roman"), 16 + Next(3), FontStyle.Regular),
        //                                new Font(new FontFamily("Georgia"), 16 + Next(3), FontStyle.Regular),
        //                                new Font(new FontFamily("Arial"), 16 + Next(3), FontStyle.Regular),
        //                                new Font(new FontFamily("Comic Sans MS"), 16 + Next(3), FontStyle.Regular)
        //                             };

        private static Font[] fonts = {
                                        new Font(new FontFamily("Times New Roman"), 16 + Next(3), FontStyle.Bold),
                                        new Font(new FontFamily("Georgia"), 16 + Next(3), FontStyle.Bold),
                                        new Font(new FontFamily("Arial"), 16 + Next(3), FontStyle.Bold),
                                        new Font(new FontFamily("Comic Sans MS"), 16 + Next(3), FontStyle.Bold)
                                     };
        /// <summary>
        /// 获得下一个随机数
        /// </summary>
        /// <param name="max">最大值</param>
        /// <returns></returns>
        private static int Next(int max)
        {
            rand.GetBytes(randb);
            int value = BitConverter.ToInt32(randb, 0);
            value = value % (max + 1);
            if (value < 0)
                value = -value;
            return value;
        }

        /// <summary>
        /// 获得下一个随机数
        /// </summary>
        /// <param name="min">最小值</param>
        /// <param name="max">最大值</param>
        /// <returns></returns>
        private static int Next(int min, int max)
        {
后面还有 66 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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