Пример #1
0
        /// <summary>
        /// 一致する最後の xml 要素に対して Elem のインスタンスを返します。
        /// </summary>
        /// <returns>
        /// 一致する物がない場合でも最後に一致した物を返す。
        /// 一致する物が一つもない場合や className に空白が指定された場合はは null を返す
        /// </returns>
        public Hanyu.XmlPart.Elem GetElem(string className)
        {
            string[] arr = className.Split(new char[] { '.' });
            if (arr.Length < 1)
            {
                return(null);
            }
            System.Xml.XmlNodeList list = this.xdoc.DocumentElement.ChildNodes;
            Hanyu.XmlPart.Elem     r = null;
            int j; int listlen;

            System.Xml.XmlElement elem;
            for (int i = 0; i < arr.Length; i++)
            {
                listlen = list.Count;
                for (j = 0; j < listlen; j++)
                {
                    if (list[j].NodeType != System.Xml.XmlNodeType.Element)
                    {
                        continue;
                    }
                    elem = (System.Xml.XmlElement)list[j];
                    if (elem.GetAttribute("name") == arr[i])
                    {
                        r    = (XmlPart.Elem)elem;
                        list = elem.ChildNodes;
                        break;
                    }
                }
            }
            return(r);
        }
Пример #2
0
 public string GetIconPath(string className)
 {
     Hanyu.XmlPart.Elem elem = this.GetElem(className);
     if (elem == null)
     {
         return("");
     }
     return(elem.IcoPath);
 }
Пример #3
0
 public Hanyu.XmlPart.Elem GetElem(string path)
 {
     if (path == "")
     {
         return(null);
     }
     /*hash*/ if (this.hshElems.ContainsKey(path))
     {
         return((Hanyu.XmlPart.Elem) this.hshElems[path]);                                                 //*/
     }
     string[]           path2 = path.Split(new char[] { '.' }, 2);
     Hanyu.XmlPart.Elem elem  = (path2.Length == 1)?this.GetChild(path2[0]):this.GetChild(path2[0]).GetElem(path2[1]);
     /*hash*/ this.hshElems.Add(path, elem);          //*/
     return(elem);
 }
Пример #4
0
 internal ElemNull(string name, Hanyu.XmlPart.Elem parent) : base(null)
 {
     this.name   = name;
     this.parent = parent;
 }