예제 #1
0
        public static GameProperties DeserializeLengthDelimited(Stream stream)
        {
            GameProperties gameProperties = new GameProperties();

            GameProperties.DeserializeLengthDelimited(stream, gameProperties);
            return(gameProperties);
        }
예제 #2
0
        public static FindGameRequest Deserialize(Stream stream, FindGameRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Player == null)
            {
                instance.Player = new List <Player>();
            }
            instance.AdvancedNotification = false;
            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 != 17)
                    {
                        if (num != 26)
                        {
                            if (num != 32)
                            {
                                if (num != 41)
                                {
                                    if (num != 48)
                                    {
                                        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.AdvancedNotification = ProtocolParser.ReadBool(stream);
                                    }
                                }
                                else
                                {
                                    instance.RequestId = binaryReader.ReadUInt64();
                                }
                            }
                            else
                            {
                                instance.ObjectId = ProtocolParser.ReadUInt64(stream);
                            }
                        }
                        else if (instance.Properties == null)
                        {
                            instance.Properties = GameProperties.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            GameProperties.DeserializeLengthDelimited(stream, instance.Properties);
                        }
                    }
                    else
                    {
                        instance.FactoryId = binaryReader.ReadUInt64();
                    }
                }
                else
                {
                    instance.Player.Add(bnet.protocol.game_master.Player.DeserializeLengthDelimited(stream));
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }