public static void Serialize(Stream stream, ConnectResponse instance)
 {
     if (instance.ServerId == null)
     {
         throw new ArgumentNullException("ServerId", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.ServerId.GetSerializedSize());
     ProcessId.Serialize(stream, instance.ServerId);
     if (instance.HasClientId)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.ClientId.GetSerializedSize());
         ProcessId.Serialize(stream, instance.ClientId);
     }
     if (instance.HasBindResult)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.BindResult);
     }
     if (instance.HasBindResponse)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.BindResponse.GetSerializedSize());
         BindResponse.Serialize(stream, instance.BindResponse);
     }
     if (instance.HasContentHandleArray)
     {
         stream.WriteByte(42);
         ProtocolParser.WriteUInt32(stream, instance.ContentHandleArray.GetSerializedSize());
         ConnectionMeteringContentHandles.Serialize(stream, instance.ContentHandleArray);
     }
     if (instance.HasServerTime)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteUInt64(stream, instance.ServerTime);
     }
 }
 public void Serialize(Stream stream)
 {
     BindResponse.Serialize(stream, this);
 }