⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminmapprovider.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.Web
{
    using PowerEasy.Components;
    using System;
    using System.Web;

    public class AdminMapProvider : XmlSiteMapProvider
    {
        private string m_AdminPath;

        public override SiteMapNode FindSiteMapNode(string rawUrl)
        {
            string str2;
            if (string.IsNullOrEmpty(rawUrl))
            {
                return null;
            }
            this.m_AdminPath = GetAdminPath(rawUrl);
            string applicationPath = HttpContext.Current.Request.ApplicationPath;
            if (applicationPath == "/")
            {
                str2 = rawUrl.Replace(this.m_AdminPath, "/Admin/");
            }
            else
            {
                str2 = rawUrl.Replace(applicationPath + this.m_AdminPath, applicationPath + "/Admin/");
            }
            SiteMapNode node = base.FindSiteMapNode(str2);
            if (node == null)
            {
                string[] strArray = str2.Split(new char[] { '?' });
                if (strArray.Length >= 2)
                {
                    string str3 = strArray[0];
                    string[] strArray2 = strArray[1].Split(new char[] { '&' });
                    for (int i = 0; i < strArray2.Length; i++)
                    {
                        node = base.FindSiteMapNode(str3 + "?" + strArray2[i]);
                        if (node != null)
                        {
                            break;
                        }
                    }
                    if (node == null)
                    {
                        node = base.FindSiteMapNode(str3);
                    }
                }
            }
            if (node != null)
            {
                lock (node)
                {
                    node.ReadOnly = false;
                    node.Url = rawUrl;
                    node.Title = node.Title.Replace("点券", SiteConfig.UserConfig.PointName);
                    node.Description = node.Description.Replace("点券", SiteConfig.UserConfig.PointName);
                    node.ReadOnly = true;
                }
            }
            return node;
        }

        private static string GetAdminPath(string rawUrl)
        {
            string str2 = "/" + SiteConfig.SiteOption.ManageDir + "/";
            int index = rawUrl.IndexOf(str2, StringComparison.CurrentCultureIgnoreCase);
            if (index == -1)
            {
                return str2;
            }
            return rawUrl.Substring(index, str2.Length);
        }

        public override SiteMapNode GetParentNode(SiteMapNode node)
        {
            SiteMapNode parentNode = base.GetParentNode(node);
            if ((parentNode != null) && !string.IsNullOrEmpty(parentNode.Url))
            {
                parentNode.ReadOnly = false;
                parentNode.Url = parentNode.Url.Replace("/Admin/", this.m_AdminPath);
                parentNode.ReadOnly = true;
            }
            return parentNode;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -