diff --git a/.editorconfig b/.editorconfig
index 1903a97c..eab3d428 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -70,7 +70,7 @@ indent_style = tab
[*.{cs,csx,cake,vb,vbx}]
# Default Severity for all .NET Code Style rules below
-dotnet_analyzer_diagnostic.severity = warning
+dotnet_analyzer_diagnostic.severity = silent
##########################################
# File Header (Uncomment to support file headers)
@@ -269,6 +269,8 @@ dotnet_diagnostic.CA1305.severity = suggestion
dotnet_diagnostic.CA1307.severity = suggestion
dotnet_diagnostic.CA1309.severity = suggestion
dotnet_diagnostic.CA1310.severity = error
+dotnet_diagnostic.CA1507.severity = suggestion
+dotnet_diagnostic.CA1513.severity = suggestion
dotnet_diagnostic.CA1707.severity = suggestion
dotnet_diagnostic.CA1708.severity = suggestion
dotnet_diagnostic.CA1711.severity = suggestion
@@ -286,6 +288,7 @@ dotnet_diagnostic.CA1834.severity = error
dotnet_diagnostic.CA1845.severity = suggestion
dotnet_diagnostic.CA1848.severity = suggestion
dotnet_diagnostic.CA1852.severity = suggestion
+dotnet_diagnostic.CA1860.severity = silent
dotnet_diagnostic.CA2016.severity = suggestion
dotnet_diagnostic.CA2201.severity = error
dotnet_diagnostic.CA2206.severity = error
@@ -303,13 +306,12 @@ dotnet_diagnostic.CS1998.severity = error
dotnet_diagnostic.CS8602.severity = error
dotnet_diagnostic.CS8604.severity = error
dotnet_diagnostic.CS8618.severity = error
-dotnet_diagnostic.CS0618.severity = error
+dotnet_diagnostic.CS0618.severity = suggestion
dotnet_diagnostic.CS1998.severity = error
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
@@ -318,7 +320,7 @@ dotnet_diagnostic.MVC1000.severity = suggestion
dotnet_diagnostic.RZ10012.severity = error
dotnet_diagnostic.IDE0004.severity = error # redundant cast
-dotnet_diagnostic.IDE0005.severity = error
+dotnet_diagnostic.IDE0005.severity = suggestion
dotnet_diagnostic.IDE0007.severity = error # Use var
dotnet_diagnostic.IDE0011.severity = error # Use braces on if statements
dotnet_diagnostic.IDE0010.severity = silent # populate switch
@@ -329,7 +331,7 @@ dotnet_diagnostic.IDE0023.severity = suggestion # use expression body for operat
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.IDE0028.severity = silent # expression body for accessors
dotnet_diagnostic.IDE0032.severity = suggestion # Use auto property
dotnet_diagnostic.IDE0033.severity = error # prefer tuple name
dotnet_diagnostic.IDE0037.severity = suggestion # simplify anonymous type
@@ -337,7 +339,7 @@ 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 = suggestion # make field only when possible
-dotnet_diagnostic.IDE0047.severity = suggestion # paratemeter name
+dotnet_diagnostic.IDE0047.severity = suggestion # parameter name
dotnet_diagnostic.IDE0051.severity = error # unused field
dotnet_diagnostic.IDE0052.severity = error # unused member
dotnet_diagnostic.IDE0053.severity = suggestion # lambda not needed
@@ -351,11 +353,20 @@ 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 = error # namespace folder structure
+dotnet_diagnostic.IDE0130.severity = suggestion # namespace folder structure
dotnet_diagnostic.IDE0160.severity = silent # Use block namespaces ARE NOT required
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
+dotnet_diagnostic.IDE0260.severity = suggestion # Use pattern matching
+dotnet_diagnostic.IDE0270.severity = suggestion # Null check simplifcation
+dotnet_diagnostic.IDE0290.severity = error # Primary Constructor
+dotnet_diagnostic.IDE0300.severity = suggestion # Collection
+dotnet_diagnostic.IDE0305.severity = suggestion # Collection ToList
+
+dotnet_diagnostic.NX0001.severity = error
+dotnet_diagnostic.NX0002.severity = silent
+dotnet_diagnostic.NX0003.severity = silent
##########################################
# Styles
diff --git a/README.md b/README.md
index 8eb4c10d..2a707028 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# SharpCompress
-SharpCompress is a compression library in pure C# for .NET Standard 2.0, 2.1, .NET Core 3.1 and .NET 5.0 that can unrar, un7zip, unzip, untar unbzip2, ungzip, unlzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip/lzip are implemented.
+SharpCompress is a compression library in pure C# for .NET Framework 4.62, .NET Standard 2.1, .NET 6.0 and NET 8.0 that can unrar, un7zip, unzip, untar unbzip2, ungzip, unlzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip/lzip are implemented.
The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream).
diff --git a/SharpCompress.sln b/SharpCompress.sln
index 71ec294e..34e23bfd 100644
--- a/SharpCompress.sln
+++ b/SharpCompress.sln
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{CDB425
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
global.json = global.json
+ .editorconfig = .editorconfig
EndProjectSection
EndProject
Global
diff --git a/build/build.csproj b/build/build.csproj
index 7b478cf3..27c0a257 100644
--- a/build/build.csproj
+++ b/build/build.csproj
@@ -6,9 +6,9 @@
-
+
-
+
diff --git a/src/SharpCompress/Algorithms/Adler32.cs b/src/SharpCompress/Algorithms/Adler32.cs
index 10dbfc4d..51d5f53d 100644
--- a/src/SharpCompress/Algorithms/Adler32.cs
+++ b/src/SharpCompress/Algorithms/Adler32.cs
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
-#if !NETSTANDARD2_0 && !NETSTANDARD2_1 && !NETFRAMEWORK
+#if !NETSTANDARD2_1 && !NETFRAMEWORK
#define SUPPORTS_RUNTIME_INTRINSICS
#define SUPPORTS_HOTPATH
#endif
diff --git a/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs b/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
index 0b692035..adffaaea 100644
--- a/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
+++ b/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
@@ -48,7 +48,7 @@ internal class WinzipAesEncryptionData
private void Initialize()
{
-#if NETFRAMEWORK || NETSTANDARD2_0
+#if NETFRAMEWORK
var rfc2898 = new Rfc2898DeriveBytes(_password, _salt, RFC2898_ITERATIONS);
#else
var rfc2898 = new Rfc2898DeriveBytes(
diff --git a/src/SharpCompress/Compressors/BZip2/BZip2Stream.cs b/src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
index feea12d1..e5614096 100644
--- a/src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
+++ b/src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
@@ -69,7 +69,7 @@ public sealed class BZip2Stream : Stream
public override void SetLength(long value) => stream.SetLength(value);
-#if !NETFRAMEWORK && !NETSTANDARD2_0
+#if !NETFRAMEWORK
public override int Read(Span buffer) => stream.Read(buffer);
diff --git a/src/SharpCompress/Compressors/LZMA/AesDecoderStream.cs b/src/SharpCompress/Compressors/LZMA/AesDecoderStream.cs
index 8e884c97..48e8ef34 100644
--- a/src/SharpCompress/Compressors/LZMA/AesDecoderStream.cs
+++ b/src/SharpCompress/Compressors/LZMA/AesDecoderStream.cs
@@ -207,28 +207,6 @@ internal sealed class AesDecoderStream : DecoderStream2
}
else
{
-#if NETSTANDARD2_0
- using var sha = IncrementalHash.CreateHash(HashAlgorithmName.SHA256);
- var counter = new byte[8];
- var numRounds = 1L << mNumCyclesPower;
- for (long round = 0; round < numRounds; round++)
- {
- sha.AppendData(salt, 0, salt.Length);
- sha.AppendData(pass, 0, pass.Length);
- sha.AppendData(counter, 0, 8);
-
- // This mirrors the counter so we don't have to convert long to byte[] each round.
- // (It also ensures the counter is little endian, which BitConverter does not.)
- for (var i = 0; i < 8; i++)
- {
- if (++counter[i] != 0)
- {
- break;
- }
- }
- }
- return sha.GetHashAndReset();
-#else
using var sha = SHA256.Create();
var counter = new byte[8];
var numRounds = 1L << mNumCyclesPower;
@@ -251,7 +229,6 @@ internal sealed class AesDecoderStream : DecoderStream2
sha.TransformFinalBlock(counter, 0, 0);
return sha.Hash;
-#endif
}
}
diff --git a/src/SharpCompress/Compressors/LZMA/LZipStream.cs b/src/SharpCompress/Compressors/LZMA/LZipStream.cs
index 4b63a621..0e620dcf 100644
--- a/src/SharpCompress/Compressors/LZMA/LZipStream.cs
+++ b/src/SharpCompress/Compressors/LZMA/LZipStream.cs
@@ -125,7 +125,7 @@ public sealed class LZipStream : Stream
public override void SetLength(long value) => throw new NotImplementedException();
-#if !NETFRAMEWORK && !NETSTANDARD2_0
+#if !NETFRAMEWORK
public override int Read(Span buffer) => _stream.Read(buffer);
diff --git a/src/SharpCompress/Crypto/Crc32Stream.cs b/src/SharpCompress/Crypto/Crc32Stream.cs
index 5f5ccd87..137131a3 100644
--- a/src/SharpCompress/Crypto/Crc32Stream.cs
+++ b/src/SharpCompress/Crypto/Crc32Stream.cs
@@ -29,7 +29,7 @@ public sealed class Crc32Stream(Stream stream, uint polynomial, uint seed) : Str
public override void SetLength(long value) => throw new NotSupportedException();
-#if !NETFRAMEWORK && !NETSTANDARD2_0
+#if !NETFRAMEWORK
public override void Write(ReadOnlySpan buffer)
{
diff --git a/src/SharpCompress/IO/NonDisposingStream.cs b/src/SharpCompress/IO/NonDisposingStream.cs
index 334296d7..6d9e4174 100644
--- a/src/SharpCompress/IO/NonDisposingStream.cs
+++ b/src/SharpCompress/IO/NonDisposingStream.cs
@@ -63,7 +63,7 @@ public class NonDisposingStream : Stream
public override void Write(byte[] buffer, int offset, int count) =>
Stream.Write(buffer, offset, count);
-#if !NETFRAMEWORK && !NETSTANDARD2_0
+#if !NETFRAMEWORK
public override int Read(Span buffer) => Stream.Read(buffer);
diff --git a/src/SharpCompress/IO/ReadOnlySubStream.cs b/src/SharpCompress/IO/ReadOnlySubStream.cs
index cd39335e..301e27ca 100644
--- a/src/SharpCompress/IO/ReadOnlySubStream.cs
+++ b/src/SharpCompress/IO/ReadOnlySubStream.cs
@@ -69,7 +69,7 @@ internal class ReadOnlySubStream : NonDisposingStream
return value;
}
-#if !NETFRAMEWORK && !NETSTANDARD2_0
+#if !NETFRAMEWORK
public override int Read(Span buffer)
{
var sliceLen = BytesLeftToRead < buffer.Length ? BytesLeftToRead : buffer.Length;
diff --git a/src/SharpCompress/Polyfills/StreamExtensions.cs b/src/SharpCompress/Polyfills/StreamExtensions.cs
index ab118a4f..360d041d 100644
--- a/src/SharpCompress/Polyfills/StreamExtensions.cs
+++ b/src/SharpCompress/Polyfills/StreamExtensions.cs
@@ -1,4 +1,4 @@
-#if NETFRAMEWORK || NETSTANDARD2_0
+#if NETFRAMEWORK
using System;
using System.Buffers;
diff --git a/src/SharpCompress/Polyfills/StringExtensions.cs b/src/SharpCompress/Polyfills/StringExtensions.cs
index 57d1e1bc..1cd22b8a 100644
--- a/src/SharpCompress/Polyfills/StringExtensions.cs
+++ b/src/SharpCompress/Polyfills/StringExtensions.cs
@@ -1,4 +1,4 @@
-#if NETFRAMEWORK || NETSTANDARD2_0
+#if NETFRAMEWORK
namespace SharpCompress;
diff --git a/src/SharpCompress/SharpCompress.csproj b/src/SharpCompress/SharpCompress.csproj
index dec8a386..65904deb 100644
--- a/src/SharpCompress/SharpCompress.csproj
+++ b/src/SharpCompress/SharpCompress.csproj
@@ -6,7 +6,7 @@
0.36.0
0.36.0
Adam Hathcock
- net462;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0
+ net462;netstandard2.1;net6.0;net8.0
SharpCompress
../../SharpCompress.snk
true
@@ -17,7 +17,7 @@
Copyright (c) 2014 Adam Hathcock
false
false
- SharpCompress is a compression library for NET Standard 2.0/2.1/NET 6.0/NET 7.0 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.
+ SharpCompress is a compression library for NET Standard 2.1/NET 6.0/NET 8.0 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.
true
true
snupkg
@@ -26,21 +26,14 @@
true
README.md
-
-
-
-
+
-
-
-
-
diff --git a/tests/SharpCompress.Test/SharpCompress.Test.csproj b/tests/SharpCompress.Test/SharpCompress.Test.csproj
index e1f75276..8b10a738 100644
--- a/tests/SharpCompress.Test/SharpCompress.Test.csproj
+++ b/tests/SharpCompress.Test/SharpCompress.Test.csproj
@@ -9,12 +9,12 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs b/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
index 1948b26a..68fe4e26 100644
--- a/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
+++ b/tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
@@ -646,7 +646,7 @@ public class ZipArchiveTests : ArchiveTests
Assert.Equal(199, len1);
-#if !NETFRAMEWORK && !NETSTANDARD2_0
+#if !NETFRAMEWORK
var len2 = 0;
var buffer2 = new byte[firstEntry.Size + 256];