Пример #1
0
        // Goes one step up the NBT file's hierarchy, restoring previous state
        void GoUp()
        {
            NbtReaderNode oldNode = nodes.Pop();

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

            Depth--;
        }
Пример #2
0
        // Goes one step down the NBT file's hierarchy, preserving current state
        void GoDown()
        {
            NbtReaderNode 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++;
        }
Пример #3
0
        // Goes one step down the NBT file's hierarchy, preserving current state
        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++;
        }