public static GameHandle DeserializeLengthDelimited(Stream stream)
        {
            GameHandle gameHandle = new GameHandle();

            GameHandle.DeserializeLengthDelimited(stream, gameHandle);
            return(gameHandle);
        }
 public static PlayerLeftNotification Deserialize(Stream stream, PlayerLeftNotification instance, long limit)
 {
     instance.Reason = 1u;
     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)
                 {
                     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.Reason = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else if (instance.MemberId == null)
             {
                 instance.MemberId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.MemberId);
             }
         }
         else if (instance.GameHandle == null)
         {
             instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Пример #3
0
 public static JoinGameRequest Deserialize(Stream stream, JoinGameRequest instance, long limit)
 {
     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 != 18)
             {
                 if (num != 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.AdvancedNotification = ProtocolParser.ReadBool(stream);
                 }
             }
             else
             {
                 instance.Player.Add(bnet.protocol.game_master.Player.DeserializeLengthDelimited(stream));
             }
         }
         else if (instance.GameHandle == null)
         {
             instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
        public static GameFoundNotification Deserialize(Stream stream, GameFoundNotification instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.ErrorCode = 0u;
            if (instance.ConnectInfo == null)
            {
                instance.ConnectInfo = new List <ConnectInfo>();
            }
            while (limit < 0L || stream.Position < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else if (num != 9)
                {
                    if (num != 16)
                    {
                        if (num != 26)
                        {
                            if (num != 34)
                            {
                                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.ConnectInfo.Add(bnet.protocol.game_master.ConnectInfo.DeserializeLengthDelimited(stream));
                            }
                        }
                        else if (instance.GameHandle == null)
                        {
                            instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
                        }
                    }
                    else
                    {
                        instance.ErrorCode = ProtocolParser.ReadUInt32(stream);
                    }
                }
                else
                {
                    instance.RequestId = binaryReader.ReadUInt64();
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
 public static ChangeGameRequest Deserialize(Stream stream, ChangeGameRequest instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <Attribute>();
     }
     instance.Replace = false;
     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 != 26)
                     {
                         if (num2 != 32)
                         {
                             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.Replace = ProtocolParser.ReadBool(stream);
                         }
                     }
                     else
                     {
                         instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                     }
                 }
                 else
                 {
                     instance.Open = ProtocolParser.ReadBool(stream);
                 }
             }
             else if (instance.GameHandle == null)
             {
                 instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
             }
             else
             {
                 GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }