@@ -371,8 +371,8 @@ private static object GetValue(string? value)
371
371
if ( value is null )
372
372
throw new NotSupportedException ( "Null is not supported" ) ;
373
373
374
- var t = value [ .. 1 ] ;
375
- var v = value [ 1 .. ] ;
374
+ var t = value . Substring ( 0 , 1 ) ;
375
+ var v = value . Substring ( 1 ) ;
376
376
return t switch
377
377
{
378
378
"I" => int . Parse ( v , NumberFormatInfo . InvariantInfo ) ,
@@ -386,19 +386,23 @@ private static object GetValue(string? value)
386
386
private static byte [ ] Compress ( byte [ ] data )
387
387
{
388
388
using var compressedStream = new MemoryStream ( ) ;
389
- using var compressor = new GZipStream ( compressedStream , CompressionMode . Compress ) ;
390
- compressor . Write ( data , 0 , data . Length ) ;
391
- compressor . Flush ( ) ; // It is critical to flush here
389
+ using ( var compressor = new GZipStream ( compressedStream , CompressionMode . Compress , false ) )
390
+ {
391
+ compressor . Write ( data , 0 , data . Length ) ;
392
+ compressor . Flush ( ) ; // It is critical to flush here
393
+ }
392
394
return compressedStream . ToArray ( ) ;
393
395
}
394
396
395
397
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
396
398
private static byte [ ] Decompress ( byte [ ] raw )
397
399
{
398
400
using var compressedStream = new MemoryStream ( raw ) ;
399
- using var compressor = new GZipStream ( compressedStream , CompressionMode . Decompress ) ;
400
401
using var uncompressedStream = new MemoryStream ( ) ;
401
- compressor . CopyTo ( uncompressedStream ) ;
402
+ using ( var compressor = new GZipStream ( compressedStream , CompressionMode . Decompress , false ) )
403
+ {
404
+ compressor . CopyTo ( uncompressedStream ) ;
405
+ }
402
406
return uncompressedStream . ToArray ( ) ;
403
407
}
404
408
0 commit comments