DTcms.DAL/url_rewrite.cs

(开头部分) 14KB

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

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using DTcms.Common;

namespace DTcms.DAL
{
    public class url_rewrite
    {
        #region 增、删、改操作=================================================
        /// <summary>
        /// 增加节点
        /// </summary>
        public bool Add(Model.url_rewrite model)
        {
            try
            {
                string filePath = Utils.GetXmlMapPath(DTKeys.FILE_URL_XML_CONFING);
                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);
                XmlNode xn = doc.SelectSingleNode("urls");
                XmlElement xe = doc.CreateElement("rewrite");
                if (!string.IsNullOrEmpty(model.name))
                    xe.SetAttribute("name", model.name);
                if (!string.IsNullOrEmpty(model.path))
                    xe.SetAttribute("path", model.path);
                if (!string.IsNullOrEmpty(model.pattern))
                    xe.SetAttribute("pattern", model.pattern);
                if (!string.IsNullOrEmpty(model.page))
                    xe.SetAttribute("page", model.page);
                if (!string.IsNullOrEmpty(model.querystring))
                    xe.SetAttribute("querystring", model.querystring);
                if (!string.IsNullOrEmpty(model.templet))
                    xe.SetAttribute("templet", model.templet);
                if (!string.IsNullOrEmpty(model.channel))
                    xe.SetAttribute("channel", model.channel.ToString());
                if (!string.IsNullOrEmpty(model.type))
                    xe.SetAttribute("type", model.type);
                if (!string.IsNullOrEmpty(model.inherit))
                    xe.SetAttribute("inherit", model.inherit);
                xn.AppendChild(xe);
                doc.Save(filePath);
                return true;
            }
            catch
            {
                return false;
            }
        }

        /// <summary>
        /// 修改节点
        /// </summary>
        public bool Edit(Model.url_rewrite model)
        {
            string filePath = Utils.GetXmlMapPath(DTKeys.FILE_URL_XML_CONFING);
            XmlDocument doc = new XmlDocument();
            doc.Load(filePath);
后面还有 275 行代码,购买后查看完整代码

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

AI 解读

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

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