示例#1
0
        public static GameFactoryDescription DeserializeLengthDelimited(Stream stream)
        {
            GameFactoryDescription gameFactoryDescription = new GameFactoryDescription();

            GameFactoryDescription.DeserializeLengthDelimited(stream, gameFactoryDescription);
            return(gameFactoryDescription);
        }
        public static FactoryUpdateNotification Deserialize(Stream stream, FactoryUpdateNotification 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 != 8)
                    {
                        if (num2 != 18)
                        {
                            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.ProgramId = binaryReader.ReadUInt32();
                            }
                        }
                        else if (instance.Description == null)
                        {
                            instance.Description = GameFactoryDescription.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            GameFactoryDescription.DeserializeLengthDelimited(stream, instance.Description);
                        }
                    }
                    else
                    {
                        instance.Op = (FactoryUpdateNotification.Types.Operation)ProtocolParser.ReadUInt64(stream);
                    }
                }
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
示例#3
0
        public static FactoryUpdateNotification Deserialize(Stream stream, FactoryUpdateNotification instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            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 == 8)
                    {
                        instance.Op = (FactoryUpdateNotification.Types.Operation)((int)ProtocolParser.ReadUInt64(stream));
                    }
                    else if (num != 18)
                    {
                        if (num == 29)
                        {
                            instance.ProgramId = 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 (instance.Description != null)
                    {
                        GameFactoryDescription.DeserializeLengthDelimited(stream, instance.Description);
                    }
                    else
                    {
                        instance.Description = GameFactoryDescription.DeserializeLengthDelimited(stream);
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
 public static ListFactoriesResponse Deserialize(Stream stream, ListFactoriesResponse instance, long limit)
 {
     if (instance.Description == null)
     {
         instance.Description = new List <GameFactoryDescription>();
     }
     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)
                 {
                     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.TotalResults = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else
             {
                 instance.Description.Add(GameFactoryDescription.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }