fNbt.NbtBinaryReader.ReadTagType C# (CSharp) Method

ReadTagType() public method

public ReadTagType ( ) : NbtTagType
return NbtTagType
        public NbtTagType ReadTagType()
        {
            int type = ReadByte();
            if (type < 0) {
                throw new EndOfStreamException();
            } else if (type > (int)NbtTagType.IntArray) {
                throw new NbtFormatException("NBT tag type out of range: " + type);
            }
            return (NbtTagType)type;
        }

Usage Example

Beispiel #1
0
        static string GetRootNameInternal([NotNull] Stream stream, bool bigEndian)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            NbtBinaryReader reader = new NbtBinaryReader(stream, bigEndian);

            if (reader.ReadTagType() != NbtTagType.Compound)
            {
                throw new NbtFormatException("Given NBT stream does not start with a TAG_Compound");
            }

            return(reader.ReadString());
        }
All Usage Examples Of fNbt.NbtBinaryReader::ReadTagType