WebSiteShop/Admin/Show_VerifyCode.aspx.cs

(开头部分) 3KB

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

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
//using System.Web.UI.WebControls;
//using System.Web.UI.WebControls.WebParts;
//using System.Web.UI.HtmlControls;

using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;


public partial class Admin_Show_VerifyCode : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            try
            {
                Image image = Image.FromFile(base.Server.MapPath("Images/VerifyCodeBack.Gif"));
                int width = image.Width;
                int height = image.Height;

                string text = RndNum() ;// this.Session[SiteCachePrefix + "ImageCode"].ToString();
                Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
                bitmap.SetResolution(85f, 72f);
                Graphics graphics = Graphics.FromImage(bitmap);
                graphics.Clear(Color.White);
                graphics.SmoothingMode = SmoothingMode.AntiAlias;
                graphics.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, width, height, GraphicsUnit.Pixel);
                int[] numArray = new int[] { 0x10, 14, 12, 10, 8, 6, 4 };
                Font font = null;
                // SizeF ef = new SizeF();
                for (int i = 0; i < 0x10; i++)
                {
                    font = new Font("Arial", (float)numArray[i], FontStyle.Bold);
                    if (((ushort)graphics.MeasureString(text, font).Width) < ((ushort)width))
                    {
                        break;
                    }
                }
                float num4 = height / 2;
                float num5 = width / 2;
                StringFormat format = new StringFormat();
                format.Alignment = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;
                graphics.DrawString(text, font, new SolidBrush(Color.Black), new PointF(num5 + 1f, num4 + 1f), format);
                base.Response.ContentType = "image/jpeg";
                bitmap.Save(base.Response.OutputStream, ImageFormat.Jpeg);
            }
            catch (Exception exception)
            {
                base.Response.Write(exception.Message);
            }
        }
后面还有 23 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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