Compare commits

...

16 Commits

Author SHA1 Message Date
Adam Hathcock
67be0cd9d7 Mark for 0.34.2 2023-11-15 11:32:51 +00:00
Adam Hathcock
902fadef83 Merge pull request #780 from caesay/cs/revert-disable-strongname
Revert change disabling strong name signing in 92df1ec
2023-11-15 11:22:02 +00:00
Adam Hathcock
2777b6411f Merge branch 'master' into cs/revert-disable-strongname 2023-11-15 11:18:30 +00:00
Adam Hathcock
e3235d7f04 Merge pull request #781 from adamhathcock/fix-formatting
Update csharpier and fix formatting
2023-11-15 11:18:04 +00:00
Adam Hathcock
dc89c8858e comment out more C++ bits 2023-11-15 11:14:39 +00:00
Adam Hathcock
d28a278d63 Comment out flag to allow formatting 2023-11-15 11:10:05 +00:00
Adam Hathcock
7080c2abd0 Update csharpier and fix formatting 2023-11-15 11:05:30 +00:00
Caelan Sayler
43f86bcab8 Revert change disabling strong name signing in 92df1ec 2023-11-14 16:34:58 +00:00
Adam Hathcock
7d9c875c4d Merge pull request #778 from LANCommander/throw-cancelled-exception
Throw ReaderCancelledException on reader cancelled
2023-11-13 08:34:15 +00:00
Pat Hartl
ed4099eb12 Throw ReaderCancelledException on reader cancelled 2023-11-10 23:36:14 -06:00
Adam Hathcock
632b83f75d Mark for 0.34.1 2023-10-02 08:44:14 +01:00
Adam Hathcock
66c92637f9 Merge pull request #769 from Erior/feature/766
Update Zstd to 0.7.2
2023-09-25 09:01:51 +01:00
Adam Hathcock
6bcaebc471 Merge pull request #768 from Erior/feature/761
Feature/761
2023-09-25 09:01:20 +01:00
Lars Vahlenberg
7feee1027c Update Zstd to 0.7.2 2023-09-23 16:02:27 +02:00
Lars Vahlenberg
4fd8c77fa9 CSharpier cleanup 2023-09-23 14:52:39 +02:00
Lars Vahlenberg
bc3bb2d323 Set FilePart properties for directory type 2023-09-23 14:51:08 +02:00
43 changed files with 233 additions and 187 deletions

View File

@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.25.0",
"version": "0.26.1",
"commands": [
"dotnet-csharpier"
]

View File

@@ -25,7 +25,8 @@ public static class ArchiveFactory
public static IWritableArchive Create(ArchiveType type)
{
var factory = Factory.Factories
var factory = Factory
.Factories
.OfType<IWriteableArchiveFactory>()
.FirstOrDefault(item => item.KnownArchiveType == type);

View File

@@ -40,9 +40,9 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
streams[1].Position = 0;
SrcStream.Position = 0;
return srcStream.Streams.Select(
a => new StreamRarArchiveVolume(a, ReaderOptions, idx++)
);
return srcStream
.Streams
.Select(a => new StreamRarArchiveVolume(a, ReaderOptions, idx++));
}
else //split mode or single file
{

View File

@@ -236,11 +236,13 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
}
else
{
currentStream = archive.database.GetFolderStream(
stream,
currentFolder,
new PasswordProvider(Options.Password)
);
currentStream = archive
.database
.GetFolderStream(
stream,
currentFolder,
new PasswordProvider(Options.Password)
);
}
foreach (var entry in group)
{

View File

@@ -1,5 +1,9 @@
#nullable disable
using System;
using System.IO;
using System.Text;
using SharpCompress.IO;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
@@ -8,11 +12,6 @@ using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using SharpCompress.IO;
using System;
using System.IO;
using System.Text;
namespace SharpCompress.Common.Rar.Headers;
internal class FileHeader : RarHeader

View File

@@ -70,11 +70,11 @@ public abstract class RarVolume : Volume
var part = CreateFilePart(lastMarkHeader!, fh);
var buffer = new byte[fh.CompressedSize];
part.GetCompressedStream().Read(buffer, 0, buffer.Length);
Comment = System.Text.Encoding.UTF8.GetString(
buffer,
0,
buffer.Length - 1
);
Comment = System
.Text
.Encoding
.UTF8
.GetString(buffer, 0, buffer.Length - 1);
}
}
break;

View File

@@ -0,0 +1,12 @@
using System;
namespace SharpCompress.Common;
public class ReaderCancelledException : Exception
{
public ReaderCancelledException(string message)
: base(message) { }
public ReaderCancelledException(string message, Exception inner)
: base(message, inner) { }
}

View File

@@ -75,6 +75,9 @@ internal class SevenZipFilePart : FilePart
internal CompressionType GetCompression()
{
if (Header.IsDir)
return CompressionType.None;
var coder = Folder!._coders.First();
switch (coder._methodId._id)
{
@@ -97,5 +100,7 @@ internal class SevenZipFilePart : FilePart
}
internal bool IsEncrypted =>
Folder!._coders.FindIndex(c => c._methodId._id == CMethodId.K_AES_ID) != -1;
Header.IsDir
? false
: Folder!._coders.FindIndex(c => c._methodId._id == CMethodId.K_AES_ID) != -1;
}

View File

@@ -1,6 +1,6 @@
using SharpCompress.IO;
using System;
using System;
using System.IO;
using SharpCompress.IO;
namespace SharpCompress.Common.Tar;

View File

@@ -142,9 +142,9 @@ internal class ZipHeaderFactory
if (entryHeader.CompressionMethod == ZipCompressionMethod.WinzipAes)
{
var data = entryHeader.Extra.SingleOrDefault(
x => x.Type == ExtraDataType.WinZipAes
);
var data = entryHeader
.Extra
.SingleOrDefault(x => x.Type == ExtraDataType.WinZipAes);
if (data != null)
{
var keySize = (WinzipAesKeySize)data.DataBytes[4];

View File

@@ -69,7 +69,6 @@
// -----------------------------------------------------------------------
using System;
using SharpCompress.Algorithms;
namespace SharpCompress.Compressors.Deflate;
@@ -1959,7 +1958,9 @@ internal sealed partial class DeflateManager
// returning Z_STREAM_END instead of Z_BUFF_ERROR.
}
else if (
_codec.AvailableBytesIn == 0 && (int)flush <= old_flush && flush != FlushType.Finish
_codec.AvailableBytesIn == 0
&& (int)flush <= old_flush
&& flush != FlushType.Finish
)
{
// workitem 8557

View File

@@ -64,7 +64,6 @@
// -----------------------------------------------------------------------
using System;
using SharpCompress.Algorithms;
namespace SharpCompress.Compressors.Deflate;

View File

@@ -30,8 +30,8 @@ using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
using SharpCompress.Common.Tar.Headers;
using System.Text;
using SharpCompress.Common.Tar.Headers;
namespace SharpCompress.Compressors.Deflate;

View File

@@ -4,11 +4,11 @@
#nullable disable
using SharpCompress.Common.Zip;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using SharpCompress.Common.Zip;
namespace SharpCompress.Compressors.Deflate64;

View File

@@ -866,7 +866,8 @@ internal partial class Model
);
}
else if (
(currentContext.SummaryFrequency += 4) > 128 + (4 * currentContext.NumberStatistics)
(currentContext.SummaryFrequency += 4)
> 128 + (4 * currentContext.NumberStatistics)
)
{
Refresh((uint)((currentContext.NumberStatistics + 2) >> 1), true, currentContext);

View File

@@ -1269,9 +1269,10 @@ internal sealed partial class Unpack : BitInput, IRarUnpack
if (CurSize < DataSize + RarVM.VM_FIXEDGLOBALSIZE)
{
// StackFilter->Prg.GlobalData.Add(DataSize+VM_FIXEDGLOBALSIZE-CurSize);
StackFilter.Program.GlobalData.SetSize(
DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize
);
StackFilter
.Program
.GlobalData
.SetSize(DataSize + RarVM.VM_FIXEDGLOBALSIZE - CurSize);
}
var offset = RarVM.VM_FIXEDGLOBALSIZE;
globalData = StackFilter.Program.GlobalData;

View File

@@ -1,5 +1,4 @@
using System;
using SharpCompress.Compressors.Rar.VM;
namespace SharpCompress.Compressors.Rar.UnpackV1;

View File

@@ -1,5 +1,6 @@
#nullable disable
using System;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
@@ -7,7 +8,6 @@ using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;
namespace SharpCompress.Compressors.Rar.UnpackV2017;

View File

@@ -1,13 +1,13 @@
#if !Rar2017_64bit
using System;
using System.IO;
using SharpCompress.Common.Rar.Headers;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;
using System.IO;
using SharpCompress.Common.Rar.Headers;
namespace SharpCompress.Compressors.Rar.UnpackV2017;

View File

@@ -1,10 +1,12 @@
#if !Rar2017_64bit
using uint32 = System.UInt32;
/*#if !Rar2017_64bit
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using uint32 = System.UInt32;
#endif*/
namespace SharpCompress.Compressors.Rar.UnpackV2017;

View File

@@ -1,12 +1,14 @@
#if !Rar2017_64bit
using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.Unpack.Unpack20Local;
/*#if !Rar2017_64bit
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.Unpack.Unpack20Local;
#endif*/
namespace SharpCompress.Compressors.Rar.UnpackV2017;

View File

@@ -1,5 +1,9 @@
#nullable disable
using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
using int64 = System.Int64;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
@@ -7,11 +11,6 @@ using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using int64 = System.Int64;
using System;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
namespace SharpCompress.Compressors.Rar.UnpackV2017;

View File

@@ -1,5 +1,9 @@
#nullable disable
using System;
using SharpCompress.Common;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
@@ -8,11 +12,6 @@ using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using System;
using SharpCompress.Common;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
namespace SharpCompress.Compressors.Rar.UnpackV2017;
internal sealed partial class Unpack : BitInput
@@ -30,12 +29,12 @@ internal sealed partial class Unpack : BitInput
Suspended = false;
UnpAllBuf = false;
UnpSomeRead = false;
#if RarV2017_RAR_SMP
MaxUserThreads = 1;
UnpThreadPool = CreateThreadPool();
ReadBufMT = null;
UnpThreadData = null;
#endif
/*#if RarV2017_RAR_SMP
MaxUserThreads = 1;
UnpThreadPool = CreateThreadPool();
ReadBufMT = null;
UnpThreadData = null;
#endif*/
MaxWinSize = 0;
MaxWinMask = 0;
@@ -199,21 +198,21 @@ internal sealed partial class Unpack : BitInput
break;
#endif
case 50: // RAR 5.0 compression algorithm.
#if RarV2017_RAR_SMP
if (MaxUserThreads > 1)
{
// We do not use the multithreaded unpack routine to repack RAR archives
// in 'suspended' mode, because unlike the single threaded code it can
// write more than one dictionary for same loop pass. So we would need
// larger buffers of unknown size. Also we do not support multithreading
// in fragmented window mode.
if (!Fragmented)
{
Unpack5MT(Solid);
break;
}
}
#endif
/*#if RarV2017_RAR_SMP
if (MaxUserThreads > 1)
{
// We do not use the multithreaded unpack routine to repack RAR archives
// in 'suspended' mode, because unlike the single threaded code it can
// write more than one dictionary for same loop pass. So we would need
// larger buffers of unknown size. Also we do not support multithreading
// in fragmented window mode.
if (!Fragmented)
{
Unpack5MT(Solid);
break;
}
}
#endif*/
Unpack5(Solid);
break;
#if !Rar2017_NOSTRICT

View File

@@ -1,10 +1,12 @@
#if !Rar2017_64bit
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
/*#if !Rar2017_64bit
#else
using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
#endif*/
namespace SharpCompress.Compressors.Rar.UnpackV2017;

View File

@@ -1,3 +1,8 @@
using System;
using System.Collections.Generic;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
using int64 = System.Int64;
#if !Rar2017_64bit
using size_t = System.UInt32;
#else
@@ -5,12 +10,6 @@ using nint = System.Int64;
using nuint = System.UInt64;
using size_t = System.UInt64;
#endif
using int64 = System.Int64;
using System.Collections.Generic;
using static SharpCompress.Compressors.Rar.UnpackV2017.PackDef;
using static SharpCompress.Compressors.Rar.UnpackV2017.UnpackGlobal;
using System;
// TODO: REMOVE THIS... WIP
#pragma warning disable 169
@@ -20,8 +19,6 @@ namespace SharpCompress.Compressors.Rar.UnpackV2017;
internal static class UnpackGlobal
{
// Maximum allowed number of compressed bits processed in quick mode.
public const int MAX_QUICK_DECODE_BITS = 10;
@@ -97,11 +94,11 @@ internal struct UnpackBlockHeader
internal struct UnpackBlockTables
{
public DecodeTable LD; // Decode literals.
public DecodeTable DD; // Decode distances.
public DecodeTable LD; // Decode literals.
public DecodeTable DD; // Decode distances.
public DecodeTable LDD; // Decode lower bits of distances.
public DecodeTable RD; // Decode repeating distances.
public DecodeTable BD; // Decode bit lengths in Huffman table.
public DecodeTable RD; // Decode repeating distances.
public DecodeTable BD; // Decode bit lengths in Huffman table.
public void Init()
{
@@ -113,8 +110,7 @@ internal struct UnpackBlockTables
}
};
#if RarV2017_RAR_SMP
/*#if RarV2017_RAR_SMP
enum UNP_DEC_TYPE {
UNPDT_LITERAL,UNPDT_MATCH,UNPDT_FULLREP,UNPDT_REP,UNPDT_FILTER
};
@@ -161,7 +157,7 @@ if (Decoded!=NULL)
free(Decoded);
}
};
#endif
#endif*/
//struct UnpackFilter
@@ -171,12 +167,12 @@ internal class UnpackFilter
public uint BlockStart;
public uint BlockLength;
public byte Channels;
// uint Width;
// byte PosR;
public bool NextWindow;
};
//struct UnpackFilter30
internal class UnpackFilter30
{
@@ -195,15 +191,21 @@ internal class UnpackFilter30
internal class AudioVariables // For RAR 2.0 archives only.
{
public int K1, K2, K3, K4, K5;
public int D1, D2, D3, D4;
public int K1,
K2,
K3,
K4,
K5;
public int D1,
D2,
D3,
D4;
public int LastDelta;
public readonly uint[] Dif = new uint[11];
public uint ByteCount;
public int LastChar;
};
// We can use the fragmented dictionary in case heap does not have the single
// large enough memory block. It is slower than normal dictionary.
internal partial class FragmentedWindow
@@ -223,10 +225,8 @@ internal partial class FragmentedWindow
//size_t GetBlockSize(size_t StartPos,size_t RequiredSize);
};
internal partial class Unpack
{
//void Unpack5(bool Solid);
//void Unpack5MT(bool Solid);
//bool UnpReadBuf();
@@ -254,16 +254,16 @@ internal partial class Unpack
//BitInput Inp;
private BitInput Inp => this; // hopefully this gets inlined
#if RarV2017_RAR_SMP
void InitMT();
bool UnpackLargeBlock(UnpackThreadData &D);
bool ProcessDecoded(UnpackThreadData &D);
ThreadPool *UnpThreadPool;
UnpackThreadData *UnpThreadData;
uint MaxUserThreads;
byte *ReadBufMT;
#endif
/*#if RarV2017_RAR_SMP
void InitMT();
bool UnpackLargeBlock(UnpackThreadData &D);
bool ProcessDecoded(UnpackThreadData &D);
ThreadPool *UnpThreadPool;
UnpackThreadData *UnpThreadData;
uint MaxUserThreads;
byte *ReadBufMT;
#endif*/
private byte[] FilterSrcMemory = Array.Empty<byte>();
private byte[] FilterDstMemory = Array.Empty<byte>();
@@ -279,7 +279,8 @@ byte *ReadBufMT;
// array. In RAR3 last distance is always stored in OldDist[0].
private uint LastDist;
private size_t UnpPtr, WrPtr;
private size_t UnpPtr,
WrPtr;
// Top border of read packed data.
private int ReadTop;
@@ -307,7 +308,6 @@ byte *ReadBufMT;
private int64 WrittenFileSize;
private bool FileExtracted;
/***************************** Unpack v 1.5 *********************************/
//void Unpack15(bool Solid);
//void ShortLZ();
@@ -320,12 +320,29 @@ byte *ReadBufMT;
//void CopyString15(uint Distance,uint Length);
//uint DecodeNum(uint Num,uint StartPos,uint *DecTab,uint *PosTab);
private readonly ushort[] ChSet = new ushort[256], ChSetA = new ushort[256], ChSetB = new ushort[256], ChSetC = new ushort[256];
private readonly byte[] NToPl = new byte[256], NToPlB = new byte[256], NToPlC = new byte[256];
private uint FlagBuf, AvrPlc, AvrPlcB, AvrLn1, AvrLn2, AvrLn3;
private int Buf60, NumHuf, StMode, LCount, FlagsCnt;
private readonly ushort[] ChSet = new ushort[256],
ChSetA = new ushort[256],
ChSetB = new ushort[256],
ChSetC = new ushort[256];
private readonly byte[] NToPl = new byte[256],
NToPlB = new byte[256],
NToPlC = new byte[256];
private uint FlagBuf,
AvrPlc,
AvrPlcB,
AvrLn1,
AvrLn2,
AvrLn3;
private int Buf60,
NumHuf,
StMode,
LCount,
FlagsCnt;
private uint Nhfb,
Nlzb,
MaxDist3;
private uint Nhfb, Nlzb, MaxDist3;
/***************************** Unpack v 1.5 *********************************/
/***************************** Unpack v 2.0 *********************************/
@@ -335,9 +352,11 @@ byte *ReadBufMT;
private readonly byte[] UnpOldTable20 = new byte[MC20 * 4];
private bool UnpAudioBlock;
private uint UnpChannels, UnpCurChannel;
private uint UnpChannels,
UnpCurChannel;
private int UnpChannelDelta;
//void CopyString20(uint Length,uint Distance);
//bool ReadTables20();
//void UnpWriteBuf20();
@@ -345,6 +364,7 @@ byte *ReadBufMT;
//void ReadLastTables();
//byte DecodeAudio(int Delta);
private AudioVariables[] AudV = new AudioVariables[4];
/***************************** Unpack v 2.0 *********************************/
/***************************** Unpack v 3.0 *********************************/
@@ -363,7 +383,8 @@ byte *ReadBufMT;
// because we can have a corrupt archive with one algorithm file
// followed by another algorithm file with "solid" flag and we do not
// want to reuse tables from one algorithm in another.
private bool TablesRead2, TablesRead5;
private bool TablesRead2,
TablesRead5;
// Virtual machine to execute filters code.
/*#if !RarV2017_RAR5ONLY
@@ -385,13 +406,13 @@ byte *ReadBufMT;
// the data block length if lengths are repeating.
private readonly List<int> OldFilterLengths = new List<int>();
#if RarV2017_RAR_SMP
// More than 8 threads are unlikely to provide a noticeable gain
// for unpacking, but would use the additional memory.
void SetThreads(uint Threads) {MaxUserThreads=Min(Threads,8);}
void UnpackDecode(UnpackThreadData &D);
#endif
/*#if RarV2017_RAR_SMP
// More than 8 threads are unlikely to provide a noticeable gain
// for unpacking, but would use the additional memory.
void SetThreads(uint Threads) {MaxUserThreads=Min(Threads,8);}
void UnpackDecode(UnpackThreadData &D);
#endif*/
private size_t MaxWinSize;
private size_t MaxWinMask;

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using SharpCompress.Archives;
using SharpCompress.Archives.GZip;
using SharpCompress.Archives.Tar;

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.IO;
using SharpCompress.Archives;
using SharpCompress.Archives.Tar;
using SharpCompress.Common;

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.IO;
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
using SharpCompress.Common;

View File

@@ -75,7 +75,7 @@ public abstract class AbstractReader<TEntry, TVolume> : IReader, IReaderExtracti
}
if (Cancelled)
{
throw new InvalidOperationException("Reader has been cancelled.");
throw new ReaderCancelledException("Reader has been cancelled.");
}
if (entriesForCurrentReadStream is null)
{

View File

@@ -8,9 +8,9 @@ using SharpCompress.Common.Tar;
using SharpCompress.Compressors;
using SharpCompress.Compressors.BZip2;
using SharpCompress.Compressors.Deflate;
using SharpCompress.IO;
using SharpCompress.Compressors.LZMA;
using SharpCompress.Compressors.Xz;
using SharpCompress.IO;
namespace SharpCompress.Readers.Tar;

View File

@@ -2,14 +2,14 @@
<PropertyGroup>
<AssemblyTitle>SharpCompress - Pure C# Decompression/Compression</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>0.34.0</VersionPrefix>
<AssemblyVersion>0.34.0</AssemblyVersion>
<FileVersion>0.34.0</FileVersion>
<VersionPrefix>0.34.2</VersionPrefix>
<AssemblyVersion>0.34.2</AssemblyVersion>
<FileVersion>0.34.2</FileVersion>
<Authors>Adam Hathcock</Authors>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<AssemblyName>SharpCompress</AssemblyName>
<AssemblyOriginatorKeyFile>../../SharpCompress.snk</AssemblyOriginatorKeyFile>
<SignAssembly>False</SignAssembly>
<SignAssembly>true</SignAssembly>
<PackageId>SharpCompress</PackageId>
<PackageTags>rar;unrar;zip;unzip;bzip2;gzip;tar;7zip;lzip;xz</PackageTags>
<PackageProjectUrl>https://github.com/adamhathcock/sharpcompress</PackageProjectUrl>
@@ -23,12 +23,12 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsTrimmable>true</IsTrimmable>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="ZstdSharp.Port" Version="0.6.1" />
<PackageReference Include="ZstdSharp.Port" Version="0.7.2" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />

View File

@@ -1,5 +1,4 @@
using System.IO;
using SharpCompress.Factories;
namespace SharpCompress.Writers;

View File

@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using SharpCompress.Common;
namespace SharpCompress.Writers;
@@ -10,7 +9,9 @@ public static class WriterFactory
{
public static IWriter Open(Stream stream, ArchiveType archiveType, WriterOptions writerOptions)
{
var factory = Factories.Factory.Factories
var factory = Factories
.Factory
.Factories
.OfType<IWriterFactory>()
.FirstOrDefault(item => item.KnownArchiveType == archiveType);

View File

@@ -298,10 +298,10 @@ public class ArchiveTests : ReaderTests
memory.Position = 0;
for (int y = 0; y < 9; y++)
for (int x = 0; x < 256; x++)
{
Assert.Equal(x, memory.ReadByte());
}
for (int x = 0; x < 256; x++)
{
Assert.Equal(x, memory.ReadByte());
}
Assert.Equal((int)-1, memory.ReadByte());
}

View File

@@ -1,15 +1,15 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using SharpCompress.Archives;
using SharpCompress.Archives.Tar;
using SharpCompress.Common;
using SharpCompress.Writers;
using Xunit;
using System.Text;
using SharpCompress.Readers;
using SharpCompress.Writers.Tar;
using SharpCompress.Readers.Tar;
using SharpCompress.Writers;
using SharpCompress.Writers.Tar;
using Xunit;
namespace SharpCompress.Test.Tar;
@@ -198,9 +198,9 @@ public class TarArchiveTests : ArchiveTests
using (var archive = TarArchive.Open(unmodified))
{
var entry = archive.Entries.Single(
x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
);
var entry = archive
.Entries
.Single(x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase));
archive.RemoveEntry(entry);
archive.SaveTo(scratchPath, CompressionType.None);
}

View File

@@ -206,9 +206,11 @@ public class TarReaderTests : ReaderTests
[Fact]
public void Tar_GZip_With_Symlink_Entries()
{
var isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
System.Runtime.InteropServices.OSPlatform.Windows
);
var isWindows = System
.Runtime
.InteropServices
.RuntimeInformation
.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
using (
Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "TarWithSymlink.tar.gz"))
)
@@ -251,12 +253,15 @@ public class TarReaderTests : ReaderTests
{
// need to convert the link to an absolute path for comparison
var target = reader.Entry.LinkTarget;
var realTarget = System.IO.Path.GetFullPath(
System.IO.Path.Combine(
$"{System.IO.Path.GetDirectoryName(path)}",
target
)
);
var realTarget = System
.IO
.Path
.GetFullPath(
System
.IO
.Path
.Combine($"{System.IO.Path.GetDirectoryName(path)}", target)
);
Assert.Equal(realTarget, link.GetContents().ToString());
}

View File

@@ -20,10 +20,10 @@ public class TestBase : IDisposable
public TestBase()
{
var index = AppDomain.CurrentDomain.BaseDirectory.IndexOf(
"SharpCompress.Test",
StringComparison.OrdinalIgnoreCase
);
var index = AppDomain
.CurrentDomain
.BaseDirectory
.IndexOf("SharpCompress.Test", StringComparison.OrdinalIgnoreCase);
var path = AppDomain.CurrentDomain.BaseDirectory.Substring(0, index);
SOLUTION_BASE_PATH = Path.GetDirectoryName(path) ?? throw new ArgumentNullException();

View File

@@ -1,7 +1,7 @@
using System;
using Xunit;
using System.IO;
using SharpCompress.Compressors.Xz.Filters;
using Xunit;
namespace SharpCompress.Test.Xz.Filters;

View File

@@ -1,5 +1,5 @@
using SharpCompress.Compressors.Xz;
using System.IO;
using SharpCompress.Compressors.Xz;
using Xunit;
namespace SharpCompress.Test.Xz;

View File

@@ -1,5 +1,5 @@
using SharpCompress.Compressors.Xz;
using System.IO;
using System.IO;
using SharpCompress.Compressors.Xz;
using Xunit;
namespace SharpCompress.Test.Xz;

View File

@@ -1,5 +1,5 @@
using SharpCompress.Compressors.Xz;
using System.IO;
using System.IO;
using SharpCompress.Compressors.Xz;
using Xunit;
namespace SharpCompress.Test.Xz;

View File

@@ -184,9 +184,9 @@ public class ZipArchiveTests : ArchiveTests
using (var archive = ZipArchive.Open(unmodified))
{
var entry = archive.Entries.Single(
x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
);
var entry = archive
.Entries
.Single(x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase));
archive.RemoveEntry(entry);
WriterOptions writerOptions = new ZipWriterOptions(CompressionType.Deflate);
@@ -252,9 +252,9 @@ public class ZipArchiveTests : ArchiveTests
)
);
Assert.Null(
((IArchive)vfs).Entries.FirstOrDefault(
v => v.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
)
((IArchive)vfs)
.Entries
.FirstOrDefault(v => v.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))
);
}
}
@@ -391,14 +391,14 @@ public class ZipArchiveTests : ArchiveTests
{
archive.AddAllFromDirectory(SCRATCH_FILES_PATH);
archive.RemoveEntry(
archive.Entries.Single(
x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
)
archive
.Entries
.Single(x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))
);
Assert.Null(
archive.Entries.FirstOrDefault(
x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
)
archive
.Entries
.FirstOrDefault(x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))
);
}
Directory.Delete(SCRATCH_FILES_PATH, true);

View File

@@ -1,5 +1,4 @@
using System.Text;
using SharpCompress.Common;
using Xunit;