public static Loot DeserializeLength(Stream stream, int length, Loot instance, bool isDelta) { long position = stream.Position + (long)length; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num != 10) { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.contents != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.contents, isDelta); } else { instance.contents = ItemContainer.DeserializeLengthDelimited(stream); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
public static UpdateItemContainer Deserialize(Stream stream, UpdateItemContainer instance, bool isDelta) { if (!isDelta && instance.container == null) { instance.container = Pool.Get <List <ItemContainer> >(); } while (true) { int num = stream.ReadByte(); if (num == -1) { break; } if (num == 8) { instance.type = (int)ProtocolParser.ReadUInt64(stream); } else if (num == 18) { instance.container.Add(ItemContainer.DeserializeLengthDelimited(stream)); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } return(instance); }
public static Loot Deserialize(Stream stream, Loot instance, bool isDelta) { while (true) { int num = stream.ReadByte(); if (num == -1) { break; } if (num != 10) { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.contents != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.contents, isDelta); } else { instance.contents = ItemContainer.DeserializeLengthDelimited(stream); } } return(instance); }
public static ItemContainer DeserializeLengthDelimited(Stream stream) { ItemContainer itemContainer = Pool.Get <ItemContainer>(); ItemContainer.DeserializeLengthDelimited(stream, itemContainer, false); return(itemContainer); }
public static PlayerInventory DeserializeLengthDelimited(Stream stream, PlayerInventory instance, bool isDelta) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num == 10) { if (instance.invMain != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.invMain, isDelta); } else { instance.invMain = ItemContainer.DeserializeLengthDelimited(stream); } } else if (num == 18) { if (instance.invBelt != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.invBelt, isDelta); } else { instance.invBelt = ItemContainer.DeserializeLengthDelimited(stream); } } else if (num != 26) { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.invWear != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.invWear, isDelta); } else { instance.invWear = ItemContainer.DeserializeLengthDelimited(stream); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
public static PlayerInventory Deserialize(Stream stream, PlayerInventory instance, bool isDelta) { while (true) { int num = stream.ReadByte(); if (num == -1) { break; } if (num == 10) { if (instance.invMain != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.invMain, isDelta); } else { instance.invMain = ItemContainer.DeserializeLengthDelimited(stream); } } else if (num == 18) { if (instance.invBelt != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.invBelt, isDelta); } else { instance.invBelt = ItemContainer.DeserializeLengthDelimited(stream); } } else if (num != 26) { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.invWear != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.invWear, isDelta); } else { instance.invWear = ItemContainer.DeserializeLengthDelimited(stream); } } return(instance); }
public static ResourceExtractor DeserializeLengthDelimited(Stream stream, ResourceExtractor instance, bool isDelta) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num == 10) { if (instance.fuelContents != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.fuelContents, isDelta); } else { instance.fuelContents = ItemContainer.DeserializeLengthDelimited(stream); } } else if (num != 18) { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.outputContents != null) { ItemContainer.DeserializeLengthDelimited(stream, instance.outputContents, isDelta); } else { instance.outputContents = ItemContainer.DeserializeLengthDelimited(stream); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
public static PlayerUpdateLoot DeserializeLengthDelimited(Stream stream, PlayerUpdateLoot instance, bool isDelta) { if (!isDelta && instance.containers == null) { instance.containers = Pool.Get <List <ItemContainer> >(); } long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num == 8) { instance.itemID = ProtocolParser.ReadUInt32(stream); } else if (num == 16) { instance.entityID = ProtocolParser.ReadUInt32(stream); } else if (num == 26) { instance.containers.Add(ItemContainer.DeserializeLengthDelimited(stream)); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }
public static UpdateItemContainer DeserializeLength(Stream stream, int length, UpdateItemContainer instance, bool isDelta) { if (!isDelta && instance.container == null) { instance.container = Pool.Get <List <ItemContainer> >(); } long position = stream.Position + (long)length; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num == 8) { instance.type = (int)ProtocolParser.ReadUInt64(stream); } else if (num == 18) { instance.container.Add(ItemContainer.DeserializeLengthDelimited(stream)); } else { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }