Exemple #1
0
        /// <summary> </summary>
        public WzVariant this[string path]
        {
            get
            {
                WzProperty sub   = this;
                string[]   names = path.Replace('\\', '/').Split('/');
                int        i;

                for (i = 0; i < names.Length - 1 && sub != null; ++i)
                {
                    sub = sub[names[i]].GetValue <WzProperty>();
                }

                if (sub != null)
                {
                    foreach (WzVariant v in sub)
                    {
                        if (v.Name == names[i])
                        {
                            return(v);
                        }
                    }
                }

                return(WzVariant.Null);
            }
        }
Exemple #2
0
        /// <summary> </summary>
        public WzVariant this[string path]
        {
            get
            {
                WzProperty obj = this.Data as WzProperty;

                return(obj == null ? WzVariant.Null : obj[path]);
            }
        }
Exemple #3
0
        /// <summary> 產生一個<see cref="WzProperty"/>的拷貝 </summary>
        public override WzSerialize Clone()
        {
            WzProperty prop = new WzProperty(this.Name);

            prop.Unknow1_UShort = this.Unknow1_UShort;

            foreach (WzVariant v in this.mList)
            {
                prop.Add(v.Clone());
            }

            return(prop);
        }
Exemple #4
0
        /// <summary> 取得這個<see cref="WzUOL"/>所指向的<see cref="WzVariant"/> </summary>
        public WzVariant GetVariant()
        {
            string[]   names  = this.Path.Split('/');
            WzProperty parent = this.Parent as WzProperty;
            int        i;

            for (i = 0; i < names.Length - 1; ++i)
            {
                if (parent == null)
                {
                    break;
                }
                if (names[i] == "..")
                {
                    parent = parent.Parent as WzProperty;
                }
                else
                {
                    parent = parent[names[i]].GetValue <WzProperty>();
                }
            }

            return(parent == null ? WzVariant.Null : parent[names[i]]);
        }