Esempio n. 1
0
        public static SetRolesRequest DeserializeLengthDelimited(Stream stream, SetRolesRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(SetRolesRequest.Deserialize(stream, instance, num));
        }
Esempio n. 2
0
        public static SetRolesRequest DeserializeLengthDelimited(Stream stream)
        {
            SetRolesRequest setRolesRequest = new SetRolesRequest();

            SetRolesRequest.DeserializeLengthDelimited(stream, setRolesRequest);
            return(setRolesRequest);
        }
 public static void Serialize(Stream stream, SetRolesRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.Role.Count > 0)
     {
         stream.WriteByte(18);
         uint num = 0;
         foreach (uint role in instance.Role)
         {
             num += ProtocolParser.SizeOfUInt32(role);
         }
         ProtocolParser.WriteUInt32(stream, num);
         foreach (uint role1 in instance.Role)
         {
             ProtocolParser.WriteUInt32(stream, role1);
         }
     }
     if (instance.MemberId.Count > 0)
     {
         foreach (EntityId memberId in instance.MemberId)
         {
             stream.WriteByte(26);
             ProtocolParser.WriteUInt32(stream, memberId.GetSerializedSize());
             EntityId.Serialize(stream, memberId);
         }
     }
 }
        public static SetRolesRequest DeserializeLengthDelimited(Stream stream, SetRolesRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(SetRolesRequest.Deserialize(stream, instance, position));
        }
Esempio n. 5
0
 public static void Serialize(Stream stream, SetRolesRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.Role.get_Count() > 0)
     {
         stream.WriteByte(18);
         uint num = 0u;
         using (List <uint> .Enumerator enumerator = instance.Role.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 uint current = enumerator.get_Current();
                 num += ProtocolParser.SizeOfUInt32(current);
             }
         }
         ProtocolParser.WriteUInt32(stream, num);
         using (List <uint> .Enumerator enumerator2 = instance.Role.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 uint current2 = enumerator2.get_Current();
                 ProtocolParser.WriteUInt32(stream, current2);
             }
         }
     }
     if (instance.MemberId.get_Count() > 0)
     {
         using (List <EntityId> .Enumerator enumerator3 = instance.MemberId.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 EntityId current3 = enumerator3.get_Current();
                 stream.WriteByte(26);
                 ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                 EntityId.Serialize(stream, current3);
             }
         }
     }
 }
Esempio n. 6
0
        public override bool Equals(object obj)
        {
            SetRolesRequest setRolesRequest = obj as SetRolesRequest;

            if (setRolesRequest == null)
            {
                return(false);
            }
            if (this.HasAgentId != setRolesRequest.HasAgentId || (this.HasAgentId && !this.AgentId.Equals(setRolesRequest.AgentId)))
            {
                return(false);
            }
            if (this.Role.get_Count() != setRolesRequest.Role.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Role.get_Count(); i++)
            {
                if (!this.Role.get_Item(i).Equals(setRolesRequest.Role.get_Item(i)))
                {
                    return(false);
                }
            }
            if (this.MemberId.get_Count() != setRolesRequest.MemberId.get_Count())
            {
                return(false);
            }
            for (int j = 0; j < this.MemberId.get_Count(); j++)
            {
                if (!this.MemberId.get_Item(j).Equals(setRolesRequest.MemberId.get_Item(j)))
                {
                    return(false);
                }
            }
            return(true);
        }
        public override bool Equals(object obj)
        {
            SetRolesRequest setRolesRequest = obj as SetRolesRequest;

            if (setRolesRequest == null)
            {
                return(false);
            }
            if (this.HasAgentId != setRolesRequest.HasAgentId || this.HasAgentId && !this.AgentId.Equals(setRolesRequest.AgentId))
            {
                return(false);
            }
            if (this.Role.Count != setRolesRequest.Role.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Role.Count; i++)
            {
                if (!this.Role[i].Equals(setRolesRequest.Role[i]))
                {
                    return(false);
                }
            }
            if (this.MemberId.Count != setRolesRequest.MemberId.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.MemberId.Count; j++)
            {
                if (!this.MemberId[j].Equals(setRolesRequest.MemberId[j]))
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 8
0
 public static SetRolesRequest Deserialize(Stream stream, SetRolesRequest instance)
 {
     return(SetRolesRequest.Deserialize(stream, instance, -1L));
 }
Esempio n. 9
0
 public void Deserialize(Stream stream)
 {
     SetRolesRequest.Deserialize(stream, this);
 }
Esempio n. 10
0
 public static SetRolesRequest Deserialize(Stream stream, SetRolesRequest instance, long limit)
 {
     if (instance.Role == null)
     {
         instance.Role = new List <uint>();
     }
     if (instance.MemberId == null)
     {
         instance.MemberId = new List <EntityId>();
     }
     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.MemberId.Add(EntityId.DeserializeLengthDelimited(stream));
                     }
                 }
                 else
                 {
                     long num3 = (long)((ulong)ProtocolParser.ReadUInt32(stream));
                     num3 += stream.get_Position();
                     while (stream.get_Position() < num3)
                     {
                         instance.Role.Add(ProtocolParser.ReadUInt32(stream));
                     }
                     if (stream.get_Position() != num3)
                     {
                         throw new ProtocolBufferException("Read too many bytes in packed data");
                     }
                 }
             }
             else if (instance.AgentId == null)
             {
                 instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static SetRolesRequest Deserialize(Stream stream, SetRolesRequest instance, long limit)
 {
     if (instance.Role == null)
     {
         instance.Role = new List <uint>();
     }
     if (instance.MemberId == null)
     {
         instance.MemberId = new List <EntityId>();
     }
     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.AgentId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
                 }
                 else
                 {
                     instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 18)
             {
                 long position = (long)ProtocolParser.ReadUInt32(stream);
                 position += stream.Position;
                 while (stream.Position < position)
                 {
                     instance.Role.Add(ProtocolParser.ReadUInt32(stream));
                 }
                 if (stream.Position != position)
                 {
                     throw new ProtocolBufferException("Read too many bytes in packed data");
                 }
             }
             else if (num == 26)
             {
                 instance.MemberId.Add(EntityId.DeserializeLengthDelimited(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);
 }