public static AssignRoleRequest DeserializeLengthDelimited(Stream stream)
        {
            AssignRoleRequest assignRoleRequest = new AssignRoleRequest();

            AssignRoleRequest.DeserializeLengthDelimited(stream, assignRoleRequest);
            return(assignRoleRequest);
        }
        public static AssignRoleRequest DeserializeLengthDelimited(Stream stream, AssignRoleRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(AssignRoleRequest.Deserialize(stream, instance, num));
        }
        public override bool Equals(object obj)
        {
            AssignRoleRequest assignRoleRequest = obj as AssignRoleRequest;

            if (assignRoleRequest == null)
            {
                return(false);
            }
            if (this.HasAgentId != assignRoleRequest.HasAgentId || (this.HasAgentId && !this.AgentId.Equals(assignRoleRequest.AgentId)))
            {
                return(false);
            }
            if (!this.TargetId.Equals(assignRoleRequest.TargetId))
            {
                return(false);
            }
            if (this.Role.get_Count() != assignRoleRequest.Role.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Role.get_Count(); i++)
            {
                if (!this.Role.get_Item(i).Equals(assignRoleRequest.Role.get_Item(i)))
                {
                    return(false);
                }
            }
            return(true);
        }
 public static void Serialize(Stream stream, AssignRoleRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     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.Role.get_Count() > 0)
     {
         using (List <int> .Enumerator enumerator = instance.Role.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 int current = enumerator.get_Current();
                 stream.WriteByte(24);
                 ProtocolParser.WriteUInt64(stream, (ulong)((long)current));
             }
         }
     }
 }
Example #5
0
 public static AssignRoleRequest Deserialize(Stream stream, AssignRoleRequest instance, long limit)
 {
     if (instance.Role == null)
     {
         instance.Role = new List <int>();
     }
     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 != 24)
                 {
                     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.Role.Add((int)ProtocolParser.ReadUInt64(stream));
                 }
             }
             else if (instance.TargetId == null)
             {
                 instance.TargetId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.TargetId);
             }
         }
         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 AssignRoleRequest DeserializeLengthDelimited(Stream stream, AssignRoleRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(AssignRoleRequest.Deserialize(stream, instance, position));
        }
Example #7
0
 public static void Serialize(Stream stream, AssignRoleRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     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.Role.Count > 0)
     {
         foreach (int num in instance.Role)
         {
             stream.WriteByte(24);
             ProtocolParser.WriteUInt64(stream, (ulong)((long)num));
         }
     }
 }
 public static AssignRoleRequest Deserialize(Stream stream, AssignRoleRequest instance)
 {
     return(AssignRoleRequest.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     AssignRoleRequest.Deserialize(stream, this);
 }