Exemple #1
0
        // Goes one step down the NBT file's hierarchy, preserving current state
        private void GoDown()
        {
            if (nodes == null)
            {
                nodes = new Stack <NbtReaderNode>();
            }
            var newNode = new NbtReaderNode
            {
                ListIndex       = ListIndex,
                ParentTagLength = ParentTagLength,
                ParentName      = ParentName,
                ParentTagType   = ParentTagType,
                ListType        = ListType
            };

            nodes.Push(newNode);

            ParentName      = TagName;
            ParentTagType   = TagType;
            ParentTagLength = TagLength;
            ListIndex       = 0;
            TagLength       = 0;

            Depth++;
        }
Exemple #2
0
        // Goes one step up the NBT file's hierarchy, restoring previous state
        private void GoUp()
        {
            NbtReaderNode oldNode = nodes.Pop();

            ParentName      = oldNode.ParentName;
            ParentTagType   = oldNode.ParentTagType;
            ParentTagLength = oldNode.ParentTagLength;
            ListIndex       = oldNode.ListIndex;
            ListType        = oldNode.ListType;
            TagLength       = 0;

            Depth--;
        }