Backup/Discuz.Aggregation/PhotoAggregationData.cs

(开头部分) 4KB

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

using System;
using System.Text;
using System.Xml;

using Discuz.Common.Xml;
using Discuz.Entity;

namespace Discuz.Aggregation
{
    /// <summary>
    /// 图片聚合数据类
    /// </summary>
    public class PhotoAggregationData : AggregationData
    {        
        /// <summary>
        /// 图片聚合信息
        /// </summary>
        private static PhotoAggregationInfo __photoAggregationInfo;

        /// <summary>
        /// 清空数据绑定
        /// </summary>
        public override void ClearDataBind()
        {
            __photoAggregationInfo = null;
        }

        /// <summary>
        /// 得到图片聚合信息对象
        /// </summary>
        /// <returns></returns>
        public PhotoAggregationInfo GetPhotoAggregationInfo()
        {
            return (__photoAggregationInfo != null) ? __photoAggregationInfo : GetPhotoAggregationInfoFromFile();
        }

        /// <summary>
        /// 从文件中获得数据并初始化图片聚合对象
        /// </summary>
        /// <returns></returns>
        public PhotoAggregationInfo GetPhotoAggregationInfoFromFile()
        {
            XmlNode xmlnode = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig")[0];

            __photoAggregationInfo = new PhotoAggregationInfo();
            if (xmlnode != null)
            {
                __photoAggregationInfo.Focusphotoshowtype = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotoshowtype") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotoshowtype"));
                __photoAggregationInfo.Focusphotodays = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotodays") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotodays"));
                __photoAggregationInfo.Focusphotocount = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotocount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotocount"));
                __photoAggregationInfo.Focusalbumshowtype = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumshowtype") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumshowtype"));
                __photoAggregationInfo.Focusalbumdays = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumdays") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumdays"));
                __photoAggregationInfo.Focusalbumcount = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumcount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumcount"));
                __photoAggregationInfo.Weekhot = (xmlDoc.GetSingleNodeValue(xmlnode, "Weekhot") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Weekhot"));
            }

            return __photoAggregationInfo;
        }

        /// <summary>
后面还有 24 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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