public static void Serialize(Stream stream, UpdateMemberStateNotification instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.StateChange.Count > 0)
     {
         foreach (Member member in instance.StateChange)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, member.GetSerializedSize());
             Member.Serialize(stream, member);
         }
     }
     if (instance.RemovedRole.Count > 0)
     {
         stream.WriteByte(26);
         uint num = 0u;
         foreach (uint val in instance.RemovedRole)
         {
             num += ProtocolParser.SizeOfUInt32(val);
         }
         ProtocolParser.WriteUInt32(stream, num);
         foreach (uint val2 in instance.RemovedRole)
         {
             ProtocolParser.WriteUInt32(stream, val2);
         }
     }
 }
        public static UpdateMemberStateNotification DeserializeLengthDelimited(Stream stream, UpdateMemberStateNotification instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(UpdateMemberStateNotification.Deserialize(stream, instance, num));
        }
        public static UpdateMemberStateNotification DeserializeLengthDelimited(Stream stream)
        {
            UpdateMemberStateNotification updateMemberStateNotification = new UpdateMemberStateNotification();

            UpdateMemberStateNotification.DeserializeLengthDelimited(stream, updateMemberStateNotification);
            return(updateMemberStateNotification);
        }
 public static void Serialize(Stream stream, UpdateMemberStateNotification instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.StateChange.get_Count() > 0)
     {
         using (List <Member> .Enumerator enumerator = instance.StateChange.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Member current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 Member.Serialize(stream, current);
             }
         }
     }
     if (instance.RemovedRole.get_Count() > 0)
     {
         stream.WriteByte(26);
         uint num = 0u;
         using (List <uint> .Enumerator enumerator2 = instance.RemovedRole.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 uint current2 = enumerator2.get_Current();
                 num += ProtocolParser.SizeOfUInt32(current2);
             }
         }
         ProtocolParser.WriteUInt32(stream, num);
         using (List <uint> .Enumerator enumerator3 = instance.RemovedRole.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 uint current3 = enumerator3.get_Current();
                 ProtocolParser.WriteUInt32(stream, current3);
             }
         }
     }
 }
        public override bool Equals(object obj)
        {
            UpdateMemberStateNotification updateMemberStateNotification = obj as UpdateMemberStateNotification;

            if (updateMemberStateNotification == null)
            {
                return(false);
            }
            if (this.HasAgentId != updateMemberStateNotification.HasAgentId || (this.HasAgentId && !this.AgentId.Equals(updateMemberStateNotification.AgentId)))
            {
                return(false);
            }
            if (this.StateChange.Count != updateMemberStateNotification.StateChange.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.StateChange.Count; i++)
            {
                if (!this.StateChange[i].Equals(updateMemberStateNotification.StateChange[i]))
                {
                    return(false);
                }
            }
            if (this.RemovedRole.Count != updateMemberStateNotification.RemovedRole.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.RemovedRole.Count; j++)
            {
                if (!this.RemovedRole[j].Equals(updateMemberStateNotification.RemovedRole[j]))
                {
                    return(false);
                }
            }
            return(true);
        }
 public void Serialize(Stream stream)
 {
     UpdateMemberStateNotification.Serialize(stream, this);
 }
 public static UpdateMemberStateNotification Deserialize(Stream stream, UpdateMemberStateNotification instance, long limit)
 {
     if (instance.StateChange == null)
     {
         instance.StateChange = new List <Member>();
     }
     if (instance.RemovedRole == null)
     {
         instance.RemovedRole = new List <uint>();
     }
     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)
                 {
                     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
                 {
                     long num2 = (long)((ulong)ProtocolParser.ReadUInt32(stream));
                     num2 += stream.Position;
                     while (stream.Position < num2)
                     {
                         instance.RemovedRole.Add(ProtocolParser.ReadUInt32(stream));
                     }
                     if (stream.Position != num2)
                     {
                         throw new ProtocolBufferException("Read too many bytes in packed data");
                     }
                 }
             }
             else
             {
                 instance.StateChange.Add(Member.DeserializeLengthDelimited(stream));
             }
         }
         else if (instance.AgentId == null)
         {
             instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
         }
         else
         {
             EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static UpdateMemberStateNotification Deserialize(Stream stream, UpdateMemberStateNotification instance)
 {
     return(UpdateMemberStateNotification.Deserialize(stream, instance, -1L));
 }