public static PlayerLeftNotification DeserializeLengthDelimited(Stream stream) { PlayerLeftNotification playerLeftNotification = new PlayerLeftNotification(); PlayerLeftNotification.DeserializeLengthDelimited(stream, playerLeftNotification); return(playerLeftNotification); }
public static PlayerLeftNotification DeserializeLengthDelimited(Stream stream, PlayerLeftNotification instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.Position; return(PlayerLeftNotification.Deserialize(stream, instance, num)); }
public static PlayerLeftNotification Deserialize(Stream stream, PlayerLeftNotification instance, long limit) { instance.Reason = 1u; while (limit < 0L || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else if (num != 10) { if (num != 18) { if (num != 24) { Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 0u) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else { instance.Reason = ProtocolParser.ReadUInt32(stream); } } else if (instance.MemberId == null) { instance.MemberId = EntityId.DeserializeLengthDelimited(stream); } else { EntityId.DeserializeLengthDelimited(stream, instance.MemberId); } } else if (instance.GameHandle == null) { instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream); } else { GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle); } } if (stream.Position == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static void Serialize(Stream stream, PlayerLeftNotification instance) { if (instance.GameHandle == null) { throw new ArgumentNullException("GameHandle", "Required by proto specification."); } stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize()); GameHandle.Serialize(stream, instance.GameHandle); if (instance.MemberId == null) { throw new ArgumentNullException("MemberId", "Required by proto specification."); } stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.MemberId.GetSerializedSize()); EntityId.Serialize(stream, instance.MemberId); if (instance.HasReason) { stream.WriteByte(24); ProtocolParser.WriteUInt32(stream, instance.Reason); } }
public override bool Equals(object obj) { PlayerLeftNotification playerLeftNotification = obj as PlayerLeftNotification; if (playerLeftNotification == null) { return(false); } if (!this.GameHandle.Equals(playerLeftNotification.GameHandle)) { return(false); } if (!this.MemberId.Equals(playerLeftNotification.MemberId)) { return(false); } if (this.HasReason == playerLeftNotification.HasReason && (!this.HasReason || this.Reason.Equals(playerLeftNotification.Reason))) { return(true); } return(false); }
public static PlayerLeftNotification Deserialize(Stream stream, PlayerLeftNotification instance) { return(PlayerLeftNotification.Deserialize(stream, instance, -1L)); }
public void Deserialize(Stream stream) { PlayerLeftNotification.Deserialize(stream, this); }
public override bool Equals(object obj) { PlayerLeftNotification playerLeftNotification = obj as PlayerLeftNotification; return(playerLeftNotification != null && this.GameHandle.Equals(playerLeftNotification.GameHandle) && this.MemberId.Equals(playerLeftNotification.MemberId) && this.HasReason == playerLeftNotification.HasReason && (!this.HasReason || this.Reason.Equals(playerLeftNotification.Reason))); }
public static PlayerLeftNotification Deserialize(Stream stream, PlayerLeftNotification instance, long limit) { instance.Reason = 1; while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } else if (num == 10) { if (instance.GameHandle != null) { bnet.protocol.game_master.GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle); } else { instance.GameHandle = bnet.protocol.game_master.GameHandle.DeserializeLengthDelimited(stream); } } else if (num != 18) { if (num == 24) { instance.Reason = ProtocolParser.ReadUInt32(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); } } else if (instance.MemberId != null) { EntityId.DeserializeLengthDelimited(stream, instance.MemberId); } else { instance.MemberId = EntityId.DeserializeLengthDelimited(stream); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }