SourceCode/RFrameGenerate.Common/WebManage.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace RFrameGenerate.Common
{
    public class WebManage
    {
        static WebManage()
        {
            time = new System.Timers.Timer();
            time.Interval = 10 * 60 * 1000;
            time.Elapsed += time_Elapsed;
            time.Start();
        }

        static System.Timers.Timer time;
        static object webmanagelock = new object();
        static void time_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            Read();
        }

        public static string filepath = "";
        static List<AllowUrl> AllowUrl = new List<AllowUrl>();
        static List<WebTitle> WebTitle = new List<WebTitle>();
        public static void Read()
        {
            lock (webmanagelock)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filepath);
                AllowUrl.Clear();
                foreach (XmlElement v in doc.SelectNodes("Web/AllowUrl/Url"))
                {
                    AllowUrl.Add(new AllowUrl(v.Attributes["urlrule"].Value.ToLower(), (v.Attributes["enable"].Value.ToString().ToLower() == "true" ? true : false)));
                }
                WebTitle.Clear();
                foreach (XmlElement v in doc.SelectNodes("Web/WebTitle/Title"))
                {
                    WebTitle.Add(new WebTitle(v.Attributes["urlrule"].Value.ToLower(), v.Attributes["webtitle"].Value, (v.Attributes["enable"].Value.ToString().ToLower() == "true" ? true : false)));
                }
            }
        }

        public static bool IsAllowVisit(string url)
        {
            lock (webmanagelock)
            {
                url = url.Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries)[0].ToLower();
                foreach (var v in AllowUrl)
                {
                    if (v.enable == true && url.Contains(v.urlrule) == true)
                    {
                        return true;
                    }
                }
                return false;
后面还有 45 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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