public static GameEndedNotification DeserializeLengthDelimited(Stream stream) { GameEndedNotification gameEndedNotification = new GameEndedNotification(); GameEndedNotification.DeserializeLengthDelimited(stream, gameEndedNotification); return(gameEndedNotification); }
public static GameEndedNotification DeserializeLengthDelimited(Stream stream, GameEndedNotification instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.Position; return(GameEndedNotification.Deserialize(stream, instance, num)); }
public static GameEndedNotification Deserialize(Stream stream, GameEndedNotification instance, long limit) { instance.Reason = 0; 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 (num == 16) { 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.GameHandle != null) { bnet.protocol.game_master.GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle); } else { instance.GameHandle = bnet.protocol.game_master.GameHandle.DeserializeLengthDelimited(stream); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public static GameEndedNotification Deserialize(Stream stream, GameEndedNotification instance, long limit) { instance.Reason = 0u; while (limit < 0L || stream.get_Position() < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else { int num2 = num; if (num2 != 10) { if (num2 != 16) { 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.GameHandle == null) { instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream); } else { GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static void Serialize(Stream stream, GameEndedNotification 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.HasReason) { stream.WriteByte(16); ProtocolParser.WriteUInt32(stream, instance.Reason); } }
public override bool Equals(object obj) { GameEndedNotification gameEndedNotification = obj as GameEndedNotification; if (gameEndedNotification == null) { return(false); } if (!this.GameHandle.Equals(gameEndedNotification.GameHandle)) { return(false); } if (this.HasReason == gameEndedNotification.HasReason && (!this.HasReason || this.Reason.Equals(gameEndedNotification.Reason))) { return(true); } return(false); }
public static GameEndedNotification Deserialize(Stream stream, GameEndedNotification instance) { return(GameEndedNotification.Deserialize(stream, instance, -1L)); }
public void Deserialize(Stream stream) { GameEndedNotification.Deserialize(stream, this); }
public override bool Equals(object obj) { GameEndedNotification gameEndedNotification = obj as GameEndedNotification; return(gameEndedNotification != null && this.GameHandle.Equals(gameEndedNotification.GameHandle) && this.HasReason == gameEndedNotification.HasReason && (!this.HasReason || this.Reason.Equals(gameEndedNotification.Reason))); }