internal override bool ReadTag(NbtBinaryReader readStream) { if (readStream.Selector != null && !readStream.Selector(this)) { readStream.SkipString(); return(false); } Value = readStream.ReadString(); return(true); }
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; }
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; }
internal override void SkipTag(NbtBinaryReader readStream) { readStream.SkipString(); }
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; } }
internal override void SkipTag(NbtBinaryReader readStream) { while (true) { NbtTagType nextTag = readStream.ReadTagType(); NbtTag newTag; switch (nextTag) { case NbtTagType.End: return; case NbtTagType.Byte: newTag = new NbtByte(); break; case NbtTagType.Short: newTag = new NbtShort(); break; case NbtTagType.Int: newTag = new NbtInt(); break; case NbtTagType.Long: newTag = new NbtLong(); break; case NbtTagType.Float: newTag = new NbtFloat(); break; case NbtTagType.Double: newTag = new NbtDouble(); break; case NbtTagType.ByteArray: newTag = new NbtByteArray(); break; case NbtTagType.String: newTag = new NbtString(); break; case NbtTagType.List: newTag = new NbtList(); break; case NbtTagType.Compound: newTag = new NbtCompound(); break; case NbtTagType.IntArray: newTag = new NbtIntArray(); break; case NbtTagType.LongArray: newTag = new NbtLongArray(); break; default: throw new NbtFormatException("Unsupported tag type found in NBT_Compound: " + nextTag); } readStream.SkipString(); newTag.SkipTag(readStream); } }
internal override bool ReadTag( NbtBinaryReader readStream ) { if( readStream.Selector != null && !readStream.Selector( this ) ) { readStream.SkipString(); return false; } Value = readStream.ReadString(); return true; }
internal override void SkipTag( NbtBinaryReader readStream ) { readStream.SkipString(); }