File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ private async Task<byte[]> ConnectAndSendChallenge(byte[] header)
291
291
private async Task < byte [ ] > Receive ( System . Net . Sockets . UdpClient udpClient )
292
292
{
293
293
bool isCompressed ;
294
- int totalPackets = - 1 , crc32Sum = 0 ;
294
+ int totalPackets = - 1 ;
295
+ long crc32Sum = 0 ;
295
296
var payloads = new SortedDictionary < int , byte [ ] > ( ) ;
296
297
var packets = new List < byte [ ] > ( ) ;
297
298
@@ -313,7 +314,7 @@ private async Task<byte[]> Receive(System.Net.Sockets.UdpClient udpClient)
313
314
314
315
// Packet id
315
316
int id = br . ReadInt32 ( ) ;
316
- isCompressed = id < 0 ;
317
+ isCompressed = ( id & 0x80000000 ) != 0 ;
317
318
318
319
// Check is GoldSource multi-packet response format
319
320
if ( IsGoldSourceSplit ( response , ( int ) br . BaseStream . Position ) )
@@ -328,16 +329,18 @@ private async Task<byte[]> Receive(System.Net.Sockets.UdpClient udpClient)
328
329
// The number of the packet
329
330
int number = br . ReadByte ( ) ;
330
331
331
- // Packet size
332
- br . ReadUInt16 ( ) ;
333
-
334
332
if ( number == 0 && isCompressed )
335
333
{
336
334
// Decompressed size
337
335
br . ReadInt32 ( ) ;
338
336
339
337
// CRC32 sum
340
- crc32Sum = br . ReadInt32 ( ) ;
338
+ crc32Sum = br . ReadUInt32 ( ) ;
339
+ }
340
+ else
341
+ {
342
+ // Packet size
343
+ br . ReadUInt16 ( ) ;
341
344
}
342
345
343
346
payloads . Add ( number , response . Skip ( ( int ) br . BaseStream . Position ) . ToArray ( ) ) ;
You can’t perform that action at this time.
0 commit comments