Discuz.Web.Services/My.cs

(开头部分) 4KB

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

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.UI;

using Discuz.Common;
using Discuz.Config;
using Discuz.Web.Services.Manyou.Actions;
using Newtonsoft.Json;

namespace Discuz.Web.Services
{
    public class My : Page
    {
        public static RegexOptions options = RegexOptions.None;

        private static Regex regex1 = new Regex(@",""params"":({([\s\S]+?)})},{""module", options);//匹配除最后一个任务params的所有params项目

        private static Regex regex2 = new Regex(@",""params"":({([\s\S]+?)})}]$", options);//匹配最后一个任务params项目

        //public static string logtext = "";

        public My()
        {
            this.Load += new EventHandler(MYServer_Load);
        }

        void MYServer_Load(object sender, EventArgs e)
        {
            Response.Clear();

            string className = DNTRequest.GetString("module");
            string method = DNTRequest.GetString("method");
            string myParams = DNTRequest.GetString("params");
            string sign = DNTRequest.GetString("sign");


            if (!CheckSignature(sign, className, method, myParams))//校验请求签名合法性
                return;

            string result = "";
            if (className == "Batch" && method == "run")//如果是批量操作任务
            {
                List<string> paramsList = new List<string>();

                for (Match m1 = regex1.Match(myParams); m1.Success; m1 = m1.NextMatch())//从myParams找到params参数的值,并按顺序提取出来
                {
                    paramsList.Add(m1.Groups[1].Value);
                }
                string subParams = regex1.Replace(myParams, "},{\"module");//从原始params中移除除最后一个任务params的所有params

                paramsList.Add(regex2.Match(subParams).Groups[1].Value);

                TaskInfo[] taskList = JavaScriptConvert.DeserializeObject<TaskInfo[]>(regex2.Replace(subParams, "}]"));//移除最后一个任务params项目,并反序列化出任务列表,循环执行

后面还有 49 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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