Backup/Discuz.Aggregation/AggregationDataSubject.cs

(开头部分) 4KB

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

using System;
using System.IO;
using System.Collections;
using System.Text;

using Discuz.Common;

namespace Discuz.Aggregation
{
    /// <summary>
    /// 聚合数据主体类
    /// </summary>
    public class AggregationDataSubject
    {
        /// <summary>
        /// 程序刚加载时aggregation.config文件修改时间
        /// </summary>
        public static DateTime fileoldchange;
        /// <summary>
        /// 最新aggregation.config文件修改时间
        /// </summary>
        public static DateTime filenewchange;
        /// <summary>
        /// 设置定时器时间为15秒
        /// </summary>
        private static System.Timers.Timer aggregationConfigTimer = new System.Timers.Timer(15000);

        private static object lockHelper = new object();

        static AggregationDataSubject()
        {
            if (!Utils.FileExists(AggregationData.DataFilePath))
            {
                string content = "<?xml version=\"1.0\" standalone=\"yes\"?>\r\n";
                content += "<remove>\r\n<table1 xpath=\"example\" removedatetime=\""+DateTime.Now.ToShortDateString()+"\" />\r\n</remove>";

                using (FileStream fs = new FileStream(AggregationData.DataFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
                {
                    Byte[] info = System.Text.Encoding.UTF8.GetBytes(content);
                    fs.Write(info, 0, info.Length);
                    fs.Close();
                }
            }
            fileoldchange = System.IO.File.GetLastWriteTime(AggregationData.DataFilePath);

            //初始化定时器
            aggregationConfigTimer.AutoReset = true;
            aggregationConfigTimer.Enabled = true;
            aggregationConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
            aggregationConfigTimer.Start();
        }

        private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (IsFileHadRewrite())
            {
                ReSetFileChangeTime();

                AggregationData.ReadAggregationConfig();

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

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

AI 解读 AI

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

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