Hidistro.Entities/RegionHelper.cs

(开头部分) 10KB

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

namespace Hidistro.Entities
{
    using Hidistro.Core;
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Web;
    using System.Web.Caching;
    using System.Xml;

    public static class RegionHelper
    {
        private static XmlNode FindNode(int id)
        {
            string str = id.ToString(CultureInfo.InvariantCulture);
            string xpath = string.Format("//county[@id='{0}']", str);
            XmlDocument regionDocument = GetRegionDocument();
            XmlNode node = regionDocument.SelectSingleNode(xpath);
            if (node != null)
            {
                return node;
            }
            xpath = string.Format("//city[@id='{0}']", str);
            node = regionDocument.SelectSingleNode(xpath);
            if (node != null)
            {
                return node;
            }
            xpath = string.Format("//province[@id='{0}']", str);
            node = regionDocument.SelectSingleNode(xpath);
            if (node != null)
            {
                return node;
            }
            return null;
        }

        public static string GetAllChild(int currentRegionId)
        {
            string str = currentRegionId.ToString();
            XmlNode node = FindNode(currentRegionId);
            if (node != null)
            {
                foreach (XmlNode node2 in node.ChildNodes)
                {
                    str = str + "," + node2.Attributes["id"].Value;
                }
            }
            return str;
        }

        public static Dictionary<int, string> GetAllCitys()
        {
            Dictionary<int, string> dictionary = new Dictionary<int, string>();
            XmlNode node = GetRegionDocument().SelectSingleNode("root");
            string str = "";
            foreach (XmlNode node2 in node.ChildNodes)
            {
                if (node2.ChildNodes.Count > 0)
                {
后面还有 214 行代码,购买后查看完整代码

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

AI 解读 AI

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

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