Example #1
0
        public static JoinChannelRequest DeserializeLengthDelimited(Stream stream, JoinChannelRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(JoinChannelRequest.Deserialize(stream, instance, num));
        }
        public static JoinChannelRequest DeserializeLengthDelimited(Stream stream, JoinChannelRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(JoinChannelRequest.Deserialize(stream, instance, position));
        }
Example #3
0
        public static JoinChannelRequest DeserializeLengthDelimited(Stream stream)
        {
            JoinChannelRequest joinChannelRequest = new JoinChannelRequest();

            JoinChannelRequest.DeserializeLengthDelimited(stream, joinChannelRequest);
            return(joinChannelRequest);
        }
Example #4
0
 public static void Serialize(Stream stream, JoinChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.HasMemberState)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.MemberState);
     }
     if (instance.ChannelId == null)
     {
         throw new ArgumentNullException("ChannelId", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
     EntityId.Serialize(stream, instance.ChannelId);
     stream.WriteByte(32);
     ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     if (instance.FriendAccountId.get_Count() > 0)
     {
         using (List <EntityId> .Enumerator enumerator = instance.FriendAccountId.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 EntityId current = enumerator.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 EntityId.Serialize(stream, current);
             }
         }
     }
     if (instance.HasLocalSubscriber)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.LocalSubscriber);
     }
 }
        public override bool Equals(object obj)
        {
            JoinChannelRequest joinChannelRequest = obj as JoinChannelRequest;

            if (joinChannelRequest == null)
            {
                return(false);
            }
            if (this.HasAgentIdentity != joinChannelRequest.HasAgentIdentity || this.HasAgentIdentity && !this.AgentIdentity.Equals(joinChannelRequest.AgentIdentity))
            {
                return(false);
            }
            if (this.HasMemberState != joinChannelRequest.HasMemberState || this.HasMemberState && !this.MemberState.Equals(joinChannelRequest.MemberState))
            {
                return(false);
            }
            if (!this.ChannelId.Equals(joinChannelRequest.ChannelId))
            {
                return(false);
            }
            if (!this.ObjectId.Equals(joinChannelRequest.ObjectId))
            {
                return(false);
            }
            if (this.FriendAccountId.Count != joinChannelRequest.FriendAccountId.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.FriendAccountId.Count; i++)
            {
                if (!this.FriendAccountId[i].Equals(joinChannelRequest.FriendAccountId[i]))
                {
                    return(false);
                }
            }
            if (this.HasLocalSubscriber == joinChannelRequest.HasLocalSubscriber && (!this.HasLocalSubscriber || this.LocalSubscriber.Equals(joinChannelRequest.LocalSubscriber)))
            {
                return(true);
            }
            return(false);
        }
 public static void Serialize(Stream stream, JoinChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.HasMemberState)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.MemberState);
     }
     if (instance.ChannelId == null)
     {
         throw new ArgumentNullException("ChannelId", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
     EntityId.Serialize(stream, instance.ChannelId);
     stream.WriteByte(32);
     ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     if (instance.FriendAccountId.Count > 0)
     {
         foreach (EntityId entityId in instance.FriendAccountId)
         {
             stream.WriteByte(42);
             ProtocolParser.WriteUInt32(stream, entityId.GetSerializedSize());
             EntityId.Serialize(stream, entityId);
         }
     }
     if (instance.HasLocalSubscriber)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.LocalSubscriber);
     }
 }
Example #7
0
 public void Serialize(Stream stream)
 {
     JoinChannelRequest.Serialize(stream, this);
 }
Example #8
0
 public static JoinChannelRequest Deserialize(Stream stream, JoinChannelRequest instance, long limit)
 {
     if (instance.FriendAccountId == null)
     {
         instance.FriendAccountId = new List <EntityId>();
     }
     instance.LocalSubscriber = true;
     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)
                     {
                         if (num2 != 32)
                         {
                             if (num2 != 42)
                             {
                                 if (num2 != 48)
                                 {
                                     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.LocalSubscriber = ProtocolParser.ReadBool(stream);
                                 }
                             }
                             else
                             {
                                 instance.FriendAccountId.Add(EntityId.DeserializeLengthDelimited(stream));
                             }
                         }
                         else
                         {
                             instance.ObjectId = ProtocolParser.ReadUInt64(stream);
                         }
                     }
                     else if (instance.ChannelId == null)
                     {
                         instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
                     }
                 }
                 else if (instance.MemberState == null)
                 {
                     instance.MemberState = MemberState.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     MemberState.DeserializeLengthDelimited(stream, instance.MemberState);
                 }
             }
             else if (instance.AgentIdentity == null)
             {
                 instance.AgentIdentity = Identity.DeserializeLengthDelimited(stream);
             }
             else
             {
                 Identity.DeserializeLengthDelimited(stream, instance.AgentIdentity);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Example #9
0
 public static JoinChannelRequest Deserialize(Stream stream, JoinChannelRequest instance)
 {
     return(JoinChannelRequest.Deserialize(stream, instance, -1L));
 }
Example #10
0
 public override void JoinChannel(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel.JoinChannelRequest request, Action <bnet.protocol.channel.JoinChannelResponse> done)
 {
     throw new NotImplementedException();
 }
 public static JoinChannelRequest Deserialize(Stream stream, JoinChannelRequest instance, long limit)
 {
     if (instance.FriendAccountId == null)
     {
         instance.FriendAccountId = new List <EntityId>();
     }
     instance.LocalSubscriber = true;
     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.AgentIdentity != null)
                 {
                     Identity.DeserializeLengthDelimited(stream, instance.AgentIdentity);
                 }
                 else
                 {
                     instance.AgentIdentity = Identity.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 18)
             {
                 if (instance.MemberState != null)
                 {
                     bnet.protocol.channel.MemberState.DeserializeLengthDelimited(stream, instance.MemberState);
                 }
                 else
                 {
                     instance.MemberState = bnet.protocol.channel.MemberState.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 26)
             {
                 if (instance.ChannelId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
                 }
                 else
                 {
                     instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 32)
             {
                 instance.ObjectId = ProtocolParser.ReadUInt64(stream);
             }
             else if (num == 42)
             {
                 instance.FriendAccountId.Add(EntityId.DeserializeLengthDelimited(stream));
             }
             else if (num == 48)
             {
                 instance.LocalSubscriber = ProtocolParser.ReadBool(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);
 }