@@ -413,7 +413,11 @@ private protected static byte[] GenerateD1(byte[] key)
413413 throw new ArgumentException ( "Disc Key must be a byte array of length 16" , nameof ( key ) ) ;
414414
415415 // Setup AES decryption
416+ #if NET35_OR_GREATER || NETCOREAPP
416417 using Aes aes = Aes . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ;
418+ #else
419+ using Rijndael aes = Rijndael . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ; ;
420+ #endif
417421
418422 // Set AES settings
419423 aes . Key = D1AesKey ;
@@ -446,7 +450,11 @@ private protected static byte[] GenerateDiscKey(byte[] d1)
446450 throw new ArgumentException ( "Disc Key must be a byte array of length 16" , nameof ( d1 ) ) ;
447451
448452 // Setup AES decryption
453+ #if NET35_OR_GREATER || NETCOREAPP
449454 using Aes aes = Aes . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ;
455+ #else
456+ using Rijndael aes = Rijndael . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ; ;
457+ #endif
450458
451459 // Set AES settings
452460 aes . Key = D1AesKey ;
@@ -478,7 +486,11 @@ private protected static byte[] GenerateD2(byte[] d2)
478486 if ( d2 . Length != 16 ) throw new ArgumentException ( "Disc ID must be a byte array of length 16" , nameof ( d2 ) ) ;
479487
480488 // Setup AES encryption
489+ #if NET35_OR_GREATER || NETCOREAPP
481490 using Aes aes = Aes . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ;
491+ #else
492+ using Rijndael aes = Rijndael . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ; ;
493+ #endif
482494
483495 // Set AES settings
484496 aes . Key = D2AesKey ;
@@ -511,7 +523,11 @@ private protected static byte[] GenerateDiscID(byte[] d2)
511523 throw new ArgumentException ( "Disc ID must be a byte array of length 16" , nameof ( d2 ) ) ;
512524
513525 // Setup AES encryption
526+ #if NET35_OR_GREATER || NETCOREAPP
514527 using Aes aes = Aes . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ;
528+ #else
529+ using Rijndael aes = Rijndael . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ; ;
530+ #endif
515531
516532 // Set AES settings
517533 aes . Key = D2AesKey ;
@@ -737,7 +753,7 @@ private protected void GenerateIRD(string isoPath, bool redump = false)
737753 HashISO ( fs , redump && UID == 0x00000000 ) ;
738754 }
739755
740- #endregion
756+ #endregion
741757
742758 #region Reading ISO
743759
@@ -989,7 +1005,12 @@ private protected void DecryptSectors(ref byte[] buffer, int sectorNumber, int o
9891005 throw new ArgumentException ( "Number of sectors must be within buffer" ) ;
9901006
9911007 // Setup AES decryption
1008+ #if NET35_OR_GREATER || NETCOREAPP
9921009 using Aes aes = Aes . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ;
1010+ #else
1011+ using Rijndael aes = Rijndael . Create ( ) ?? throw new InvalidOperationException ( "AES not available. Change your system settings" ) ; ;
1012+ #endif
1013+
9931014 // Set AES settings
9941015 aes . Key = DiscKey ;
9951016 aes . Padding = PaddingMode . None ;
@@ -1359,7 +1380,14 @@ public void Write(string irdPath)
13591380#endif
13601381 // Write entire gzipped IRD stream to file
13611382 stream . Position = 0 ;
1383+ #if NET40_OR_GREATER || NETCOREAPP
13621384 stream . CopyTo ( gzStream ) ;
1385+ #else
1386+ byte [ ] buffer = new byte [ 1024 ] ;
1387+ int numBytes ;
1388+ while ( ( numBytes = stream . Read ( buffer , 0 , buffer . Length ) ) > 0 )
1389+ gzStream . Write ( buffer , 0 , numBytes ) ;
1390+ #endif
13631391 }
13641392
13651393 /// <summary>
@@ -1571,7 +1599,7 @@ public void PrintJson(string jsonPath = null, bool single = true)
15711599 }
15721600 }
15731601
1574- #endregion
1602+ #endregion
15751603
15761604 #region Helper Functions
15771605
0 commit comments