Esempio n. 1
0
            public bool IsIgnored(XmlType type, string childName = null)
            {
                if (type == null)
                {
                    return(false);
                }
                if (dicChildren.Count <= 0)
                {
                    return(false);
                }
                if (GetChild("*") != null)
                {
                    return(true);
                }
                List <XmlType> listXmlType = new List <XmlType>();
                XmlType        cur         = type;

                while (cur != null)
                {
                    if (!cur.IsArrayElement())
                    {
                        listXmlType.Insert(0, cur);
                    }
                    cur = cur.parent;
                }
                IgnoreNode parentNode = this;

                for (int i = 0; i < listXmlType.Count; ++i)
                {
                    IgnoreNode child = parentNode.GetChild(listXmlType[i].name);
                    if (child == null)
                    {
                        break;
                    }
                    parentNode = child;
                }
                if (parentNode.dicChildren.Count <= 0)
                {
                    return(true);
                }
                if (!string.IsNullOrEmpty(childName))
                {
                    IgnoreNode child = parentNode.GetChild(childName);
                    if (child != null && child.dicChildren.Count <= 0)
                    {
                        //Debug.Log(type.GetPathName()+"/"+childName);
                        return(true);
                    }
                }
                return(false);
            }
Esempio n. 2
0
            public int GetDepth()
            {
                XmlType temp  = parent;
                int     depth = 0;

                while (temp != null)
                {
                    if (!temp.IsArrayElement())
                    {
                        ++depth;
                    }
                    temp = temp.parent;
                }
                return(depth);
            }
Esempio n. 3
0
            public string GetPathName()
            {
                string  text       = name;
                XmlType nextParent = parent;

                while (nextParent != null)
                {
                    if (!nextParent.IsArrayElement())
                    {
                        text = nextParent.name + "/" + text;
                    }
                    nextParent = nextParent.parent;
                }
                return(text);
            }