Пример #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
 public void Set(int tagIdx, NbtTag tag)
 {
     Tags[tagIdx] = tag;
 }
Пример #9
0
 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);
 }