public static SendMessageNotification DeserializeLengthDelimited(Stream stream, SendMessageNotification instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(SendMessageNotification.Deserialize(stream, instance, position));
        }
        public static SendMessageNotification DeserializeLengthDelimited(Stream stream)
        {
            SendMessageNotification sendMessageNotification = new SendMessageNotification();

            SendMessageNotification.DeserializeLengthDelimited(stream, sendMessageNotification);
            return(sendMessageNotification);
        }
Esempio n. 3
0
        public static SendMessageNotification DeserializeLengthDelimited(Stream stream, SendMessageNotification instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(SendMessageNotification.Deserialize(stream, instance, num));
        }
Esempio n. 4
0
 public static SendMessageNotification Deserialize(Stream stream, SendMessageNotification instance, long limit)
 {
     instance.RequiredPrivileges = 0UL;
     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.RequiredPrivileges = ProtocolParser.ReadUInt64(stream);
                 }
             }
             else if (instance.Message == null)
             {
                 instance.Message = Message.DeserializeLengthDelimited(stream);
             }
             else
             {
                 Message.DeserializeLengthDelimited(stream, instance.Message);
             }
         }
         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 void Serialize(Stream stream, SendMessageNotification instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.Message == null)
     {
         throw new ArgumentNullException("Message", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.Message.GetSerializedSize());
     bnet.protocol.channel.Message.Serialize(stream, instance.Message);
     if (instance.HasRequiredPrivileges)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt64(stream, instance.RequiredPrivileges);
     }
 }
        public override bool Equals(object obj)
        {
            SendMessageNotification sendMessageNotification = obj as SendMessageNotification;

            if (sendMessageNotification == null)
            {
                return(false);
            }
            if (this.HasAgentId != sendMessageNotification.HasAgentId || this.HasAgentId && !this.AgentId.Equals(sendMessageNotification.AgentId))
            {
                return(false);
            }
            if (!this.Message.Equals(sendMessageNotification.Message))
            {
                return(false);
            }
            if (this.HasRequiredPrivileges == sendMessageNotification.HasRequiredPrivileges && (!this.HasRequiredPrivileges || this.RequiredPrivileges.Equals(sendMessageNotification.RequiredPrivileges)))
            {
                return(true);
            }
            return(false);
        }
 public static SendMessageNotification Deserialize(Stream stream, SendMessageNotification instance, long limit)
 {
     instance.RequiredPrivileges = (ulong)0;
     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)
             {
                 if (num == 24)
                 {
                     instance.RequiredPrivileges = ProtocolParser.ReadUInt64(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 (instance.Message != null)
             {
                 bnet.protocol.channel.Message.DeserializeLengthDelimited(stream, instance.Message);
             }
             else
             {
                 instance.Message = bnet.protocol.channel.Message.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static SendMessageNotification Deserialize(Stream stream, SendMessageNotification instance)
 {
     return(SendMessageNotification.Deserialize(stream, instance, (long)-1));
 }
 public void Deserialize(Stream stream)
 {
     SendMessageNotification.Deserialize(stream, this);
 }
Esempio n. 10
0
        public override bool Equals(object obj)
        {
            SendMessageNotification sendMessageNotification = obj as SendMessageNotification;

            return(sendMessageNotification != null && this.HasAgentId == sendMessageNotification.HasAgentId && (!this.HasAgentId || this.AgentId.Equals(sendMessageNotification.AgentId)) && this.Message.Equals(sendMessageNotification.Message) && this.HasRequiredPrivileges == sendMessageNotification.HasRequiredPrivileges && (!this.HasRequiredPrivileges || this.RequiredPrivileges.Equals(sendMessageNotification.RequiredPrivileges)));
        }