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

            position += stream.Position;
            return(FindChannelOptions.Deserialize(stream, instance, position));
        }
Ejemplo n.º 2
0
        public static FindChannelOptions DeserializeLengthDelimited(Stream stream, FindChannelOptions instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(FindChannelOptions.Deserialize(stream, instance, num));
        }
        public static FindChannelOptions DeserializeLengthDelimited(Stream stream)
        {
            FindChannelOptions findChannelOption = new FindChannelOptions();

            FindChannelOptions.DeserializeLengthDelimited(stream, findChannelOption);
            return(findChannelOption);
        }
 public static FindChannelRequest Deserialize(Stream stream, FindChannelRequest instance, long limit)
 {
     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)
             {
                 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.Options != null)
             {
                 FindChannelOptions.DeserializeLengthDelimited(stream, instance.Options);
             }
             else
             {
                 instance.Options = FindChannelOptions.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Ejemplo n.º 5
0
 public static FindChannelRequest Deserialize(Stream stream, FindChannelRequest instance, long limit)
 {
     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)
                 {
                     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 if (instance.Options == null)
                 {
                     instance.Options = FindChannelOptions.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     FindChannelOptions.DeserializeLengthDelimited(stream, instance.Options);
                 }
             }
             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");
 }
Ejemplo n.º 6
0
 public static void Serialize(Stream stream, FindChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.Options == null)
     {
         throw new ArgumentNullException("Options", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.Options.GetSerializedSize());
     FindChannelOptions.Serialize(stream, instance.Options);
 }
        public static void Serialize(Stream stream, FindChannelOptions instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasStartIndex)
            {
                stream.WriteByte(8);
                ProtocolParser.WriteUInt32(stream, instance.StartIndex);
            }
            if (instance.HasMaxResults)
            {
                stream.WriteByte(16);
                ProtocolParser.WriteUInt32(stream, instance.MaxResults);
            }
            if (instance.HasName)
            {
                stream.WriteByte(26);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Name));
            }
            if (instance.HasProgram)
            {
                stream.WriteByte(37);
                binaryWriter.Write(instance.Program);
            }
            if (instance.HasLocale)
            {
                stream.WriteByte(45);
                binaryWriter.Write(instance.Locale);
            }
            if (instance.HasCapacityFull)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt32(stream, instance.CapacityFull);
            }
            if (instance.AttributeFilter == null)
            {
                throw new ArgumentNullException("AttributeFilter", "Required by proto specification.");
            }
            stream.WriteByte(58);
            ProtocolParser.WriteUInt32(stream, instance.AttributeFilter.GetSerializedSize());
            bnet.protocol.attribute.AttributeFilter.Serialize(stream, instance.AttributeFilter);
            if (instance.HasChannelType)
            {
                stream.WriteByte(66);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.ChannelType));
            }
        }
        public override bool Equals(object obj)
        {
            FindChannelOptions findChannelOption = obj as FindChannelOptions;

            if (findChannelOption == null)
            {
                return(false);
            }
            if (this.HasStartIndex != findChannelOption.HasStartIndex || this.HasStartIndex && !this.StartIndex.Equals(findChannelOption.StartIndex))
            {
                return(false);
            }
            if (this.HasMaxResults != findChannelOption.HasMaxResults || this.HasMaxResults && !this.MaxResults.Equals(findChannelOption.MaxResults))
            {
                return(false);
            }
            if (this.HasName != findChannelOption.HasName || this.HasName && !this.Name.Equals(findChannelOption.Name))
            {
                return(false);
            }
            if (this.HasProgram != findChannelOption.HasProgram || this.HasProgram && !this.Program.Equals(findChannelOption.Program))
            {
                return(false);
            }
            if (this.HasLocale != findChannelOption.HasLocale || this.HasLocale && !this.Locale.Equals(findChannelOption.Locale))
            {
                return(false);
            }
            if (this.HasCapacityFull != findChannelOption.HasCapacityFull || this.HasCapacityFull && !this.CapacityFull.Equals(findChannelOption.CapacityFull))
            {
                return(false);
            }
            if (!this.AttributeFilter.Equals(findChannelOption.AttributeFilter))
            {
                return(false);
            }
            if (this.HasChannelType == findChannelOption.HasChannelType && (!this.HasChannelType || this.ChannelType.Equals(findChannelOption.ChannelType)))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 9
0
 public void SetOptions(FindChannelOptions val)
 {
     this.Options = val;
 }
 public void Serialize(Stream stream)
 {
     FindChannelOptions.Serialize(stream, this);
 }
        public static FindChannelOptions Deserialize(Stream stream, FindChannelOptions instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.StartIndex = 0;
            instance.MaxResults = 16;
            while (true)
            {
                if (limit < (long)0 || stream.Position < limit)
                {
                    int num = stream.ReadByte();
                    if (num != -1)
                    {
                        switch (num)
                        {
                        case 45:
                        {
                            instance.Locale = binaryReader.ReadUInt32();
                            continue;
                        }

                        case 48:
                        {
                            instance.CapacityFull = ProtocolParser.ReadUInt32(stream);
                            continue;
                        }

                        default:
                        {
                            if (num == 8)
                            {
                                instance.StartIndex = ProtocolParser.ReadUInt32(stream);
                                continue;
                            }
                            else if (num == 16)
                            {
                                instance.MaxResults = ProtocolParser.ReadUInt32(stream);
                                continue;
                            }
                            else if (num == 26)
                            {
                                instance.Name = ProtocolParser.ReadString(stream);
                                continue;
                            }
                            else if (num == 37)
                            {
                                instance.Program = binaryReader.ReadUInt32();
                                continue;
                            }
                            else if (num == 58)
                            {
                                if (instance.AttributeFilter != null)
                                {
                                    bnet.protocol.attribute.AttributeFilter.DeserializeLengthDelimited(stream, instance.AttributeFilter);
                                }
                                else
                                {
                                    instance.AttributeFilter = bnet.protocol.attribute.AttributeFilter.DeserializeLengthDelimited(stream);
                                }
                                continue;
                            }
                            else if (num == 66)
                            {
                                instance.ChannelType = ProtocolParser.ReadString(stream);
                                continue;
                            }
                            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);
                                continue;
                            }
                        }
                        }
                    }
                    else
                    {
                        if (limit >= (long)0)
                        {
                            throw new EndOfStreamException();
                        }
                        break;
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
 public static FindChannelOptions Deserialize(Stream stream, FindChannelOptions instance)
 {
     return(FindChannelOptions.Deserialize(stream, instance, (long)-1));
 }
Ejemplo n.º 13
0
        public static FindChannelOptions Deserialize(Stream stream, FindChannelOptions instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.StartIndex = 0u;
            instance.MaxResults = 16u;
            while (limit < 0L || stream.Position < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else
                {
                    switch (num)
                    {
                    case 45:
                        instance.Locale = binaryReader.ReadUInt32();
                        break;

                    default:
                        if (num != 8)
                        {
                            if (num != 16)
                            {
                                if (num != 26)
                                {
                                    if (num != 37)
                                    {
                                        if (num != 58)
                                        {
                                            if (num != 66)
                                            {
                                                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.ChannelType = ProtocolParser.ReadString(stream);
                                            }
                                        }
                                        else if (instance.AttributeFilter == null)
                                        {
                                            instance.AttributeFilter = AttributeFilter.DeserializeLengthDelimited(stream);
                                        }
                                        else
                                        {
                                            AttributeFilter.DeserializeLengthDelimited(stream, instance.AttributeFilter);
                                        }
                                    }
                                    else
                                    {
                                        instance.Program = binaryReader.ReadUInt32();
                                    }
                                }
                                else
                                {
                                    instance.Name = ProtocolParser.ReadString(stream);
                                }
                            }
                            else
                            {
                                instance.MaxResults = ProtocolParser.ReadUInt32(stream);
                            }
                        }
                        else
                        {
                            instance.StartIndex = ProtocolParser.ReadUInt32(stream);
                        }
                        break;

                    case 48:
                        instance.CapacityFull = ProtocolParser.ReadUInt32(stream);
                        break;
                    }
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
Ejemplo n.º 14
0
        public override bool Equals(object obj)
        {
            FindChannelOptions findChannelOptions = obj as FindChannelOptions;

            return(findChannelOptions != null && this.HasStartIndex == findChannelOptions.HasStartIndex && (!this.HasStartIndex || this.StartIndex.Equals(findChannelOptions.StartIndex)) && this.HasMaxResults == findChannelOptions.HasMaxResults && (!this.HasMaxResults || this.MaxResults.Equals(findChannelOptions.MaxResults)) && this.HasName == findChannelOptions.HasName && (!this.HasName || this.Name.Equals(findChannelOptions.Name)) && this.HasProgram == findChannelOptions.HasProgram && (!this.HasProgram || this.Program.Equals(findChannelOptions.Program)) && this.HasLocale == findChannelOptions.HasLocale && (!this.HasLocale || this.Locale.Equals(findChannelOptions.Locale)) && this.HasCapacityFull == findChannelOptions.HasCapacityFull && (!this.HasCapacityFull || this.CapacityFull.Equals(findChannelOptions.CapacityFull)) && this.AttributeFilter.Equals(findChannelOptions.AttributeFilter) && this.HasChannelType == findChannelOptions.HasChannelType && (!this.HasChannelType || this.ChannelType.Equals(findChannelOptions.ChannelType)));
        }