Backup/Discuz.Forum/Templates.cs

(开头部分) 7KB

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

using System;
using System.Xml;
using System.Text;
using System.Data;
using System.Data.Common;

using Discuz.Common;
using Discuz.Data;
using Discuz.Config;
using Discuz.Entity;

namespace Discuz.Forum
{
    /// <summary>
    /// 论坛模板操作类
    /// </summary>
    public class Templates
    {
        private static object SynObject = new object();

        /// <summary>
        /// 从模板变量文件中获得模板变量值的信息
        /// </summary>
        /// <param name="templatename">模板变量文件名)</param>
        /// <returns>模板变量表</returns>
        public static DataTable GetTemplateVariable1(string templatename)
        {
            string path = Utils.GetMapPath("../../templates/" + templatename + "/templatevariable.xml");
            ///存放变量信息的文件 templatevariable.xml是否存在,不存在返回空表
            if (!System.IO.File.Exists(path))
                return null;
            else
            {
                using (DataSet ds = new DataSet())
                {
                    ds.ReadXml(path);
                    return ds.Tables[0];
                }
            }
        }

        /// <summary>
        /// 获取指定路径下模板的宽度
        /// </summary>
        /// <param name="templatePath">模板名称</param>
        /// <returns></returns>
        public static int GetTemplateWidth(string templatePath)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            string width = cache.RetrieveObject("/Forum/TemplateWidth/" + templatePath) as string;
            if (width == null)
            {
                width = GetTemplateAboutInfo(Utils.GetMapPath(BaseConfigs.GetForumPath + "templates/" + templatePath + "/")).width;
                cache.AddObject("/Forum/TemplateWidth/" + templatePath, width);
            }
            return TypeConverter.StrToInt(width);
        }


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

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

AI 解读 AI

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

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