示例#1
0
        internal override void SetQuery <T>(TagQuery query, T val, bool bypassCheck)
        {
            TagQueryToken token = null;

            if (!bypassCheck)
            {
                token = query.Next();

                if (token != null && !token.Name.Equals(Name))
                {
                    return;
                }
            }

            TagQueryToken nextToken = query.Peek();

            if (nextToken != null)
            {
                NbtTag nextTag = Get(nextToken.Name);
                if (nextTag == null)
                {
                    return;
                }

                nextTag.SetQuery <T>(query, val, false);
                Set(nextToken.Name, nextTag);
                return;
            }
        }
示例#2
0
        internal override T Query <T>(TagQuery query, bool bypassCheck)
        {
            TagQueryToken token = null;

            if (!bypassCheck)
            {
                token = query.Next();

                if (token != null && !token.Name.Equals(Name))
                {
                    return(null);
                }
            }

            TagQueryToken nextToken = query.Peek();

            if (nextToken != null)
            {
                NbtTag nextTag = Get(nextToken.Name);
                if (nextTag == null)
                {
                    return(null);
                }

                return(nextTag.Query <T>(query));
            }

            return((T)((NbtTag)this));
        }
示例#3
0
        public void Set(int tagIdx, NbtTag tag)
        {
            if (tagIdx > Tags.Count)
            {
                throw new IndexOutOfRangeException();
            }

            Tags[tagIdx] = tag;
        }
示例#4
0
        public void Set(string tagName, NbtTag tag)
        {
            if (!mTags.ContainsKey(tagName))
            {
                mTags.Add(tagName, tag);
            }

            tag.Name       = tagName; // Just make sure.
            mTags[tagName] = tag;
        }
示例#5
0
        public void Set(int tagIdx, NbtTag value)
        {
            if (tagIdx >= mTagIndices.Count)
            {
                throw new KeyNotFoundException();
            }

            string k = mTagIndices[tagIdx];

            Set(k, value);
        }
示例#6
0
        public void Add(string tagName, NbtTag tag)
        {
            if (mTags.ContainsKey(tagName))
            {
                Set(tagName, tag);
                return;
            }

            tag.Name = tagName; // Just make sure.
            mTags.Add(tagName, tag);
            mTagIndices.Add(tagName);
        }
示例#7
0
 public void Set(string tagName, NbtTag tag)
 {
     foreach (var tg in Tags)
     {
         if (tg.Name.Equals(tagName))
         {
             int idx = Tags.IndexOf(tg);
             Tags[idx] = tag;
             if (TagCache.ContainsKey(tagName))
             {
                 TagCache[tagName] = tag;
             }
             return;
         }
     }
 }
示例#8
0
文件: NbtList.cs 项目: xorle/MineEdit
 public void Set(int tagIdx, NbtTag tag)
 {
     Tags[tagIdx] = tag;
 }
示例#9
0
文件: NbtList.cs 项目: xorle/MineEdit
 public void Add(NbtTag tag)
 {
     Tags.Add(tag);
 }
示例#10
0
 public void Remove(NbtTag tag)
 {
     Remove(tag.Name);
 }
示例#11
0
 public void Add(NbtTag tag)
 {
     Add(tag.Name, tag);
 }