Exemple #1
0
        public static ServerRequest Deserialize(Stream stream, ServerRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Attribute == null)
            {
                instance.Attribute = new List <bnet.protocol.attribute.Attribute>();
            }
            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)
                    {
                        instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                    }
                    else if (num == 21)
                    {
                        instance.Program = binaryReader.ReadUInt32();
                    }
                    else if (num != 26)
                    {
                        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.Host != null)
                    {
                        ProcessId.DeserializeLengthDelimited(stream, instance.Host);
                    }
                    else
                    {
                        instance.Host = ProcessId.DeserializeLengthDelimited(stream);
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
 public static GameAccountOnlineNotification Deserialize(Stream stream, GameAccountOnlineNotification instance, long limit)
 {
     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.GameAccountId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
                 }
                 else
                 {
                     instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 18)
             {
                 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.Host != null)
             {
                 ProcessId.DeserializeLengthDelimited(stream, instance.Host);
             }
             else
             {
                 instance.Host = ProcessId.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static ConnectRequest Deserialize(Stream stream, ConnectRequest instance, long limit)
 {
     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.ClientId != null)
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
                 }
                 else
                 {
                     instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 18)
             {
                 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.BindRequest != null)
             {
                 bnet.protocol.connection.BindRequest.DeserializeLengthDelimited(stream, instance.BindRequest);
             }
             else
             {
                 instance.BindRequest = bnet.protocol.connection.BindRequest.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static GetPlayerVariablesRequest Deserialize(Stream stream, GetPlayerVariablesRequest instance, long limit)
 {
     if (instance.PlayerVariables == null)
     {
         instance.PlayerVariables = new List <PlayerVariables>();
     }
     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 != 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.Host == null)
                 {
                     instance.Host = ProcessId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.Host);
                 }
             }
             else
             {
                 instance.PlayerVariables.Add(bnet.protocol.game_utilities.PlayerVariables.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #5
0
 public static GameAccountOnlineNotification Deserialize(Stream stream, GameAccountOnlineNotification instance, long limit)
 {
     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 != 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.Host == null)
                 {
                     instance.Host = ProcessId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.Host);
                 }
             }
             else if (instance.GameAccountId == null)
             {
                 instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #6
0
 public static ConnectRequest Deserialize(Stream stream, ConnectRequest instance, long limit)
 {
     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)
             {
                 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.BindRequest == null)
             {
                 instance.BindRequest = BindRequest.DeserializeLengthDelimited(stream);
             }
             else
             {
                 BindRequest.DeserializeLengthDelimited(stream, instance.BindRequest);
             }
         }
         else if (instance.ClientId == null)
         {
             instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
         }
         else
         {
             ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #7
0
 public static FindClientResponse Deserialize(Stream stream, FindClientResponse instance, long limit)
 {
     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)
                 {
                     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.ClientProcessId == null)
                 {
                     instance.ClientProcessId = ProcessId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ClientProcessId);
                 }
             }
             else
             {
                 instance.Label = ProtocolParser.ReadUInt32(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #8
0
        public static SendChallengeToUserRequest Deserialize(Stream stream, SendChallengeToUserRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Challenges == null)
            {
                instance.Challenges = new List <Challenge>();
            }
            if (instance.Attributes == null)
            {
                instance.Attributes = new List <Attribute>();
            }
            while (limit < 0L || stream.get_Position() < limit)
            {
                int num = stream.ReadByte();
                if (num != -1)
                {
                    int num2 = num;
                    switch (num2)
                    {
                    case 37:
                        instance.Context = binaryReader.ReadUInt32();
                        continue;

                    case 38:
                    case 39:
                    {
IL_9F:
                        if (num2 == 10)
                        {
                            if (instance.PeerId == null)
                            {
                                instance.PeerId = ProcessId.DeserializeLengthDelimited(stream);
                            }
                            else
                            {
                                ProcessId.DeserializeLengthDelimited(stream, instance.PeerId);
                            }
                            continue;
                        }
                        if (num2 == 18)
                        {
                            if (instance.GameAccountId == null)
                            {
                                instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
                            }
                            else
                            {
                                EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
                            }
                            continue;
                        }
                        if (num2 == 26)
                        {
                            instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream));
                            continue;
                        }
                        if (num2 == 50)
                        {
                            instance.Attributes.Add(Attribute.DeserializeLengthDelimited(stream));
                            continue;
                        }
                        Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                        uint field = key.Field;
                        if (field != 0u)
                        {
                            ProtocolParser.SkipKey(stream, key);
                            continue;
                        }
                        throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                    }

                    case 40:
                        instance.Timeout = ProtocolParser.ReadUInt64(stream);
                        continue;
                    }
                    goto IL_9F;
                }
                if (limit >= 0L)
                {
                    throw new EndOfStreamException();
                }
                return(instance);
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
 public static ClientRequest Deserialize(Stream stream, ClientRequest instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <bnet.protocol.attribute.Attribute>();
     }
     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 != 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 if (instance.GameAccountId == null)
                     {
                         instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
                     }
                 }
                 else if (instance.BnetAccountId == null)
                 {
                     instance.BnetAccountId = EntityId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.BnetAccountId);
                 }
             }
             else if (instance.Host == null)
             {
                 instance.Host = ProcessId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 ProcessId.DeserializeLengthDelimited(stream, instance.Host);
             }
         }
         else
         {
             instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #10
0
 public static ConnectResponse Deserialize(Stream stream, ConnectResponse instance, long limit)
 {
     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.ServerId != null)
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ServerId);
                 }
                 else
                 {
                     instance.ServerId = ProcessId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 18)
             {
                 if (instance.ClientId != null)
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
                 }
                 else
                 {
                     instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num == 24)
             {
                 instance.BindResult = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 34)
             {
                 if (instance.BindResponse != null)
                 {
                     bnet.protocol.connection.BindResponse.DeserializeLengthDelimited(stream, instance.BindResponse);
                 }
                 else
                 {
                     instance.BindResponse = bnet.protocol.connection.BindResponse.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 42)
             {
                 if (num == 48)
                 {
                     instance.ServerTime = ProtocolParser.ReadUInt64(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 (instance.ContentHandleArray != null)
             {
                 ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream, instance.ContentHandleArray);
             }
             else
             {
                 instance.ContentHandleArray = ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Exemple #11
0
        public static ServerInfo Deserialize(Stream stream, ServerInfo instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.Replace = false;
            if (instance.Attribute == null)
            {
                instance.Attribute = new List <bnet.protocol.attribute.Attribute>();
            }
            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 != 16)
                    {
                        if (num != 26)
                        {
                            if (num != 34)
                            {
                                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.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                            }
                        }
                        else if (instance.State == null)
                        {
                            instance.State = ServerState.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            ServerState.DeserializeLengthDelimited(stream, instance.State);
                        }
                    }
                    else
                    {
                        instance.Replace = ProtocolParser.ReadBool(stream);
                    }
                }
                else if (instance.Host == null)
                {
                    instance.Host = ProcessId.DeserializeLengthDelimited(stream);
                }
                else
                {
                    ProcessId.DeserializeLengthDelimited(stream, instance.Host);
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
Exemple #12
0
 public static ConnectResponse Deserialize(Stream stream, ConnectResponse instance, long limit)
 {
     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 != 18)
                 {
                     if (num2 != 24)
                     {
                         if (num2 != 34)
                         {
                             if (num2 != 42)
                             {
                                 if (num2 != 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.ServerTime = ProtocolParser.ReadUInt64(stream);
                                 }
                             }
                             else if (instance.ContentHandleArray == null)
                             {
                                 instance.ContentHandleArray = ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream);
                             }
                             else
                             {
                                 ConnectionMeteringContentHandles.DeserializeLengthDelimited(stream, instance.ContentHandleArray);
                             }
                         }
                         else if (instance.BindResponse == null)
                         {
                             instance.BindResponse = BindResponse.DeserializeLengthDelimited(stream);
                         }
                         else
                         {
                             BindResponse.DeserializeLengthDelimited(stream, instance.BindResponse);
                         }
                     }
                     else
                     {
                         instance.BindResult = ProtocolParser.ReadUInt32(stream);
                     }
                 }
                 else if (instance.ClientId == null)
                 {
                     instance.ClientId = ProcessId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     ProcessId.DeserializeLengthDelimited(stream, instance.ClientId);
                 }
             }
             else if (instance.ServerId == null)
             {
                 instance.ServerId = ProcessId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 ProcessId.DeserializeLengthDelimited(stream, instance.ServerId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemple #13
0
        public static SendChallengeToUserRequest Deserialize(Stream stream, SendChallengeToUserRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Challenges == null)
            {
                instance.Challenges = new List <Challenge>();
            }
            if (instance.Attributes == null)
            {
                instance.Attributes = new List <bnet.protocol.attribute.Attribute>();
            }
            while (true)
            {
                if (limit < (long)0 || stream.Position < limit)
                {
                    int num = stream.ReadByte();
                    if (num != -1)
                    {
                        switch (num)
                        {
                        case 37:
                        {
                            instance.Context = binaryReader.ReadUInt32();
                            continue;
                        }

                        case 40:
                        {
                            instance.Timeout = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }

                        default:
                        {
                            if (num == 10)
                            {
                                if (instance.PeerId != null)
                                {
                                    ProcessId.DeserializeLengthDelimited(stream, instance.PeerId);
                                }
                                else
                                {
                                    instance.PeerId = ProcessId.DeserializeLengthDelimited(stream);
                                }
                                continue;
                            }
                            else if (num == 18)
                            {
                                if (instance.GameAccountId != null)
                                {
                                    EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
                                }
                                else
                                {
                                    instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
                                }
                                continue;
                            }
                            else if (num == 26)
                            {
                                instance.Challenges.Add(Challenge.DeserializeLengthDelimited(stream));
                                continue;
                            }
                            else if (num == 50)
                            {
                                instance.Attributes.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                                continue;
                            }
                            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);
                                continue;
                            }
                        }
                        }
                    }
                    else
                    {
                        if (limit >= (long)0)
                        {
                            throw new EndOfStreamException();
                        }
                        break;
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }