Esempio n. 1
0
 public static ListFactoriesRequest Deserialize(Stream stream, ListFactoriesRequest instance, long limit)
 {
     instance.StartIndex = 0u;
     instance.MaxResults = 100u;
     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 != 16)
                 {
                     if (num2 != 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.MaxResults = ProtocolParser.ReadUInt32(stream);
                     }
                 }
                 else
                 {
                     instance.StartIndex = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else if (instance.Filter == null)
             {
                 instance.Filter = AttributeFilter.DeserializeLengthDelimited(stream);
             }
             else
             {
                 AttributeFilter.DeserializeLengthDelimited(stream, instance.Filter);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static ListFactoriesRequest Deserialize(Stream stream, ListFactoriesRequest instance, long limit)
 {
     instance.StartIndex = 0;
     instance.MaxResults = 100;
     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.Filter != null)
                 {
                     AttributeFilter.DeserializeLengthDelimited(stream, instance.Filter);
                 }
                 else
                 {
                     instance.Filter = AttributeFilter.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 16)
             {
                 instance.StartIndex = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 24)
             {
                 instance.MaxResults = ProtocolParser.ReadUInt32(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);
 }
Esempio n. 3
0
        public static GetGameStatsRequest Deserialize(Stream stream, GetGameStatsRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            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 != 9)
                    {
                        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.Filter == null)
                        {
                            instance.Filter = AttributeFilter.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            AttributeFilter.DeserializeLengthDelimited(stream, instance.Filter);
                        }
                    }
                    else
                    {
                        instance.FactoryId = binaryReader.ReadUInt64();
                    }
                }
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
        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");
        }
Esempio n. 5
0
        public static GameProperties Deserialize(Stream stream, GameProperties instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.CreationAttributes == null)
            {
                instance.CreationAttributes = new List <bnet.protocol.attribute.Attribute>();
            }
            instance.Create = false;
            instance.Open   = true;
            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)
                        {
                            if (num != 32)
                            {
                                if (num != 45)
                                {
                                    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.ProgramId = binaryReader.ReadUInt32();
                                }
                            }
                            else
                            {
                                instance.Open = ProtocolParser.ReadBool(stream);
                            }
                        }
                        else
                        {
                            instance.Create = ProtocolParser.ReadBool(stream);
                        }
                    }
                    else if (instance.Filter == null)
                    {
                        instance.Filter = AttributeFilter.DeserializeLengthDelimited(stream);
                    }
                    else
                    {
                        AttributeFilter.DeserializeLengthDelimited(stream, instance.Filter);
                    }
                }
                else
                {
                    instance.CreationAttributes.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }