public static ContentHandleRequest DeserializeLengthDelimited(Stream stream)
        {
            ContentHandleRequest contentHandleRequest = new ContentHandleRequest();

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

            num += stream.Position;
            return(ContentHandleRequest.Deserialize(stream, instance, num));
        }
Exemple #3
0
        public static ContentHandleRequest Deserialize(Stream stream, ContentHandleRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.Locale = 1701729619u;
            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 != 13)
                    {
                        if (num2 != 21)
                        {
                            if (num2 != 29)
                            {
                                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.Locale = binaryReader.ReadUInt32();
                            }
                        }
                        else
                        {
                            instance.StreamId = binaryReader.ReadUInt32();
                        }
                    }
                    else
                    {
                        instance.ProgramId = binaryReader.ReadUInt32();
                    }
                }
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
        public static ContentHandleRequest Deserialize(Stream stream, ContentHandleRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.Locale = 1701729619;
            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 == 13)
                    {
                        instance.ProgramId = binaryReader.ReadUInt32();
                    }
                    else if (num == 21)
                    {
                        instance.StreamId = binaryReader.ReadUInt32();
                    }
                    else if (num == 29)
                    {
                        instance.Locale = binaryReader.ReadUInt32();
                    }
                    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);
        }
        public static void Serialize(Stream stream, ContentHandleRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(13);
            binaryWriter.Write(instance.ProgramId);
            stream.WriteByte(21);
            binaryWriter.Write(instance.StreamId);
            if (instance.HasLocale)
            {
                stream.WriteByte(29);
                binaryWriter.Write(instance.Locale);
            }
        }
        public override bool Equals(object obj)
        {
            ContentHandleRequest contentHandleRequest = obj as ContentHandleRequest;

            if (contentHandleRequest == null)
            {
                return(false);
            }
            if (!this.ProgramId.Equals(contentHandleRequest.ProgramId))
            {
                return(false);
            }
            if (!this.StreamId.Equals(contentHandleRequest.StreamId))
            {
                return(false);
            }
            if (this.HasLocale == contentHandleRequest.HasLocale && (!this.HasLocale || this.Locale.Equals(contentHandleRequest.Locale)))
            {
                return(true);
            }
            return(false);
        }
 public static ContentHandleRequest Deserialize(Stream stream, ContentHandleRequest instance)
 {
     return(ContentHandleRequest.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     ContentHandleRequest.Deserialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            ContentHandleRequest contentHandleRequest = obj as ContentHandleRequest;

            return(contentHandleRequest != null && this.ProgramId.Equals(contentHandleRequest.ProgramId) && this.StreamId.Equals(contentHandleRequest.StreamId) && this.HasLocale == contentHandleRequest.HasLocale && (!this.HasLocale || this.Locale.Equals(contentHandleRequest.Locale)));
        }