diff --git a/.editorconfig b/.editorconfig
index 28ede258..be296daf 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -195,8 +195,6 @@ csharp_prefer_static_local_function = true:warning
csharp_prefer_simple_using_statement = true:suggestion
dotnet_diagnostic.IDE0063.severity = suggestion
-csharp_style_namespace_declarations = file_scoped
-
##########################################
# .NET Formatting Conventions
# https://docs.microsoft.com/visualstudio/ide/editorconfig-code-style-settings-reference#formatting-conventions
@@ -251,6 +249,8 @@ csharp_space_between_square_brackets = false
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
+csharp_style_namespace_declarations = file_scoped
+
##########################################
# .NET Naming Conventions
# https://docs.microsoft.com/visualstudio/ide/editorconfig-naming-conventions
@@ -260,11 +260,13 @@ csharp_preserve_single_line_blocks = true
dotnet_diagnostic.CA1000.severity = suggestion
dotnet_diagnostic.CA1001.severity = error
dotnet_diagnostic.CA1018.severity = error
+dotnet_diagnostic.CA1036.severity = silent
dotnet_diagnostic.CA1051.severity = suggestion
dotnet_diagnostic.CA1068.severity = error
dotnet_diagnostic.CA1069.severity = error
dotnet_diagnostic.CA1304.severity = error
dotnet_diagnostic.CA1305.severity = suggestion
+dotnet_diagnostic.CA1307.severity = suggestion
dotnet_diagnostic.CA1309.severity = suggestion
dotnet_diagnostic.CA1310.severity = error
dotnet_diagnostic.CA1707.severity = suggestion
@@ -283,6 +285,7 @@ dotnet_diagnostic.CA1829.severity = suggestion
dotnet_diagnostic.CA1834.severity = error
dotnet_diagnostic.CA1845.severity = suggestion
dotnet_diagnostic.CA1848.severity = suggestion
+dotnet_diagnostic.CA1852.severity = suggestion
dotnet_diagnostic.CA2016.severity = suggestion
dotnet_diagnostic.CA2201.severity = error
dotnet_diagnostic.CA2206.severity = error
@@ -295,6 +298,7 @@ dotnet_diagnostic.CA2254.severity = suggestion
dotnet_diagnostic.CS0169.severity = error
dotnet_diagnostic.CS0219.severity = error
+dotnet_diagnostic.CS0649.severity = suggestion
dotnet_diagnostic.CS1998.severity = error
dotnet_diagnostic.CS8602.severity = error
dotnet_diagnostic.CS8604.severity = error
@@ -305,43 +309,53 @@ dotnet_diagnostic.CS4014.severity = error
dotnet_diagnostic.CS8600.severity = error
dotnet_diagnostic.CS8603.severity = error
dotnet_diagnostic.CS8625.severity = error
+dotnet_diagnostic.CS8981.severity = suggestion
dotnet_diagnostic.BL0005.severity = suggestion
dotnet_diagnostic.MVC1000.severity = suggestion
-dotnet_diagnostic.IDE0055.severity = suggestion # Fix formatting
-dotnet_diagnostic.IDE0023.severity = suggestion # use expression body for operators
-dotnet_diagnostic.IDE0025.severity = suggestion # use expression body for properties
-dotnet_diagnostic.IDE1006.severity = suggestion # Naming rule violation: These words cannot contain lower case characters
-dotnet_diagnostic.IDE0072.severity = suggestion # Populate switch - forces population of all cases even when default specified
-dotnet_diagnostic.IDE0027.severity = suggestion # Use expression body for accessors
-dotnet_diagnostic.IDE0032.severity = suggestion # Use auto property
-dotnet_diagnostic.IDE0007.severity = error # Use var
-dotnet_diagnostic.IDE0160.severity = suggestion # Use block scoped
-dotnet_diagnostic.IDE0011.severity = error # Use braces on if statements
-dotnet_diagnostic.IDE0057.severity = suggestion # substring can be simplified
+dotnet_diagnostic.RZ10012.severity = error
+
dotnet_diagnostic.IDE0004.severity = error # redundant cast
+dotnet_diagnostic.IDE0005.severity = error
+dotnet_diagnostic.IDE0007.severity = error # Use var
+dotnet_diagnostic.IDE0011.severity = error # Use braces on if statements
dotnet_diagnostic.IDE0010.severity = silent # populate switch
+dotnet_diagnostic.IDE0017.severity = suggestion # initialization can be simplified
dotnet_diagnostic.IDE0021.severity = silent # expression body for constructors
dotnet_diagnostic.IDE0022.severity = silent # expression body for methods
+dotnet_diagnostic.IDE0023.severity = suggestion # use expression body for operators
dotnet_diagnostic.IDE0024.severity = silent # expression body for operators
+dotnet_diagnostic.IDE0025.severity = suggestion # use expression body for properties
+dotnet_diagnostic.IDE0027.severity = suggestion # Use expression body for accessors
dotnet_diagnostic.IDE0028.severity = silent
+dotnet_diagnostic.IDE0032.severity = suggestion # Use auto property
dotnet_diagnostic.IDE0033.severity = error # prefer tuple name
+dotnet_diagnostic.IDE0037.severity = suggestion # simplify anonymous type
dotnet_diagnostic.IDE0040.severity = error # modifiers required
dotnet_diagnostic.IDE0041.severity = error # simplify null
dotnet_diagnostic.IDE0042.severity = error # deconstruct variable
-dotnet_diagnostic.IDE0044.severity = error # make field only when possible
+dotnet_diagnostic.IDE0044.severity = suggestion # make field only when possible
dotnet_diagnostic.IDE0047.severity = suggestion # paratemeter name
dotnet_diagnostic.IDE0051.severity = error # unused field
dotnet_diagnostic.IDE0052.severity = error # unused member
+dotnet_diagnostic.IDE0053.severity = suggestion # lambda not needed
+dotnet_diagnostic.IDE0055.severity = suggestion # Fix formatting
+dotnet_diagnostic.IDE0057.severity = suggestion # substring can be simplified
dotnet_diagnostic.IDE0060.severity = suggestion # unused parameters
+dotnet_diagnostic.IDE0061.severity = suggestion # local expression body
+dotnet_diagnostic.IDE0062.severity = suggestion # local to static
+dotnet_diagnostic.IDE0063.severity = error # simplify using
dotnet_diagnostic.IDE0066.severity = suggestion # switch expression
+dotnet_diagnostic.IDE0072.severity = suggestion # Populate switch - forces population of all cases even when default specified
dotnet_diagnostic.IDE0078.severity = suggestion # use pattern matching
dotnet_diagnostic.IDE0090.severity = suggestion # new can be simplified
dotnet_diagnostic.IDE0130.severity = suggestion # namespace folder structure
dotnet_diagnostic.IDE0160.severity = silent # Use block namespaces ARE NOT required
-dotnet_diagnostic.IDE0161.severity = suggestion # Please use file namespaces
+dotnet_diagnostic.IDE0161.severity = error # Please use file namespaces
+dotnet_diagnostic.IDE0200.severity = suggestion # lambda not needed
+dotnet_diagnostic.IDE1006.severity = suggestion # Naming rule violation: These words cannot contain lower case characters
##########################################
# Styles
diff --git a/src/SharpCompress/AssemblyInfo.cs b/src/SharpCompress/AssemblyInfo.cs
index 086b9adc..8c114539 100644
--- a/src/SharpCompress/AssemblyInfo.cs
+++ b/src/SharpCompress/AssemblyInfo.cs
@@ -1,24 +1,3 @@
using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-[assembly: AssemblyTitle("SharpCompress")]
-[assembly: AssemblyProduct("SharpCompress")]
-[assembly: InternalsVisibleTo("SharpCompress.Test" + SharpCompress.AssemblyInfo.PublicKeySuffix)]
[assembly: CLSCompliant(true)]
-
-namespace SharpCompress
-{
- ///
- /// Just a static class to house the public key, to avoid repetition.
- ///
- internal static class AssemblyInfo
- {
- internal const string PublicKeySuffix =
- ",PublicKey=002400000480000094000000060200000024000052534131000400000100010059acfa17d26c44" +
- "7a4d03f16eaa72c9187c04f16e6569dd168b080e39a6f5c9fd00f28c768cd8e9a089d5a0e1b34c" +
- "cd971488e7afe030ce5ce8df2053cf12ec89f6d38065c434c09ee6af3ee284c5dc08f44774b679" +
- "bf39298e57efe30d4b00aecf9e4f6f8448b2cb0146d8956dfcab606cc64a0ac38c60a7d78b0d65" +
- "d3b98dc0";
- }
-}
diff --git a/src/SharpCompress/Common/IExtractionListener.cs b/src/SharpCompress/Common/IExtractionListener.cs
index b6fb50fc..3ec0abfb 100644
--- a/src/SharpCompress/Common/IExtractionListener.cs
+++ b/src/SharpCompress/Common/IExtractionListener.cs
@@ -1,8 +1,8 @@
namespace SharpCompress.Common
{
- internal interface IExtractionListener
+ public interface IExtractionListener
{
void FireFilePartExtractionBegin(string name, long size, long compressedSize);
void FireCompressedBytesRead(long currentPartCompressedBytes, long compressedReadBytes);
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Common/Rar/Headers/Flags.cs b/src/SharpCompress/Common/Rar/Headers/Flags.cs
index b6457661..7925ca5f 100644
--- a/src/SharpCompress/Common/Rar/Headers/Flags.cs
+++ b/src/SharpCompress/Common/Rar/Headers/Flags.cs
@@ -1,6 +1,6 @@
namespace SharpCompress.Common.Rar.Headers
{
- internal enum HeaderType : byte
+ public enum HeaderType : byte
{
Null,
Mark,
@@ -146,4 +146,4 @@ namespace SharpCompress.Common.Rar.Headers
{
public const ushort HAS_NEXT_VOLUME = 0x0001;
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Common/Rar/Headers/IRarHeader.cs b/src/SharpCompress/Common/Rar/Headers/IRarHeader.cs
index 5d3433b7..a168690c 100644
--- a/src/SharpCompress/Common/Rar/Headers/IRarHeader.cs
+++ b/src/SharpCompress/Common/Rar/Headers/IRarHeader.cs
@@ -1,7 +1,7 @@
namespace SharpCompress.Common.Rar.Headers
{
- internal interface IRarHeader
+ public interface IRarHeader
{
HeaderType HeaderType { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs b/src/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs
index 6c8d5686..4ac686a2 100644
--- a/src/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs
+++ b/src/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs
@@ -5,21 +5,21 @@ using SharpCompress.Readers;
namespace SharpCompress.Common.Rar.Headers
{
- internal class RarHeaderFactory
+ public class RarHeaderFactory
{
private bool _isRar5;
- internal RarHeaderFactory(StreamingMode mode, ReaderOptions options)
+ public RarHeaderFactory(StreamingMode mode, ReaderOptions options)
{
StreamingMode = mode;
Options = options;
}
- private ReaderOptions Options { get; }
- internal StreamingMode StreamingMode { get; }
- internal bool IsEncrypted { get; private set; }
+ public ReaderOptions Options { get; }
+ public StreamingMode StreamingMode { get; }
+ public bool IsEncrypted { get; private set; }
- internal IEnumerable ReadHeaders(Stream stream)
+ public IEnumerable ReadHeaders(Stream stream)
{
var markHeader = MarkHeader.Read(stream, Options.LeaveStreamOpen, Options.LookForHeader);
_isRar5 = markHeader.IsRar5;
@@ -185,4 +185,4 @@ namespace SharpCompress.Common.Rar.Headers
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs b/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
index e893adde..81c78503 100644
--- a/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
+++ b/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
@@ -52,7 +52,11 @@ namespace SharpCompress.Common.Zip
private void Initialize()
{
+ #if NET7_0
+ var rfc2898 = new Rfc2898DeriveBytes(_password, _salt, RFC2898_ITERATIONS, HashAlgorithmName.SHA1);
+ #else
var rfc2898 = new Rfc2898DeriveBytes(_password, _salt, RFC2898_ITERATIONS);
+ #endif
KeyBytes = rfc2898.GetBytes(KeySizeInBytes); // 16 or 24 or 32 ???
IvBytes = rfc2898.GetBytes(KeySizeInBytes);
diff --git a/src/SharpCompress/Compressors/Deflate/CRC32.cs b/src/SharpCompress/Compressors/Deflate/CRC32.cs
index d5e650c0..ac73e843 100644
--- a/src/SharpCompress/Compressors/Deflate/CRC32.cs
+++ b/src/SharpCompress/Compressors/Deflate/CRC32.cs
@@ -43,7 +43,8 @@ namespace SharpCompress.Compressors.Deflate
/// directly by applications wishing to create, read, or manipulate zip archive
/// files.
///
- internal class CRC32
+ [CLSCompliant(false)]
+ public class CRC32
{
private const int BUFFER_SIZE = 8192;
private static readonly UInt32[] crc32Table;
@@ -290,4 +291,4 @@ namespace SharpCompress.Compressors.Deflate
// private member vars
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Compressors/LZMA/Utilites/CrcCheckStream.cs b/src/SharpCompress/Compressors/LZMA/Utilites/CrcCheckStream.cs
index d5e54728..9a59e26b 100644
--- a/src/SharpCompress/Compressors/LZMA/Utilites/CrcCheckStream.cs
+++ b/src/SharpCompress/Compressors/LZMA/Utilites/CrcCheckStream.cs
@@ -4,7 +4,8 @@ using System.IO;
namespace SharpCompress.Compressors.LZMA.Utilites
{
- internal class CrcCheckStream : Stream
+ [CLSCompliant(false)]
+ public class CrcCheckStream : Stream
{
private readonly uint _mExpectedCrc;
private uint _mCurrentCrc;
diff --git a/src/SharpCompress/Compressors/Rar/UnpackV2017/unpack_hpp.cs b/src/SharpCompress/Compressors/Rar/UnpackV2017/unpack_hpp.cs
index e28720d6..a0905ff4 100644
--- a/src/SharpCompress/Compressors/Rar/UnpackV2017/unpack_hpp.cs
+++ b/src/SharpCompress/Compressors/Rar/UnpackV2017/unpack_hpp.cs
@@ -57,7 +57,7 @@ namespace SharpCompress.Compressors.Rar.UnpackV2017
// Real size of DecodeNum table.
public uint MaxNum;
- // Left aligned start and upper limit codes defining code space
+ // Left aligned start and upper limit codes defining code space
// ranges for bit lengths. DecodeLen[BitLength-1] defines the start of
// range for bit length and DecodeLen[BitLength] defines next code
// after the end of range or in other words the upper limit code
@@ -65,7 +65,7 @@ namespace SharpCompress.Compressors.Rar.UnpackV2017
public readonly uint[] DecodeLen = new uint[16];
// Every item of this array contains the sum of all preceding items.
- // So it contains the start position in code list for every bit length.
+ // So it contains the start position in code list for every bit length.
public readonly uint[] DecodePos = new uint[16];
// Number of compressed bits processed in quick mode.
diff --git a/src/SharpCompress/Compressors/Xz/BinaryUtils.cs b/src/SharpCompress/Compressors/Xz/BinaryUtils.cs
index 12f34bf7..05f66c46 100644
--- a/src/SharpCompress/Compressors/Xz/BinaryUtils.cs
+++ b/src/SharpCompress/Compressors/Xz/BinaryUtils.cs
@@ -4,6 +4,7 @@ using System.IO;
namespace SharpCompress.Compressors.Xz
{
+ [CLSCompliant(false)]
public static class BinaryUtils
{
public static int ReadLittleEndianInt32(this BinaryReader reader)
@@ -44,7 +45,7 @@ namespace SharpCompress.Compressors.Xz
return result;
}
- internal static byte[] ToLittleEndianBytes(this uint uint32)
+ public static byte[] ToLittleEndianBytes(this uint uint32)
{
var result = BitConverter.GetBytes(uint32);
diff --git a/src/SharpCompress/Compressors/Xz/Crc32.cs b/src/SharpCompress/Compressors/Xz/Crc32.cs
index 01a90791..51b4c7bf 100644
--- a/src/SharpCompress/Compressors/Xz/Crc32.cs
+++ b/src/SharpCompress/Compressors/Xz/Crc32.cs
@@ -4,7 +4,8 @@ using System;
namespace SharpCompress.Compressors.Xz
{
- internal static class Crc32
+ [CLSCompliant(false)]
+ public static class Crc32
{
public const UInt32 DefaultPolynomial = 0xedb88320u;
public const UInt32 DefaultSeed = 0xffffffffu;
diff --git a/src/SharpCompress/Compressors/Xz/Crc64.cs b/src/SharpCompress/Compressors/Xz/Crc64.cs
index 1cc9e1b3..1bea4a23 100644
--- a/src/SharpCompress/Compressors/Xz/Crc64.cs
+++ b/src/SharpCompress/Compressors/Xz/Crc64.cs
@@ -5,7 +5,8 @@ using System.Collections.Generic;
namespace SharpCompress.Compressors.Xz
{
- internal static class Crc64
+ [CLSCompliant(false)]
+ public static class Crc64
{
public const UInt64 DefaultSeed = 0x0;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/ArmFilter.cs b/src/SharpCompress/Compressors/Xz/Filters/ArmFilter.cs
index 9f8b5ad7..dac51743 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/ArmFilter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/ArmFilter.cs
@@ -14,7 +14,7 @@ using SharpCompress.Compressors.Filters;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class ArmFilter : BlockFilter
+ public class ArmFilter : BlockFilter
{
public override bool AllowAsLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/ArmThumbFilter.cs b/src/SharpCompress/Compressors/Xz/Filters/ArmThumbFilter.cs
index db79e5e9..2d6a87cd 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/ArmThumbFilter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/ArmThumbFilter.cs
@@ -14,7 +14,7 @@ using SharpCompress.Compressors.Filters;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class ArmThumbFilter : BlockFilter
+ public class ArmThumbFilter : BlockFilter
{
public override bool AllowAsLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs b/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs
index 2f7e2769..3cfdc6d6 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/BlockFilter.cs
@@ -4,8 +4,9 @@ using System.IO;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal abstract class BlockFilter : ReadOnlyStream
+ public abstract class BlockFilter : ReadOnlyStream
{
+ [CLSCompliant(false)]
public enum FilterTypes : ulong
{
DELTA = 0x03,
@@ -36,7 +37,6 @@ namespace SharpCompress.Compressors.Xz.Filters
public abstract void Init(byte[] properties);
public abstract void ValidateFilter();
- public FilterTypes FilterType { get; set; }
public static BlockFilter Read(BinaryReader reader)
{
var filterType = (FilterTypes)reader.ReadXZInteger();
diff --git a/src/SharpCompress/Compressors/Xz/Filters/IA64Filter.cs b/src/SharpCompress/Compressors/Xz/Filters/IA64Filter.cs
index a4fb9f1f..5fb8b7d1 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/IA64Filter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/IA64Filter.cs
@@ -14,7 +14,7 @@ using SharpCompress.Compressors.Filters;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class IA64Filter : BlockFilter
+ public class IA64Filter : BlockFilter
{
public override bool AllowAsLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/Lzma2Filter.cs b/src/SharpCompress/Compressors/Xz/Filters/Lzma2Filter.cs
index 0a842f68..7e35187d 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/Lzma2Filter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/Lzma2Filter.cs
@@ -4,7 +4,8 @@ using SharpCompress.Compressors.LZMA;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class Lzma2Filter : BlockFilter
+ [CLSCompliant(false)]
+ public class Lzma2Filter : BlockFilter
{
public override bool AllowAsLast => true;
public override bool AllowAsNonLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/PowerPCFilter.cs b/src/SharpCompress/Compressors/Xz/Filters/PowerPCFilter.cs
index 9c072521..3dfaed6d 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/PowerPCFilter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/PowerPCFilter.cs
@@ -14,7 +14,7 @@ using SharpCompress.Compressors.Filters;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class PowerPCFilter : BlockFilter
+ public class PowerPCFilter : BlockFilter
{
public override bool AllowAsLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/SparcFilter.cs b/src/SharpCompress/Compressors/Xz/Filters/SparcFilter.cs
index eb031e97..4f5e925d 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/SparcFilter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/SparcFilter.cs
@@ -14,7 +14,7 @@ using SharpCompress.Compressors.Filters;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class SparcFilter : BlockFilter
+ public class SparcFilter : BlockFilter
{
public override bool AllowAsLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/Filters/X86Filter.cs b/src/SharpCompress/Compressors/Xz/Filters/X86Filter.cs
index 43115e42..f5fcf924 100644
--- a/src/SharpCompress/Compressors/Xz/Filters/X86Filter.cs
+++ b/src/SharpCompress/Compressors/Xz/Filters/X86Filter.cs
@@ -14,7 +14,7 @@ using SharpCompress.Compressors.Filters;
namespace SharpCompress.Compressors.Xz.Filters
{
- internal class X86Filter : BlockFilter
+ public class X86Filter : BlockFilter
{
public override bool AllowAsLast => false;
diff --git a/src/SharpCompress/Compressors/Xz/XZBlock.cs b/src/SharpCompress/Compressors/Xz/XZBlock.cs
index 6827093b..dc3a010d 100644
--- a/src/SharpCompress/Compressors/Xz/XZBlock.cs
+++ b/src/SharpCompress/Compressors/Xz/XZBlock.cs
@@ -1,5 +1,6 @@
#nullable disable
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -7,7 +8,8 @@ using SharpCompress.Compressors.Xz.Filters;
namespace SharpCompress.Compressors.Xz
{
- internal sealed class XZBlock : XZReadOnlyStream
+ [CLSCompliant(false)]
+ public sealed class XZBlock : XZReadOnlyStream
{
public int BlockHeaderSize => (_blockHeaderSizeByte + 1) * 4;
public ulong? CompressedSize { get; private set; }
diff --git a/src/SharpCompress/Crypto/Crc32Stream.cs b/src/SharpCompress/Crypto/Crc32Stream.cs
index 2651bfbb..635c4677 100644
--- a/src/SharpCompress/Crypto/Crc32Stream.cs
+++ b/src/SharpCompress/Crypto/Crc32Stream.cs
@@ -5,7 +5,8 @@ using System.IO;
namespace SharpCompress.Crypto
{
- internal sealed class Crc32Stream : Stream
+ [CLSCompliant(false)]
+ public sealed class Crc32Stream : Stream
{
public const uint DefaultPolynomial = 0xedb88320u;
public const uint DefaultSeed = 0xffffffffu;
diff --git a/src/SharpCompress/IO/RewindableStream.cs b/src/SharpCompress/IO/RewindableStream.cs
index fc430aae..c30efeb0 100644
--- a/src/SharpCompress/IO/RewindableStream.cs
+++ b/src/SharpCompress/IO/RewindableStream.cs
@@ -3,7 +3,7 @@ using System.IO;
namespace SharpCompress.IO
{
- internal class RewindableStream : Stream
+ public class RewindableStream : Stream
{
private readonly Stream stream;
private MemoryStream bufferStream = new MemoryStream();
diff --git a/src/SharpCompress/IO/StreamingMode.cs b/src/SharpCompress/IO/StreamingMode.cs
index 29d3a147..d2a8a823 100644
--- a/src/SharpCompress/IO/StreamingMode.cs
+++ b/src/SharpCompress/IO/StreamingMode.cs
@@ -1,8 +1,8 @@
namespace SharpCompress.IO
{
- internal enum StreamingMode
+ public enum StreamingMode
{
Streaming,
Seekable
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/ReadOnlyCollection.cs b/src/SharpCompress/ReadOnlyCollection.cs
index 32c2abc8..a116a056 100644
--- a/src/SharpCompress/ReadOnlyCollection.cs
+++ b/src/SharpCompress/ReadOnlyCollection.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace SharpCompress
{
- internal class ReadOnlyCollection : ICollection
+ public class ReadOnlyCollection : ICollection
{
private readonly ICollection collection;
@@ -52,4 +52,4 @@ namespace SharpCompress
throw new NotSupportedException();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Readers/IReaderExtractionListener.cs b/src/SharpCompress/Readers/IReaderExtractionListener.cs
index 4a4adc4e..2edbef17 100644
--- a/src/SharpCompress/Readers/IReaderExtractionListener.cs
+++ b/src/SharpCompress/Readers/IReaderExtractionListener.cs
@@ -2,8 +2,8 @@
namespace SharpCompress.Readers
{
- internal interface IReaderExtractionListener : IExtractionListener
+ public interface IReaderExtractionListener : IExtractionListener
{
void FireEntryExtractionProgress(Entry entry, long sizeTransferred, int iterations);
}
-}
\ No newline at end of file
+}
diff --git a/src/SharpCompress/Utility.cs b/src/SharpCompress/Utility.cs
index cbdb1ecb..3d6f3c58 100644
--- a/src/SharpCompress/Utility.cs
+++ b/src/SharpCompress/Utility.cs
@@ -6,7 +6,8 @@ using SharpCompress.Readers;
namespace SharpCompress
{
- internal static class Utility
+ [CLSCompliant(false)]
+ public static class Utility
{
public static ReadOnlyCollection ToReadOnly(this ICollection items)
{
diff --git a/tests/SharpCompress.Test/ADCTest.cs b/tests/SharpCompress.Test/ADCTest.cs
index 26ea2699..039260c4 100644
--- a/tests/SharpCompress.Test/ADCTest.cs
+++ b/tests/SharpCompress.Test/ADCTest.cs
@@ -46,7 +46,7 @@ namespace SharpCompress.Test
{
byte[] compressed = new byte[cmpFs.Length];
cmpFs.Read(compressed, 0, compressed.Length);
- byte[] test;
+ byte[]? test;
ADCBase.Decompress(compressed, out test);
@@ -65,7 +65,7 @@ namespace SharpCompress.Test
using (FileStream cmpFs = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "adc_compressed.bin")))
{
- byte[] test;
+ byte[]? test;
ADCBase.Decompress(cmpFs, out test);
diff --git a/tests/SharpCompress.Test/ArchiveTests.cs b/tests/SharpCompress.Test/ArchiveTests.cs
index 5c103b78..d93455c0 100644
--- a/tests/SharpCompress.Test/ArchiveTests.cs
+++ b/tests/SharpCompress.Test/ArchiveTests.cs
@@ -24,7 +24,7 @@ namespace SharpCompress.Test
protected void ArchiveStreamReadExtractAll(string testArchive, CompressionType compression)
{
testArchive = Path.Combine(TEST_ARCHIVES_PATH, testArchive);
- ArchiveStreamReadExtractAll(testArchive.AsEnumerable(), compression);
+ ArchiveStreamReadExtractAll(new[] { testArchive }, compression);
}
@@ -73,18 +73,18 @@ namespace SharpCompress.Test
}
}
- protected void ArchiveStreamRead(string testArchive, ReaderOptions readerOptions = null)
+ protected void ArchiveStreamRead(string testArchive, ReaderOptions? readerOptions = null)
{
testArchive = Path.Combine(TEST_ARCHIVES_PATH, testArchive);
- ArchiveStreamRead(readerOptions, testArchive.AsEnumerable());
+ ArchiveStreamRead(readerOptions, testArchive);
}
- protected void ArchiveStreamRead(ReaderOptions readerOptions = null, params string[] testArchives)
+ protected void ArchiveStreamRead(ReaderOptions? readerOptions = null, params string[] testArchives)
{
ArchiveStreamRead(readerOptions, testArchives.Select(x => Path.Combine(TEST_ARCHIVES_PATH, x)));
}
- protected void ArchiveStreamRead(ReaderOptions readerOptions, IEnumerable testArchives)
+ protected void ArchiveStreamRead(ReaderOptions? readerOptions, IEnumerable testArchives)
{
foreach (var path in testArchives)
{
@@ -115,12 +115,12 @@ namespace SharpCompress.Test
}
}
- protected void ArchiveStreamMultiRead(ReaderOptions readerOptions = null, params string[] testArchives)
+ protected void ArchiveStreamMultiRead(ReaderOptions? readerOptions = null, params string[] testArchives)
{
ArchiveStreamMultiRead(readerOptions, testArchives.Select(x => Path.Combine(TEST_ARCHIVES_PATH, x)));
}
- protected void ArchiveStreamMultiRead(ReaderOptions readerOptions, IEnumerable testArchives)
+ protected void ArchiveStreamMultiRead(ReaderOptions? readerOptions, IEnumerable testArchives)
{
using (var archive = ArchiveFactory.Open(testArchives.Select(a => new FileInfo(a)), readerOptions))
{
@@ -144,14 +144,14 @@ namespace SharpCompress.Test
VerifyFiles();
}
- protected void ArchiveOpenStreamRead(ReaderOptions readerOptions = null, params string[] testArchives)
+ protected void ArchiveOpenStreamRead(ReaderOptions? readerOptions = null, params string[] testArchives)
{
ArchiveOpenStreamRead(readerOptions, testArchives.Select(x => Path.Combine(TEST_ARCHIVES_PATH, x)));
}
- protected void ArchiveOpenStreamRead(ReaderOptions readerOptions, IEnumerable testArchives)
+ protected void ArchiveOpenStreamRead(ReaderOptions? readerOptions, IEnumerable testArchives)
{
- using (var archive = ArchiveFactory.Open(testArchives.Select(f => new FileInfo(f)), null))
+ using (var archive = ArchiveFactory.Open(testArchives.Select(f => new FileInfo(f)), readerOptions))
{
try
{
@@ -173,16 +173,16 @@ namespace SharpCompress.Test
VerifyFiles();
}
- protected void ArchiveOpenEntryVolumeIndexTest(int[][] results, ReaderOptions readerOptions = null, params string[] testArchives)
+ protected void ArchiveOpenEntryVolumeIndexTest(int[][] results, ReaderOptions? readerOptions = null, params string[] testArchives)
{
ArchiveOpenEntryVolumeIndexTest(results, readerOptions, testArchives.Select(x => Path.Combine(TEST_ARCHIVES_PATH, x)));
}
- protected void ArchiveOpenEntryVolumeIndexTest(int[][] results, ReaderOptions readerOptions, IEnumerable testArchives)
+ protected void ArchiveOpenEntryVolumeIndexTest(int[][] results, ReaderOptions? readerOptions, IEnumerable testArchives)
{
string[] src = testArchives.ToArray();
- using (var archive = ArchiveFactory.Open(testArchives.Select(f => new FileInfo(f)), null))
+ using (var archive = ArchiveFactory.Open(testArchives.Select(f => new FileInfo(f)), readerOptions))
{
try
{
@@ -206,7 +206,7 @@ namespace SharpCompress.Test
- protected void ArchiveFileRead(string testArchive, ReaderOptions readerOptions = null)
+ protected void ArchiveFileRead(string testArchive, ReaderOptions? readerOptions = null)
{
testArchive = Path.Combine(TEST_ARCHIVES_PATH, testArchive);
using (var archive = ArchiveFactory.Open(testArchive, readerOptions))
diff --git a/tests/SharpCompress.Test/Rar/RarArchiveTests.cs b/tests/SharpCompress.Test/Rar/RarArchiveTests.cs
index 3580aba3..3adf92ea 100644
--- a/tests/SharpCompress.Test/Rar/RarArchiveTests.cs
+++ b/tests/SharpCompress.Test/Rar/RarArchiveTests.cs
@@ -59,7 +59,7 @@ namespace SharpCompress.Test.Rar
ReadRarPassword("Rar5.encrypted_filesAndHeader.rar", "test");
}*/
- private void ReadRarPassword(string testArchive, string password)
+ private void ReadRarPassword(string testArchive, string? password)
{
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, testArchive)))
using (var archive = RarArchive.Open(stream, new ReaderOptions()
diff --git a/tests/SharpCompress.Test/Rar/RarReaderTests.cs b/tests/SharpCompress.Test/Rar/RarReaderTests.cs
index 6affbc7b..0ac4e667 100644
--- a/tests/SharpCompress.Test/Rar/RarReaderTests.cs
+++ b/tests/SharpCompress.Test/Rar/RarReaderTests.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
using System.Linq;
using SharpCompress.Common;
using SharpCompress.Readers;
@@ -232,7 +233,7 @@ namespace SharpCompress.Test.Rar
using (var entryStream = reader.OpenEntryStream())
{
string file = Path.GetFileName(reader.Entry.Key);
- string folder = Path.GetDirectoryName(reader.Entry.Key);
+ string folder = Path.GetDirectoryName(reader.Entry.Key) ?? throw new ArgumentNullException();
string destdir = Path.Combine(SCRATCH_FILES_PATH, folder);
if (!Directory.Exists(destdir))
{
diff --git a/tests/SharpCompress.Test/ReaderTests.cs b/tests/SharpCompress.Test/ReaderTests.cs
index d5cfd9dd..4d230a20 100644
--- a/tests/SharpCompress.Test/ReaderTests.cs
+++ b/tests/SharpCompress.Test/ReaderTests.cs
@@ -9,7 +9,7 @@ namespace SharpCompress.Test
{
public abstract class ReaderTests : TestBase
{
- protected void Read(string testArchive, CompressionType expectedCompression, ReaderOptions options = null)
+ protected void Read(string testArchive, CompressionType expectedCompression, ReaderOptions? options = null)
{
testArchive = Path.Combine(TEST_ARCHIVES_PATH, testArchive);
diff --git a/tests/SharpCompress.Test/Tar/TarReaderTests.cs b/tests/SharpCompress.Test/Tar/TarReaderTests.cs
index 26e7b127..4e299dd2 100644
--- a/tests/SharpCompress.Test/Tar/TarReaderTests.cs
+++ b/tests/SharpCompress.Test/Tar/TarReaderTests.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO;
using SharpCompress.Common;
using SharpCompress.Readers;
@@ -85,7 +86,7 @@ namespace SharpCompress.Test.Tar
using (var entryStream = reader.OpenEntryStream())
{
string file = Path.GetFileName(reader.Entry.Key);
- string folder = Path.GetDirectoryName(reader.Entry.Key);
+ string folder = Path.GetDirectoryName(reader.Entry.Key) ?? throw new ArgumentNullException();
string destdir = Path.Combine(SCRATCH_FILES_PATH, folder);
if (!Directory.Exists(destdir))
{
diff --git a/tests/SharpCompress.Test/TestBase.cs b/tests/SharpCompress.Test/TestBase.cs
index 76a85c49..1ec9a376 100644
--- a/tests/SharpCompress.Test/TestBase.cs
+++ b/tests/SharpCompress.Test/TestBase.cs
@@ -21,7 +21,8 @@ namespace SharpCompress.Test
public TestBase()
{
var index = AppDomain.CurrentDomain.BaseDirectory.IndexOf("SharpCompress.Test", StringComparison.OrdinalIgnoreCase);
- SOLUTION_BASE_PATH = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.Substring(0, index));
+ var path = AppDomain.CurrentDomain.BaseDirectory.Substring(0, index);
+ SOLUTION_BASE_PATH = Path.GetDirectoryName(path) ?? throw new ArgumentNullException();
TEST_ARCHIVES_PATH = Path.Combine(SOLUTION_BASE_PATH, "TestArchives", "Archives");
ORIGINAL_FILES_PATH = Path.Combine(SOLUTION_BASE_PATH, "TestArchives", "Original");
@@ -188,7 +189,7 @@ namespace SharpCompress.Test
Assert.Equal(fi1.Attributes, fi2.Attributes);
}
- protected void CompareArchivesByPath(string file1, string file2, Encoding encoding = null)
+ protected void CompareArchivesByPath(string file1, string file2, Encoding? encoding = null)
{
ReaderOptions readerOptions = new ReaderOptions { LeaveStreamOpen = false };
readerOptions.ArchiveEncoding.Default = encoding ?? Encoding.Default;
diff --git a/tests/SharpCompress.Test/WriterTests.cs b/tests/SharpCompress.Test/WriterTests.cs
index 53c66307..c38fed29 100644
--- a/tests/SharpCompress.Test/WriterTests.cs
+++ b/tests/SharpCompress.Test/WriterTests.cs
@@ -16,7 +16,7 @@ namespace SharpCompress.Test
this.type = type;
}
- protected void Write(CompressionType compressionType, string archive, string archiveToVerifyAgainst, Encoding encoding = null)
+ protected void Write(CompressionType compressionType, string archive, string archiveToVerifyAgainst, Encoding? encoding = null)
{
using (Stream stream = File.OpenWrite(Path.Combine(SCRATCH2_FILES_PATH, archive)))
{
diff --git a/tests/SharpCompress.Test/Xz/XZBlockTests.cs b/tests/SharpCompress.Test/Xz/XZBlockTests.cs
index 50ac0cb1..97e2f704 100644
--- a/tests/SharpCompress.Test/Xz/XZBlockTests.cs
+++ b/tests/SharpCompress.Test/Xz/XZBlockTests.cs
@@ -43,7 +43,7 @@ namespace SharpCompress.Test.Xz
[Fact]
public void CrcIncorrectThrows()
{
- var bytes = Compressed.Clone() as byte[];
+ var bytes = (byte[])Compressed.Clone();
bytes[20]++;
using (Stream badCrcStream = new MemoryStream(bytes))
{
diff --git a/tests/SharpCompress.Test/Xz/XZHeaderTests.cs b/tests/SharpCompress.Test/Xz/XZHeaderTests.cs
index 1fa2a8b5..026c0c17 100644
--- a/tests/SharpCompress.Test/Xz/XZHeaderTests.cs
+++ b/tests/SharpCompress.Test/Xz/XZHeaderTests.cs
@@ -9,7 +9,7 @@ namespace SharpCompress.Test.Xz
[Fact]
public void ChecksMagicNumber()
{
- var bytes = Compressed.Clone() as byte[];
+ var bytes = (byte[])Compressed.Clone();
bytes[3]++;
using (Stream badMagicNumberStream = new MemoryStream(bytes))
{
@@ -23,7 +23,7 @@ namespace SharpCompress.Test.Xz
[Fact]
public void CorruptHeaderThrows()
{
- var bytes = Compressed.Clone() as byte[];
+ var bytes = (byte[])Compressed.Clone();
bytes[8]++;
using (Stream badCrcStream = new MemoryStream(bytes))
{
@@ -37,7 +37,7 @@ namespace SharpCompress.Test.Xz
[Fact]
public void BadVersionIfCrcOkButStreamFlagUnknown()
{
- var bytes = Compressed.Clone() as byte[];
+ var bytes = (byte[])Compressed.Clone();
byte[] streamFlags = { 0x00, 0xF4 };
byte[] crc = Crc32.Compute(streamFlags).ToLittleEndianBytes();
streamFlags.CopyTo(bytes, 6);
diff --git a/tests/SharpCompress.Test/Zip/Zip64Tests.cs b/tests/SharpCompress.Test/Zip/Zip64Tests.cs
index 9a5210e5..8e683f9e 100644
--- a/tests/SharpCompress.Test/Zip/Zip64Tests.cs
+++ b/tests/SharpCompress.Test/Zip/Zip64Tests.cs
@@ -171,7 +171,7 @@ namespace SharpCompress.Test.Zip
{
long count = 0;
long size = 0;
- Common.Zip.ZipEntry prev = null;
+ Common.Zip.ZipEntry? prev = null;
using (var fs = File.OpenRead(filename))
using (var rd = ZipReader.Open(fs, new ReaderOptions() { LookForHeader = false }))
{
diff --git a/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs b/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
index 4ad7e7db..07f158b1 100644
--- a/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
+++ b/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Linq;
using System.Text;
@@ -363,7 +363,7 @@ namespace SharpCompress.Test.Zip
newFileName = newFileName.Substring(1);
}
newFileName = Path.Combine(SCRATCH_FILES_PATH, newFileName);
- var newDir = Path.GetDirectoryName(newFileName);
+ var newDir = Path.GetDirectoryName(newFileName) ?? throw new ArgumentNullException();
if (!Directory.Exists(newDir))
{
Directory.CreateDirectory(newDir);
@@ -419,7 +419,7 @@ namespace SharpCompress.Test.Zip
newFileName = newFileName.Substring(1);
}
newFileName = Path.Combine(SCRATCH_FILES_PATH, newFileName);
- var newDir = Path.GetDirectoryName(newFileName);
+ var newDir = Path.GetDirectoryName(newFileName) ?? throw new ArgumentNullException();
if (!Directory.Exists(newDir))
{
Directory.CreateDirectory(newDir);