Skip() public method

public Skip ( int bytesToSkip ) : void
bytesToSkip int
return void
Esempio n. 1
0
        void SkipValue()
        {
            // Make sure to check for "atValue" before calling this method
            switch (TagType)
            {
            case NbtTagType.Byte:
                reader.ReadByte();
                break;

            case NbtTagType.Short:
                reader.ReadInt16();
                break;

            case NbtTagType.Float:
            case NbtTagType.Int:
                reader.ReadInt32();
                break;

            case NbtTagType.Double:
            case NbtTagType.Long:
                reader.ReadInt64();
                break;

            case NbtTagType.ByteArray:
                reader.Skip(TagLength);
                break;

            case NbtTagType.IntArray:
                reader.Skip(sizeof(int) * TagLength);
                break;

            case NbtTagType.LongArray:
                reader.Skip(sizeof(long) * TagLength);
                break;

            case NbtTagType.String:
                reader.SkipString();
                break;

            default:
                throw new InvalidOperationException(NonValueTagError);
            }
            atValue    = false;
            valueCache = null;
        }
Esempio n. 2
0
        void SkipValue()
        {
            if (!atValue)
            {
                throw new NbtFormatException(NoValueToReadError);
            }
            switch (TagType)
            {
            case NbtTagType.Byte:
                reader.ReadByte();
                break;

            case NbtTagType.Short:
                reader.ReadInt16();
                break;

            case NbtTagType.Float:
            case NbtTagType.Int:
                reader.ReadInt32();
                break;

            case NbtTagType.Double:
            case NbtTagType.Long:
                reader.ReadInt64();
                break;

            case NbtTagType.ByteArray:
                reader.Skip(TagLength);
                break;

            case NbtTagType.IntArray:
                reader.Skip(sizeof(int) * TagLength);
                break;

            case NbtTagType.String:
                reader.SkipString();
                break;

            default:
                throw new InvalidOperationException(NonValueTagError);
            }
            atValue    = false;
            valueCache = null;
        }
Esempio n. 3
0
        internal override void SkipTag(NbtBinaryReader readStream)
        {
            int length = readStream.ReadInt32();

            if (length < 0)
            {
                throw new NbtFormatException("Negative length given in TAG_Int_Array");
            }
            readStream.Skip(length * sizeof(int));
        }
Esempio n. 4
0
        internal override bool ReadTag(NbtBinaryReader readStream)
        {
            int length = readStream.ReadInt32();

            if (length < 0)
            {
                throw new NbtFormatException("Negative length given in TAG_Byte_Array");
            }

            if (readStream.Selector != null && !readStream.Selector(this))
            {
                readStream.Skip(length);
                return(false);
            }
            Value = readStream.ReadBytes(length);
            return(true);
        }
Esempio n. 5
0
        internal override bool ReadTag(NbtBinaryReader readStream)
        {
            int length = readStream.ReadInt32();

            if (length < 0)
            {
                throw new NbtFormatException("Negative length given in TAG_Int_Array");
            }

            if (readStream.Selector != null && !readStream.Selector(this))
            {
                readStream.Skip(length * sizeof(int));
                return(false);
            }

            Value = new int[length];
            for (int i = 0; i < length; i++)
            {
                Value[i] = readStream.ReadInt32();
            }
            return(true);
        }
Esempio n. 6
0
 internal override void SkipTag(NbtBinaryReader readStream)
 {
     int length = readStream.ReadInt32();
     if (length < 0) {
         throw new NbtFormatException("Negative length given in TAG_Int_Array");
     }
     readStream.Skip(length*sizeof(int));
 }
Esempio n. 7
0
        internal override bool ReadTag(NbtBinaryReader readStream)
        {
            int length = readStream.ReadInt32();
            if (length < 0) {
                throw new NbtFormatException("Negative length given in TAG_Int_Array");
            }

            if (readStream.Selector != null && !readStream.Selector(this)) {
                readStream.Skip(length*sizeof(int));
                return false;
            }

            Value = new int[length];
            for (int i = 0; i < length; i++) {
                Value[i] = readStream.ReadInt32();
            }
            return true;
        }
Esempio n. 8
0
        internal override void SkipTag(NbtBinaryReader readStream)
        {
            // read list type, and make sure it's defined
            ListType = readStream.ReadTagType();

            int length = readStream.ReadInt32();

            if (length < 0)
            {
                throw new NbtFormatException("Negative list size given.");
            }

            switch (ListType)
            {
            case NbtTagType.Byte:
                readStream.Skip(length);
                break;

            case NbtTagType.Short:
                readStream.Skip(length * sizeof(short));
                break;

            case NbtTagType.Int:
                readStream.Skip(length * sizeof(int));
                break;

            case NbtTagType.Long:
                readStream.Skip(length * sizeof(long));
                break;

            case NbtTagType.Float:
                readStream.Skip(length * sizeof(float));
                break;

            case NbtTagType.Double:
                readStream.Skip(length * sizeof(double));
                break;

            default:
                for (int i = 0; i < length; i++)
                {
                    switch (listType)
                    {
                    case NbtTagType.ByteArray:
                        new NbtByteArray().SkipTag(readStream);
                        break;

                    case NbtTagType.String:
                        readStream.SkipString();
                        break;

                    case NbtTagType.List:
                        new NbtList().SkipTag(readStream);
                        break;

                    case NbtTagType.Compound:
                        new NbtCompound().SkipTag(readStream);
                        break;

                    case NbtTagType.IntArray:
                        new NbtIntArray().SkipTag(readStream);
                        break;
                    }
                }
                break;
            }
        }
Esempio n. 9
0
        internal override bool ReadTag( NbtBinaryReader readStream )
        {
            int length = readStream.ReadInt32();
            if( length < 0 ) {
                throw new NbtFormatException( "Negative length given in TAG_Byte_Array" );
            }

            if( readStream.Selector != null && !readStream.Selector( this ) ) {
                readStream.Skip( length );
                return false;
            }
            Value = readStream.ReadBytes( length );
            return true;
        }