Example #1
0
        public static TagIntArray Read(EndianBinaryReader r)
        {
            int length = r.ReadInt32();
            //Not sure if length is in bytes or ints
            TagIntArray t = new TagIntArray();

            t.IntArray = new int[length];
            for (int n = 0; n < length; n++)
            {
                t.IntArray [n] = r.ReadInt32();
            }
            return(t);
        }
Example #2
0
        public static Tag Read(EndianBinaryReader r)
        {
            byte tagID = r.ReadByte();

            switch (tagID)
            {
            case 0:
                return(TagList <TagEnd> .ReadList(r));

            case 1:
                return(TagList <TagByte> .ReadList(r));

            case 2:
                return(TagList <TagShort> .ReadList(r));

            case 3:
                return(TagList <TagInt> .ReadList(r));

            case 4:
                return(TagList <TagLong> .ReadList(r));

            case 5:
                return(TagList <TagFloat> .ReadList(r));

            case 6:
                return(TagList <TagDouble> .ReadList(r));

            case 7:
                return(TagList <TagByteArray> .ReadList(r));

            case 8:
                return(TagList <TagString> .ReadList(r));

            case 9:
                throw new NotImplementedException();

            case 10:
                return(TagList <TagCompound> .ReadList(r));

            case 11:
                return(TagIntArray.Read(r));

            default:
                throw new NotImplementedException("NBT Type: " + tagID);
            }
        }
Example #3
0
        public static Tag ReadTagType(EndianBinaryReader r, byte type)
        {
            switch (type)
            {
            case 0:
                return(TagEnd.Read(r));

            case 1:
                return(TagByte.Read(r));

            case 2:
                return(TagShort.Read(r));

            case 3:
                return(TagInt.Read(r));

            case 4:
                return(TagLong.Read(r));

            case 5:
                return(TagFloat.Read(r));

            case 6:
                return(TagDouble.Read(r));

            case 7:
                return(TagByteArray.Read(r));

            case 8:
                return(TagString.Read(r));

            case 9:
                return(TagListReader.Read(r));

            case 10:
                return(TagCompound.Read(r));

            case 11:
                return(TagIntArray.Read(r));

            default:
                throw new NotImplementedException("NBT Tag type: " + type);
            }
        }