diff --git a/src/SharpCompress/Common/Zip/PkwareTraditionalCryptoStream.cs b/src/SharpCompress/Common/Zip/PkwareTraditionalCryptoStream.cs index c43c4d00..2d412242 100644 --- a/src/SharpCompress/Common/Zip/PkwareTraditionalCryptoStream.cs +++ b/src/SharpCompress/Common/Zip/PkwareTraditionalCryptoStream.cs @@ -42,7 +42,7 @@ namespace SharpCompress.Common.Zip if (buffer == null) { - throw new ArgumentNullException("buffer"); + throw new ArgumentNullException(nameof(buffer)); } byte[] temp = new byte[count]; diff --git a/src/SharpCompress/Common/Zip/PkwareTraditionalEncryptionData.cs b/src/SharpCompress/Common/Zip/PkwareTraditionalEncryptionData.cs index b0e5be75..a423176b 100644 --- a/src/SharpCompress/Common/Zip/PkwareTraditionalEncryptionData.cs +++ b/src/SharpCompress/Common/Zip/PkwareTraditionalEncryptionData.cs @@ -49,7 +49,7 @@ namespace SharpCompress.Common.Zip { if (length > cipherText.Length) { - throw new ArgumentOutOfRangeException("length", + throw new ArgumentOutOfRangeException(nameof(length), "Bad length during Decryption: the length parameter must be smaller than or equal to the size of the destination array."); } @@ -72,7 +72,7 @@ namespace SharpCompress.Common.Zip if (length > plainText.Length) { - throw new ArgumentOutOfRangeException("length", + throw new ArgumentOutOfRangeException(nameof(length), "Bad length during Encryption: The length parameter must be smaller than or equal to the size of the destination array."); } diff --git a/src/SharpCompress/Compressors/ADC/ADCStream.cs b/src/SharpCompress/Compressors/ADC/ADCStream.cs index 2a909568..0db58080 100644 --- a/src/SharpCompress/Compressors/ADC/ADCStream.cs +++ b/src/SharpCompress/Compressors/ADC/ADCStream.cs @@ -105,19 +105,19 @@ namespace SharpCompress.Compressors.ADC } if (buffer == null) { - throw new ArgumentNullException("buffer"); + throw new ArgumentNullException(nameof(buffer)); } if (count < 0) { - throw new ArgumentOutOfRangeException("count"); + throw new ArgumentOutOfRangeException(nameof(count)); } if (offset < buffer.GetLowerBound(0)) { - throw new ArgumentOutOfRangeException("offset"); + throw new ArgumentOutOfRangeException(nameof(offset)); } if ((offset + count) > buffer.GetLength(0)) { - throw new ArgumentOutOfRangeException("count"); + throw new ArgumentOutOfRangeException(nameof(count)); } int size = -1; diff --git a/src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs b/src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs index 64938b7e..875717ec 100644 --- a/src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs +++ b/src/SharpCompress/Compressors/Deflate/ZlibBaseStream.cs @@ -534,19 +534,19 @@ namespace SharpCompress.Compressors.Deflate } if (buffer == null) { - throw new ArgumentNullException("buffer"); + throw new ArgumentNullException(nameof(buffer)); } if (count < 0) { - throw new ArgumentOutOfRangeException("count"); + throw new ArgumentOutOfRangeException(nameof(count)); } if (offset < buffer.GetLowerBound(0)) { - throw new ArgumentOutOfRangeException("offset"); + throw new ArgumentOutOfRangeException(nameof(offset)); } if ((offset + count) > buffer.GetLength(0)) { - throw new ArgumentOutOfRangeException("count"); + throw new ArgumentOutOfRangeException(nameof(count)); } int rc = 0; diff --git a/src/SharpCompress/Compressors/LZMA/BitVector.cs b/src/SharpCompress/Compressors/LZMA/BitVector.cs index 23da87b6..f3934c4e 100644 --- a/src/SharpCompress/Compressors/LZMA/BitVector.cs +++ b/src/SharpCompress/Compressors/LZMA/BitVector.cs @@ -58,7 +58,7 @@ namespace SharpCompress.Compressors.LZMA { if (index < 0 || index >= Length) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } return (mBits[index >> 5] & (1u << (index & 31))) != 0; @@ -69,7 +69,7 @@ namespace SharpCompress.Compressors.LZMA { if (index < 0 || index >= Length) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } mBits[index >> 5] |= 1u << (index & 31); @@ -79,7 +79,7 @@ namespace SharpCompress.Compressors.LZMA { if (index < 0 || index >= Length) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } uint bits = mBits[index >> 5]; diff --git a/src/SharpCompress/Compressors/LZMA/Utilites/Utils.cs b/src/SharpCompress/Compressors/LZMA/Utilites/Utils.cs index 902c7758..ad0e54b0 100644 --- a/src/SharpCompress/Compressors/LZMA/Utilites/Utils.cs +++ b/src/SharpCompress/Compressors/LZMA/Utilites/Utils.cs @@ -58,22 +58,22 @@ namespace SharpCompress.Compressors.LZMA.Utilites { if (stream == null) { - throw new ArgumentNullException("stream"); + throw new ArgumentNullException(nameof(stream)); } if (buffer == null) { - throw new ArgumentNullException("buffer"); + throw new ArgumentNullException(nameof(buffer)); } if (offset < 0 || offset > buffer.Length) { - throw new ArgumentOutOfRangeException("offset"); + throw new ArgumentOutOfRangeException(nameof(offset)); } if (length < 0 || length > buffer.Length - offset) { - throw new ArgumentOutOfRangeException("length"); + throw new ArgumentOutOfRangeException(nameof(length)); } while (length > 0) diff --git a/src/SharpCompress/Compressors/PPMd/I1/Model.cs b/src/SharpCompress/Compressors/PPMd/I1/Model.cs index a51769d2..a71939cd 100644 --- a/src/SharpCompress/Compressors/PPMd/I1/Model.cs +++ b/src/SharpCompress/Compressors/PPMd/I1/Model.cs @@ -146,12 +146,12 @@ namespace SharpCompress.Compressors.PPMd.I1 { if (target == null) { - throw new ArgumentNullException("target"); + throw new ArgumentNullException(nameof(target)); } if (source == null) { - throw new ArgumentNullException("source"); + throw new ArgumentNullException(nameof(source)); } EncodeStart(properties); @@ -235,12 +235,12 @@ namespace SharpCompress.Compressors.PPMd.I1 { if (target == null) { - throw new ArgumentNullException("target"); + throw new ArgumentNullException(nameof(target)); } if (source == null) { - throw new ArgumentNullException("source"); + throw new ArgumentNullException(nameof(source)); } DecodeStart(source, properties); diff --git a/src/SharpCompress/Converters/DataConverter.cs b/src/SharpCompress/Converters/DataConverter.cs index 9ea6953f..2ea5c5c9 100644 --- a/src/SharpCompress/Converters/DataConverter.cs +++ b/src/SharpCompress/Converters/DataConverter.cs @@ -156,7 +156,7 @@ namespace SharpCompress.Converters { if (dest == null) { - throw new ArgumentNullException("dest"); + throw new ArgumentNullException(nameof(dest)); } if (destIdx < 0 || destIdx > dest.Length - size) { @@ -170,7 +170,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 8) { @@ -195,7 +195,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 8) { @@ -221,7 +221,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 8) { @@ -247,7 +247,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 4) { @@ -273,7 +273,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 4) { @@ -299,7 +299,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 4) { @@ -325,7 +325,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 2) { @@ -351,7 +351,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 2) { @@ -468,7 +468,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 8) { @@ -494,7 +494,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 8) { @@ -520,7 +520,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 8) { @@ -546,7 +546,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 4) { @@ -572,7 +572,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 4) { @@ -598,7 +598,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 4) { @@ -624,7 +624,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 2) { @@ -650,7 +650,7 @@ namespace SharpCompress.Converters { if (data == null) { - throw new ArgumentNullException("data"); + throw new ArgumentNullException(nameof(data)); } if (data.Length - index < 2) { diff --git a/src/SharpCompress/Crypto/KeyParameter.cs b/src/SharpCompress/Crypto/KeyParameter.cs index 41d8e1a7..b69ce4e1 100644 --- a/src/SharpCompress/Crypto/KeyParameter.cs +++ b/src/SharpCompress/Crypto/KeyParameter.cs @@ -12,7 +12,7 @@ namespace Org.BouncyCastle.Crypto.Parameters { if (key == null) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } this.key = (byte[])key.Clone(); @@ -25,15 +25,15 @@ namespace Org.BouncyCastle.Crypto.Parameters { if (key == null) { - throw new ArgumentNullException("key"); + throw new ArgumentNullException(nameof(key)); } if (keyOff < 0 || keyOff > key.Length) { - throw new ArgumentOutOfRangeException("keyOff"); + throw new ArgumentOutOfRangeException(nameof(keyOff)); } if (keyLen < 0 || (keyOff + keyLen) > key.Length) { - throw new ArgumentOutOfRangeException("keyLen"); + throw new ArgumentOutOfRangeException(nameof(keyLen)); } this.key = new byte[keyLen];