Ejemplo n.º 1
0
        public static InvitationTarget DeserializeLengthDelimited(Stream stream)
        {
            InvitationTarget invitationTarget = new InvitationTarget();

            InvitationTarget.DeserializeLengthDelimited(stream, invitationTarget);
            return(invitationTarget);
        }
Ejemplo n.º 2
0
        public static InvitationTarget DeserializeLengthDelimited(Stream stream, InvitationTarget instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(InvitationTarget.Deserialize(stream, instance, num));
        }
 public static void Serialize(Stream stream, SendInvitationRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.TargetId == null)
     {
         throw new ArgumentNullException("TargetId", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.TargetId.GetSerializedSize());
     EntityId.Serialize(stream, instance.TargetId);
     if (instance.Params == null)
     {
         throw new ArgumentNullException("Params", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.Params.GetSerializedSize());
     InvitationParams.Serialize(stream, instance.Params);
     if (instance.HasAgentInfo)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.AgentInfo.GetSerializedSize());
         AccountInfo.Serialize(stream, instance.AgentInfo);
     }
     if (instance.HasTarget)
     {
         stream.WriteByte(42);
         ProtocolParser.WriteUInt32(stream, instance.Target.GetSerializedSize());
         InvitationTarget.Serialize(stream, instance.Target);
     }
 }
 public static InvitationTarget Deserialize(Stream stream, InvitationTarget instance, long limit)
 {
     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 != 18)
                 {
                     if (num2 != 26)
                     {
                         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.BattleTag = ProtocolParser.ReadString(stream);
                     }
                 }
                 else
                 {
                     instance.Email = ProtocolParser.ReadString(stream);
                 }
             }
             else if (instance.Identity == null)
             {
                 instance.Identity = Identity.DeserializeLengthDelimited(stream);
             }
             else
             {
                 Identity.DeserializeLengthDelimited(stream, instance.Identity);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static InvitationTarget Deserialize(Stream stream, InvitationTarget instance, long limit)
 {
     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.Identity != null)
                 {
                     bnet.protocol.Identity.DeserializeLengthDelimited(stream, instance.Identity);
                 }
                 else
                 {
                     instance.Identity = bnet.protocol.Identity.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 18)
             {
                 instance.Email = ProtocolParser.ReadString(stream);
             }
             else if (num == 26)
             {
                 instance.BattleTag = ProtocolParser.ReadString(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 (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Ejemplo n.º 6
0
 public static void Serialize(Stream stream, InvitationTarget instance)
 {
     if (instance.HasIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.Identity.GetSerializedSize());
         Identity.Serialize(stream, instance.Identity);
     }
     if (instance.HasEmail)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Email));
     }
     if (instance.HasBattleTag)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.BattleTag));
     }
 }
        public override bool Equals(object obj)
        {
            InvitationTarget invitationTarget = obj as InvitationTarget;

            if (invitationTarget == null)
            {
                return(false);
            }
            if (this.HasIdentity != invitationTarget.HasIdentity || this.HasIdentity && !this.Identity.Equals(invitationTarget.Identity))
            {
                return(false);
            }
            if (this.HasEmail != invitationTarget.HasEmail || this.HasEmail && !this.Email.Equals(invitationTarget.Email))
            {
                return(false);
            }
            if (this.HasBattleTag == invitationTarget.HasBattleTag && (!this.HasBattleTag || this.BattleTag.Equals(invitationTarget.BattleTag)))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 8
0
        public override bool Equals(object obj)
        {
            InvitationTarget invitationTarget = obj as InvitationTarget;

            return(invitationTarget != null && this.HasIdentity == invitationTarget.HasIdentity && (!this.HasIdentity || this.Identity.Equals(invitationTarget.Identity)) && this.HasEmail == invitationTarget.HasEmail && (!this.HasEmail || this.Email.Equals(invitationTarget.Email)) && this.HasBattleTag == invitationTarget.HasBattleTag && (!this.HasBattleTag || this.BattleTag.Equals(invitationTarget.BattleTag)));
        }
Ejemplo n.º 9
0
 public void Serialize(Stream stream)
 {
     InvitationTarget.Serialize(stream, this);
 }
Ejemplo n.º 10
0
 public static InvitationTarget Deserialize(Stream stream, InvitationTarget instance)
 {
     return(InvitationTarget.Deserialize(stream, instance, -1L));
 }
 public void SetTarget(InvitationTarget val)
 {
     this.Target = val;
 }
 public static SendInvitationRequest Deserialize(Stream stream, SendInvitationRequest instance, long limit)
 {
     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 != 26)
                 {
                     if (num != 34)
                     {
                         if (num != 42)
                         {
                             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 if (instance.Target == null)
                         {
                             instance.Target = InvitationTarget.DeserializeLengthDelimited(stream);
                         }
                         else
                         {
                             InvitationTarget.DeserializeLengthDelimited(stream, instance.Target);
                         }
                     }
                     else if (instance.AgentInfo == null)
                     {
                         instance.AgentInfo = AccountInfo.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         AccountInfo.DeserializeLengthDelimited(stream, instance.AgentInfo);
                     }
                 }
                 else if (instance.Params == null)
                 {
                     instance.Params = InvitationParams.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     InvitationParams.DeserializeLengthDelimited(stream, instance.Params);
                 }
             }
             else if (instance.TargetId == null)
             {
                 instance.TargetId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.TargetId);
             }
         }
         else if (instance.AgentIdentity == null)
         {
             instance.AgentIdentity = Identity.DeserializeLengthDelimited(stream);
         }
         else
         {
             Identity.DeserializeLengthDelimited(stream, instance.AgentIdentity);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }