Backup/Discuz.Forum/ScheduledEvents/Event.cs

(开头部分) 5KB

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

using System;
using System.Xml.Serialization;
using Discuz.Data;

namespace Discuz.Forum.ScheduledEvents
{
	/// <summary>
	/// Event is the configuration of an IEvent. 
	/// </summary>
	public class Event
	{
		public Event()
		{

		}

		private IEvent _ievent = null;

		/// <summary>
		/// The current implementation of IEvent
		/// </summary>
		public IEvent IEventInstance
		{
			get
			{
				LoadIEvent();
				return _ievent;
			}
		}

		/// <summary>
		/// Private method for loading an instance of IEvent
		/// </summary>
		private void LoadIEvent()
		{
			if(_ievent == null)
			{
				if(this.ScheduleType == null)
				{
                    EventLogs.WriteFailedLog("计划任务没有定义其 type 属性");
				}

                Type type = Type.GetType(this.ScheduleType);
                if (type == null)
                {
                    EventLogs.WriteFailedLog(string.Format("计划任务 {0} 无法被正确识别", this.ScheduleType));
                }
                else
                {
                    _ievent = (IEvent)Activator.CreateInstance(type);
                    if (_ievent == null)
                    {
                        EventLogs.WriteFailedLog(string.Format("计划任务 {0} 未能正确加载", this.ScheduleType));
                    }
                }
			}
		}

		private string _key;
		
后面还有 124 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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