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

📄 labeltransform.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
                    {
                        document.LoadXml(iPage.PageOtherSet);
                        list = document.SelectNodes("pageset/item");
                        count = list.Count;
                        flag = true;
                    }
                    catch (XmlException)
                    {
                    }
                }
                template.Replace("{$pagename/}", iPage.PageName).Replace("{$sourcename/}", iPage.SpanName).Replace("{$spanname/}", pagerName);
                string pattern = @"\{\$loop(([\s\S])*?)\}(([\s\S])*?)\{\$\/loop\}";
                foreach (Match match in Regex.Matches(template.ToString(), pattern, RegexOptions.Compiled))
                {
                    string str2 = match.Groups[3].Value;
                    int num2 = 0;
                    if (!string.IsNullOrEmpty(match.Groups[1].Value))
                    {
                        string xml = "<loopbody " + match.Groups[1].Value + "/>";
                        try
                        {
                            document.LoadXml(xml);
                            XmlElement firstChild = (XmlElement) document.FirstChild;
                            num2 = DataConverter.CLng(XmlManage.GetAttributesValue(firstChild, "range"));
                        }
                        catch (XmlException exception)
                        {
                            return ("[err:分页标签'" + pagerName + "'{loop}部位定义格式错,原因:" + exception.Message + "]");
                        }
                    }
                    string[] strArray = str2.Split(new string[] { "$$$" }, StringSplitOptions.None);
                    int num3 = 0;
                    int pageNum = iPage.PageNum;
                    if (count > pageNum)
                    {
                        pageNum = count;
                    }
                    if ((num2 > 0) && (iPage.PageNum > ((num2 * 2) + 1)))
                    {
                        if (iPage.CurrentPage > (num2 + 1))
                        {
                            if (iPage.CurrentPage > (iPage.PageNum - (num2 + 1)))
                            {
                                num3 = iPage.PageNum - ((num2 * 2) + 1);
                                pageNum = iPage.PageNum;
                            }
                            else
                            {
                                num3 = iPage.CurrentPage - (num2 + 1);
                                pageNum = iPage.CurrentPage + num2;
                            }
                        }
                        else
                        {
                            pageNum = (num2 * 2) + 1;
                        }
                    }
                    StringBuilder builder2 = new StringBuilder();
                    for (int i = num3; i < pageNum; i++)
                    {
                        string str4 = string.Empty;
                        if ((iPage.CurrentPage == (i + 1)) && (strArray.Length > 1))
                        {
                            str4 = strArray[strArray.Length - 1].Replace("{$pageid/}", Convert.ToString((int) (i + 1)));
                        }
                        else
                        {
                            str4 = strArray[0].Replace("{$pageid/}", Convert.ToString((int) (i + 1)));
                        }
                        if (i < count)
                        {
                            string innerText = string.Empty;
                            string str6 = string.Empty;
                            if (flag)
                            {
                                foreach (XmlNode node in list[i].SelectNodes("title"))
                                {
                                    innerText = node.InnerText;
                                }
                                foreach (XmlNode node2 in list[i].SelectNodes("url"))
                                {
                                    str6 = node2.InnerText;
                                }
                            }
                            if (!string.IsNullOrEmpty(str4))
                            {
                                if (!string.IsNullOrEmpty(innerText))
                                {
                                    str4 = str4.Replace("{$pagetitle/}", innerText);
                                }
                                else
                                {
                                    str4 = str4.Replace("{$pagetitle/}", i.ToString());
                                }
                                if (!string.IsNullOrEmpty(str6))
                                {
                                    str4 = str4.Replace("{$pageurl/}", str6);
                                }
                                else if ((iPage != null) && !string.IsNullOrEmpty(iPage.PageName))
                                {
                                    str4 = str4.Replace("{$pageurl/}", iPage.PageName.Replace("{$pageid/}", Convert.ToString(i)));
                                }
                            }
                        }
                        else if (!string.IsNullOrEmpty(str4))
                        {
                            str4 = str4.Replace("{$pagetitle/}", Convert.ToString((int) (i + 1)));
                            if (i == 0)
                            {
                                str4 = str4.Replace("{$pageurl/}", iPage.PageName.Replace("_{$pageid/}", ""));
                            }
                            else
                            {
                                int num8 = i + 1;
                                str4 = str4.Replace("{$pageurl/}", iPage.PageName.Replace("{$pageid/}", num8.ToString()));
                            }
                        }
                        builder2.Append(str4);
                    }
                    template.Replace(match.ToString(), builder2.ToString());
                }
                if ((iPage != null) && !string.IsNullOrEmpty(iPage.PageName))
                {
                    int num7;
                    template.Replace("{$unitname/}", unitname);
                    template.Replace("{$firsturl/}", iPage.PageName.Replace("_{$pageid/}", ""));
                    template.Replace("{$endid/}", iPage.PageNum.ToString());
                    if (iPage.PageNum == 1)
                    {
                        template.Replace("{$endurl/}", iPage.PageName.Replace("_{$pageid/}", ""));
                    }
                    else
                    {
                        template.Replace("{$endurl/}", iPage.PageName.Replace("{$pageid/}", iPage.PageNum.ToString()));
                    }
                    if (iPage.CurrentPage < 3)
                    {
                        template.Replace("{$prvurl/}", iPage.PageName.Replace("_{$pageid/}", ""));
                        template.Replace("{$prvid/}", iPage.CurrentPage.ToString());
                    }
                    else
                    {
                        int num6 = 1;
                        if (iPage.CurrentPage >= 3)
                        {
                            num6 = iPage.CurrentPage - 1;
                        }
                        template.Replace("{$prvurl/}", iPage.PageName.Replace("{$pageid/}", num6.ToString()));
                        template.Replace("{$prvid/}", num6.ToString());
                    }
                    if (iPage.CurrentPage < iPage.PageNum)
                    {
                        num7 = iPage.CurrentPage + 1;
                    }
                    else
                    {
                        num7 = iPage.PageNum;
                    }
                    if (iPage.PageNum == 1)
                    {
                        template.Replace("{$nexturl/}", iPage.PageName.Replace("_{$pageid/}", ""));
                        template.Replace("{$nextid/}", num7.ToString());
                    }
                    else
                    {
                        template.Replace("{$nexturl/}", iPage.PageName.Replace("{$pageid/}", num7.ToString()));
                        template.Replace("{$nextid/}", num7.ToString());
                    }
                    template.Replace("{$currentid/}", iPage.CurrentPage.ToString());
                    if (iPage.CurrentPage == 1)
                    {
                        template.Replace("{$currenturl/}", iPage.PageName.Replace("_{$pageid/}", ""));
                    }
                    else
                    {
                        template.Replace("{$currenturl/}", iPage.PageName.Replace("{$pageid/}", iPage.CurrentPage.ToString()));
                    }
                    template.Replace("{$totalpub/}", iPage.TotalPub.ToString());
                    template.Replace("{$pagesize/}", iPage.PageSize.ToString());
                    template.Replace("{$installdir/}", InsideStaticLabelObject.InstallDir());
                    template.Replace("{$originurl/}", iPage.PageName);
                }
            }
            return template.ToString();
        }

        public static string GetSiteConfigLabel(string labelName)
        {
            XmlElement firstChild;
            XmlDocument document = new XmlDocument();
            string str = string.Empty;
            switch (labelName)
            {
                case "sitename":
                    return SiteConfig.SiteInfo.SiteName;

                case "sitetitle":
                    return SiteConfig.SiteInfo.SiteTitle;

                case "installdir":
                    return SiteConfig.SiteInfo.VirtualPath;

                case "includefilepath":
                    return SiteConfig.SiteOption.IncludeFilePath;

                case "sitepath":
                    return SiteConfig.SiteInfo.SiteUrl;

                case "logo":
                    return Utility.ConvertAbsolutePath(SiteConfig.SiteInfo.VirtualPath, SiteConfig.SiteInfo.LogoUrl);

                case "banner":
                    return Utility.ConvertAbsolutePath(SiteConfig.SiteInfo.VirtualPath, SiteConfig.SiteInfo.BannerUrl);

                case "webmaster":
                    return SiteConfig.SiteInfo.Webmaster;

                case "webmasteremail":
                    return SiteConfig.SiteInfo.WebmasterEmail;

                case "copyright":
                    return SiteConfig.SiteInfo.Copyright;

                case "managedir":
                    return SiteConfig.SiteOption.ManageDir;

                case "addir":
                    return SiteConfig.SiteOption.AdvertisementDir;

                case "metakeywords":
                    return SiteConfig.SiteInfo.MetaKeywords;

                case "metadescription":
                    return SiteConfig.SiteInfo.MetaDescription;

                case "defaultcss":
                    try
                    {
                        document.LoadXml("<" + labelName + " />");
                        firstChild = (XmlElement) document.FirstChild;
                    }
                    catch (XmlException exception)
                    {
                        return ("[err:系统标签" + labelName + "错,原因:" + exception.Message + "]");
                    }
                    if (string.IsNullOrEmpty(XmlManage.GetAttributesValue(firstChild, "name")))
                    {
                        return ("<link href=\"" + SiteConfig.SiteInfo.VirtualPath + "Skin/DefaultSkin.css\" rel=\"stylesheet\" type=\"text/css\">");
                    }
                    return ("<link href=\"Skin/" + XmlManage.GetAttributesValue(firstChild, "name") + ".css\" rel=\"stylesheet\" type=\"text/css\">");

                case "timenow":
                    return DateTime.Now.ToLocalTime().ToString();

                case "uploaddir":
                    return SiteConfig.SiteOption.UploadDir;

                case "readfile":
                {
                    try
                    {
                        document.LoadXml("<" + labelName + " />");
                        firstChild = (XmlElement) document.FirstChild;
                    }
                    catch (XmlException exception2)
                    {
                        return ("[err:系统标签" + labelName + "错,原因:" + exception2.Message + "]");
                    }
                    string attributesValue = XmlManage.GetAttributesValue(firstChild, "path");
                    if (!string.IsNullOrEmpty(attributesValue))
                    {
                        attributesValue = HttpContext.Current.Server.MapPath(attributesValue);
                        if (File.Exists(attributesValue))
                        {
                            str = File.ReadAllText(attributesValue);
                        }
                    }
                    return str;
                }
                case "applicationpath":
                    if (!SiteConfig.SiteOption.IsAbsoluatePath)

⌨️ 快捷键说明

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