Merge branch 'master' into adam/xz-wrapped-often
This commit is contained in:
commit
1db511e9cb
30 changed files with 1058 additions and 425 deletions
|
|
@ -1,18 +1,17 @@
|
|||
<Project>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Bullseye" Version="6.0.0" />
|
||||
<PackageVersion Include="AwesomeAssertions" Version="9.2.0" />
|
||||
<PackageVersion Include="AwesomeAssertions" Version="9.2.1" />
|
||||
<PackageVersion Include="Glob" Version="1.1.9" />
|
||||
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
||||
<PackageVersion Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||
<PackageVersion Include="SimpleExec" Version="12.0.0" />
|
||||
<PackageVersion Include="System.Buffers" Version="4.6.0" />
|
||||
<PackageVersion Include="System.Memory" Version="4.6.0" />
|
||||
<PackageVersion Include="System.Buffers" Version="4.6.1" />
|
||||
<PackageVersion Include="System.Memory" Version="4.6.3" />
|
||||
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
|
||||
<PackageVersion Include="xunit" Version="2.9.3" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
|
||||
<PackageVersion Include="xunit.SkippableFact" Version="1.5.23" />
|
||||
<PackageVersion Include="ZstdSharp.Port" Version="0.8.6" />
|
||||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
|
||||
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public static class ArchiveFactory
|
|||
/// <param name="options"></param>
|
||||
public static IArchive Open(string filePath, ReaderOptions? options = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return Open(new FileInfo(filePath), options);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public static class ArchiveFactory
|
|||
/// <param name="options"></param>
|
||||
public static IArchive Open(IEnumerable<FileInfo> fileInfos, ReaderOptions? options = null)
|
||||
{
|
||||
fileInfos.CheckNotNull(nameof(fileInfos));
|
||||
fileInfos.NotNull(nameof(fileInfos));
|
||||
var filesArray = fileInfos.ToArray();
|
||||
if (filesArray.Length == 0)
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ public static class ArchiveFactory
|
|||
return Open(fileInfo, options);
|
||||
}
|
||||
|
||||
fileInfo.CheckNotNull(nameof(fileInfo));
|
||||
fileInfo.NotNull(nameof(fileInfo));
|
||||
options ??= new ReaderOptions { LeaveStreamOpen = false };
|
||||
|
||||
return FindFactory<IMultiArchiveFactory>(fileInfo).Open(filesArray, options);
|
||||
|
|
@ -94,7 +94,7 @@ public static class ArchiveFactory
|
|||
/// <param name="options"></param>
|
||||
public static IArchive Open(IEnumerable<Stream> streams, ReaderOptions? options = null)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
var streamsArray = streams.ToArray();
|
||||
if (streamsArray.Length == 0)
|
||||
{
|
||||
|
|
@ -107,7 +107,7 @@ public static class ArchiveFactory
|
|||
return Open(firstStream, options);
|
||||
}
|
||||
|
||||
firstStream.CheckNotNull(nameof(firstStream));
|
||||
firstStream.NotNull(nameof(firstStream));
|
||||
options ??= new ReaderOptions();
|
||||
|
||||
return FindFactory<IMultiArchiveFactory>(firstStream).Open(streamsArray, options);
|
||||
|
|
@ -129,7 +129,7 @@ public static class ArchiveFactory
|
|||
private static T FindFactory<T>(FileInfo finfo)
|
||||
where T : IFactory
|
||||
{
|
||||
finfo.CheckNotNull(nameof(finfo));
|
||||
finfo.NotNull(nameof(finfo));
|
||||
using Stream stream = finfo.OpenRead();
|
||||
return FindFactory<T>(stream);
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ public static class ArchiveFactory
|
|||
private static T FindFactory<T>(Stream stream)
|
||||
where T : IFactory
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
if (!stream.CanRead || !stream.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Stream should be readable and seekable");
|
||||
|
|
@ -172,7 +172,7 @@ public static class ArchiveFactory
|
|||
int bufferSize = ReaderOptions.DefaultBufferSize
|
||||
)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
using Stream s = File.OpenRead(filePath);
|
||||
return IsArchive(s, out type, bufferSize);
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ public static class ArchiveFactory
|
|||
)
|
||||
{
|
||||
type = null;
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
|
||||
if (!stream.CanRead || !stream.CanSeek)
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ public static class ArchiveFactory
|
|||
/// <returns></returns>
|
||||
public static IEnumerable<string> GetFileParts(string part1)
|
||||
{
|
||||
part1.CheckNotNullOrEmpty(nameof(part1));
|
||||
part1.NotNullOrEmpty(nameof(part1));
|
||||
return GetFileParts(new FileInfo(part1)).Select(a => a.FullName);
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ public static class ArchiveFactory
|
|||
/// <returns></returns>
|
||||
public static IEnumerable<FileInfo> GetFileParts(FileInfo part1)
|
||||
{
|
||||
part1.CheckNotNull(nameof(part1));
|
||||
part1.NotNull(nameof(part1));
|
||||
yield return part1;
|
||||
|
||||
foreach (var factory in Factory.Factories.OfType<IFactory>())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(string filePath, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return Open(new FileInfo(filePath), readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(FileInfo fileInfo, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
fileInfo.CheckNotNull(nameof(fileInfo));
|
||||
fileInfo.NotNull(nameof(fileInfo));
|
||||
return new GZipArchive(
|
||||
new SourceStream(
|
||||
fileInfo,
|
||||
|
|
@ -52,7 +52,7 @@ public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
|||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
fileInfos.CheckNotNull(nameof(fileInfos));
|
||||
fileInfos.NotNull(nameof(fileInfos));
|
||||
var files = fileInfos.ToArray();
|
||||
return new GZipArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -70,7 +70,7 @@ public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(IEnumerable<Stream> streams, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
var strms = streams.ToArray();
|
||||
return new GZipArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -88,7 +88,7 @@ public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(Stream stream, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
|
||||
if (stream is not { CanSeek: true })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public static class IArchiveEntryExtensions
|
|||
using (entryStream)
|
||||
{
|
||||
using Stream s = new ListeningStream(streamListener, entryStream);
|
||||
s.TransferTo(streamToWriteTo);
|
||||
s.CopyTo(streamToWriteTo);
|
||||
}
|
||||
streamListener.FireEntryExtractionEnd(archiveEntry);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
|||
/// <param name="options"></param>
|
||||
public static RarArchive Open(string filePath, ReaderOptions? options = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
var fileInfo = new FileInfo(filePath);
|
||||
return new RarArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -113,7 +113,7 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
|||
/// <param name="options"></param>
|
||||
public static RarArchive Open(FileInfo fileInfo, ReaderOptions? options = null)
|
||||
{
|
||||
fileInfo.CheckNotNull(nameof(fileInfo));
|
||||
fileInfo.NotNull(nameof(fileInfo));
|
||||
return new RarArchive(
|
||||
new SourceStream(
|
||||
fileInfo,
|
||||
|
|
@ -130,7 +130,7 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
|||
/// <param name="options"></param>
|
||||
public static RarArchive Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
|
||||
if (stream is not { CanSeek: true })
|
||||
{
|
||||
|
|
@ -150,7 +150,7 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
|||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
fileInfos.CheckNotNull(nameof(fileInfos));
|
||||
fileInfos.NotNull(nameof(fileInfos));
|
||||
var files = fileInfos.ToArray();
|
||||
return new RarArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -168,7 +168,7 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static RarArchive Open(IEnumerable<Stream> streams, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
var strms = streams.ToArray();
|
||||
return new RarArchive(
|
||||
new SourceStream(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
|
|||
/// <param name="readerOptions"></param>
|
||||
public static SevenZipArchive Open(string filePath, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty("filePath");
|
||||
filePath.NotNullOrEmpty("filePath");
|
||||
return Open(new FileInfo(filePath), readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
|
|||
/// <param name="readerOptions"></param>
|
||||
public static SevenZipArchive Open(FileInfo fileInfo, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
fileInfo.NotNull("fileInfo");
|
||||
return new SevenZipArchive(
|
||||
new SourceStream(
|
||||
fileInfo,
|
||||
|
|
@ -52,7 +52,7 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
|
|||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
fileInfos.CheckNotNull(nameof(fileInfos));
|
||||
fileInfos.NotNull(nameof(fileInfos));
|
||||
var files = fileInfos.ToArray();
|
||||
return new SevenZipArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -73,7 +73,7 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
|
|||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
var strms = streams.ToArray();
|
||||
return new SevenZipArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -91,7 +91,7 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
|
|||
/// <param name="readerOptions"></param>
|
||||
public static SevenZipArchive Open(Stream stream, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
stream.NotNull("stream");
|
||||
|
||||
if (stream is not { CanSeek: true })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static TarArchive Open(string filePath, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return Open(new FileInfo(filePath), readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static TarArchive Open(FileInfo fileInfo, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
fileInfo.CheckNotNull(nameof(fileInfo));
|
||||
fileInfo.NotNull(nameof(fileInfo));
|
||||
return new TarArchive(
|
||||
new SourceStream(
|
||||
fileInfo,
|
||||
|
|
@ -53,7 +53,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
|||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
fileInfos.CheckNotNull(nameof(fileInfos));
|
||||
fileInfos.NotNull(nameof(fileInfos));
|
||||
var files = fileInfos.ToArray();
|
||||
return new TarArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -71,7 +71,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static TarArchive Open(IEnumerable<Stream> streams, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
var strms = streams.ToArray();
|
||||
return new TarArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -89,7 +89,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static TarArchive Open(Stream stream, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
|
||||
if (stream is not { CanSeek: true })
|
||||
{
|
||||
|
|
@ -178,7 +178,7 @@ public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
|||
using (var entryStream = entry.OpenEntryStream())
|
||||
{
|
||||
using var memoryStream = new MemoryStream();
|
||||
entryStream.TransferTo(memoryStream);
|
||||
entryStream.CopyTo(memoryStream);
|
||||
memoryStream.Position = 0;
|
||||
var bytes = memoryStream.ToArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class ZipArchive : AbstractWritableArchive<ZipArchiveEntry, ZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static ZipArchive Open(string filePath, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return Open(new FileInfo(filePath), readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ public class ZipArchive : AbstractWritableArchive<ZipArchiveEntry, ZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static ZipArchive Open(FileInfo fileInfo, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
fileInfo.CheckNotNull(nameof(fileInfo));
|
||||
fileInfo.NotNull(nameof(fileInfo));
|
||||
return new ZipArchive(
|
||||
new SourceStream(
|
||||
fileInfo,
|
||||
|
|
@ -74,7 +74,7 @@ public class ZipArchive : AbstractWritableArchive<ZipArchiveEntry, ZipVolume>
|
|||
ReaderOptions? readerOptions = null
|
||||
)
|
||||
{
|
||||
fileInfos.CheckNotNull(nameof(fileInfos));
|
||||
fileInfos.NotNull(nameof(fileInfos));
|
||||
var files = fileInfos.ToArray();
|
||||
return new ZipArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -92,7 +92,7 @@ public class ZipArchive : AbstractWritableArchive<ZipArchiveEntry, ZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static ZipArchive Open(IEnumerable<Stream> streams, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
var strms = streams.ToArray();
|
||||
return new ZipArchive(
|
||||
new SourceStream(
|
||||
|
|
@ -110,7 +110,7 @@ public class ZipArchive : AbstractWritableArchive<ZipArchiveEntry, ZipVolume>
|
|||
/// <param name="readerOptions"></param>
|
||||
public static ZipArchive Open(Stream stream, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
|
||||
if (stream is not { CanSeek: true })
|
||||
{
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ internal partial class Unpack
|
|||
else
|
||||
//x memcpy(Mem,Window+BlockStart,BlockLength);
|
||||
{
|
||||
Utility.Copy(Window, BlockStart, Mem, 0, BlockLength);
|
||||
Buffer.BlockCopy(Window, (int)BlockStart, Mem, 0, (int)BlockLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -427,9 +427,21 @@ internal partial class Unpack
|
|||
else
|
||||
{
|
||||
//x memcpy(Mem,Window+BlockStart,FirstPartLength);
|
||||
Utility.Copy(Window, BlockStart, Mem, 0, FirstPartLength);
|
||||
Buffer.BlockCopy(
|
||||
Window,
|
||||
(int)BlockStart,
|
||||
Mem,
|
||||
0,
|
||||
(int)FirstPartLength
|
||||
);
|
||||
//x memcpy(Mem+FirstPartLength,Window,BlockEnd);
|
||||
Utility.Copy(Window, 0, Mem, FirstPartLength, BlockEnd);
|
||||
Buffer.BlockCopy(
|
||||
Window,
|
||||
0,
|
||||
Mem,
|
||||
(int)FirstPartLength,
|
||||
(int)BlockEnd
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public abstract class Factory : IFactory
|
|||
/// <exception cref="ArgumentNullException"><paramref name="factory"/> must not be null.</exception>
|
||||
public static void RegisterFactory(Factory factory)
|
||||
{
|
||||
factory.CheckNotNull(nameof(factory));
|
||||
factory.NotNull(nameof(factory));
|
||||
|
||||
_factories.Add(factory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SharpCompress.Helpers;
|
||||
namespace SharpCompress;
|
||||
|
||||
internal sealed class LazyReadOnlyCollection<T> : ICollection<T>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,20 +4,19 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace SharpCompress.Helpers;
|
||||
namespace SharpCompress;
|
||||
|
||||
internal static class NotNullExtensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static IEnumerable<T> Empty<T>(this IEnumerable<T>? source) =>
|
||||
source ?? Enumerable.Empty<T>();
|
||||
public static IEnumerable<T> Empty<T>(this IEnumerable<T>? source) => source ?? [];
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static IEnumerable<T> Empty<T>(this T? source)
|
||||
{
|
||||
if (source is null)
|
||||
{
|
||||
return Enumerable.Empty<T>();
|
||||
return [];
|
||||
}
|
||||
return source.AsEnumerable();
|
||||
}
|
||||
|
|
@ -68,4 +67,14 @@ internal static class NotNullExtensions
|
|||
return obj.Value;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static string NotNullOrEmpty(this string obj, string name)
|
||||
{
|
||||
obj.NotNull(name);
|
||||
if (obj.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String is empty.", name);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace SharpCompress.Readers.Arc
|
|||
/// <returns></returns>
|
||||
public static ArcReader Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
return new ArcReader(stream, options ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class GZipReader : AbstractReader<GZipEntry, GZipVolume>
|
|||
/// <returns></returns>
|
||||
public static GZipReader Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
return new GZipReader(stream, options ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public abstract class RarReader : AbstractReader<RarReaderEntry, RarVolume>
|
|||
|
||||
public static RarReader Open(string filePath, ReaderOptions? options = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return Open(new FileInfo(filePath), options);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ public abstract class RarReader : AbstractReader<RarReaderEntry, RarVolume>
|
|||
/// <returns></returns>
|
||||
public static RarReader Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
return new SingleVolumeRarReader(stream, options ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ public abstract class RarReader : AbstractReader<RarReaderEntry, RarVolume>
|
|||
/// <returns></returns>
|
||||
public static RarReader Open(IEnumerable<Stream> streams, ReaderOptions? options = null)
|
||||
{
|
||||
streams.CheckNotNull(nameof(streams));
|
||||
streams.NotNull(nameof(streams));
|
||||
return new MultiVolumeRarReader(streams, options ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public static class ReaderFactory
|
|||
{
|
||||
public static IReader Open(string filePath, ReaderOptions? options = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty(nameof(filePath));
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return Open(new FileInfo(filePath), options);
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ public static class ReaderFactory
|
|||
/// <returns></returns>
|
||||
public static IReader Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
options ??= new ReaderOptions() { LeaveStreamOpen = false };
|
||||
|
||||
var bStream = new SharpCompressStream(stream, bufferSize: options.BufferSize);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class TarReader : AbstractReader<TarEntry, TarVolume>
|
|||
/// <returns></returns>
|
||||
public static TarReader Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
options = options ?? new ReaderOptions();
|
||||
var rewindableStream = new SharpCompressStream(stream);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class ZipReader : AbstractReader<ZipEntry, ZipVolume>
|
|||
/// <returns></returns>
|
||||
public static ZipReader Open(Stream stream, ReaderOptions? options = null)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
return new ZipReader(stream, options ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ public class ZipReader : AbstractReader<ZipEntry, ZipVolume>
|
|||
IEnumerable<ZipEntry> entries
|
||||
)
|
||||
{
|
||||
stream.CheckNotNull(nameof(stream));
|
||||
stream.NotNull(nameof(stream));
|
||||
return new ZipReader(stream, options ?? new ReaderOptions(), entries);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,14 @@
|
|||
<DefineConstants>$(DefineConstants);DEBUG_STREAMS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Buffers" />
|
||||
<PackageReference Include="ZstdSharp.Port" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' Or '$(TargetFramework)' == 'net481' ">
|
||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" />
|
||||
<PackageReference Include="System.Buffers" />
|
||||
<PackageReference Include="System.Memory" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
global using SharpCompress.Helpers;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -7,10 +6,14 @@ using System.IO;
|
|||
using System.Text;
|
||||
using SharpCompress.Readers;
|
||||
|
||||
namespace SharpCompress.Helpers;
|
||||
namespace SharpCompress;
|
||||
|
||||
internal static class Utility
|
||||
{
|
||||
//80kb is a good industry standard temporary buffer size
|
||||
private const int TEMP_BUFFER_SIZE = 81920;
|
||||
private static readonly HashSet<char> invalidChars = new(Path.GetInvalidFileNameChars());
|
||||
|
||||
public static ReadOnlyCollection<T> ToReadOnly<T>(this IList<T> items) => new(items);
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -68,60 +71,11 @@ internal static class Utility
|
|||
}
|
||||
}
|
||||
|
||||
public static void Copy(
|
||||
Array sourceArray,
|
||||
long sourceIndex,
|
||||
Array destinationArray,
|
||||
long destinationIndex,
|
||||
long length
|
||||
)
|
||||
{
|
||||
if (sourceIndex > int.MaxValue || sourceIndex < int.MinValue)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(sourceIndex));
|
||||
}
|
||||
|
||||
if (destinationIndex > int.MaxValue || destinationIndex < int.MinValue)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(destinationIndex));
|
||||
}
|
||||
|
||||
if (length > int.MaxValue || length < int.MinValue)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(length));
|
||||
}
|
||||
|
||||
Array.Copy(
|
||||
sourceArray,
|
||||
(int)sourceIndex,
|
||||
destinationArray,
|
||||
(int)destinationIndex,
|
||||
(int)length
|
||||
);
|
||||
}
|
||||
|
||||
public static IEnumerable<T> AsEnumerable<T>(this T item)
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
|
||||
public static void CheckNotNull(this object obj, string name)
|
||||
{
|
||||
if (obj is null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckNotNullOrEmpty(this string obj, string name)
|
||||
{
|
||||
obj.CheckNotNull(name);
|
||||
if (obj.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String is empty.", name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Skip(this Stream source, long advanceAmount)
|
||||
{
|
||||
if (source.CanSeek)
|
||||
|
|
@ -130,79 +84,23 @@ internal static class Utility
|
|||
return;
|
||||
}
|
||||
|
||||
var buffer = GetTransferByteArray();
|
||||
try
|
||||
using var buffer = MemoryPool<byte>.Shared.Rent(TEMP_BUFFER_SIZE);
|
||||
while (advanceAmount > 0)
|
||||
{
|
||||
var read = 0;
|
||||
var readCount = 0;
|
||||
do
|
||||
var toRead = (int)Math.Min(buffer.Memory.Length, advanceAmount);
|
||||
var read = source.Read(buffer.Memory.Slice(0, toRead).Span);
|
||||
if (read <= 0)
|
||||
{
|
||||
readCount = buffer.Length;
|
||||
if (readCount > advanceAmount)
|
||||
{
|
||||
readCount = (int)advanceAmount;
|
||||
}
|
||||
read = source.Read(buffer, 0, readCount);
|
||||
if (read <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
advanceAmount -= read;
|
||||
if (advanceAmount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
break;
|
||||
}
|
||||
advanceAmount -= read;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Skip(this Stream source)
|
||||
{
|
||||
var buffer = GetTransferByteArray();
|
||||
try
|
||||
{
|
||||
do { } while (source.Read(buffer, 0, buffer.Length) == buffer.Length);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Find(this Stream source, byte[] array)
|
||||
{
|
||||
var buffer = GetTransferByteArray();
|
||||
try
|
||||
{
|
||||
var count = 0;
|
||||
var len = source.Read(buffer, 0, buffer.Length);
|
||||
|
||||
do
|
||||
{
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
if (array[count] == buffer[i])
|
||||
{
|
||||
count++;
|
||||
if (count == array.Length)
|
||||
{
|
||||
source.Position = source.Position - len + i - array.Length + 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while ((len = source.Read(buffer, 0, buffer.Length)) > 0);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
}
|
||||
|
||||
return false;
|
||||
using var buffer = MemoryPool<byte>.Shared.Rent(TEMP_BUFFER_SIZE);
|
||||
while (source.Read(buffer.Memory.Span) > 0) { }
|
||||
}
|
||||
|
||||
public static DateTime DosDateToDateTime(ushort iDate, ushort iTime)
|
||||
|
|
@ -271,31 +169,12 @@ internal static class Utility
|
|||
return sTime.AddSeconds(unixtime);
|
||||
}
|
||||
|
||||
public static long TransferTo(this Stream source, Stream destination)
|
||||
{
|
||||
var array = GetTransferByteArray();
|
||||
try
|
||||
{
|
||||
long total = 0;
|
||||
while (ReadTransferBlock(source, array, out var count))
|
||||
{
|
||||
destination.Write(array, 0, count);
|
||||
total += count;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(array);
|
||||
}
|
||||
}
|
||||
|
||||
public static long TransferTo(this Stream source, Stream destination, long maxLength)
|
||||
{
|
||||
var array = GetTransferByteArray();
|
||||
var maxReadSize = array.Length;
|
||||
var array = ArrayPool<byte>.Shared.Rent(TEMP_BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
var maxReadSize = array.Length;
|
||||
long total = 0;
|
||||
var remaining = maxLength;
|
||||
if (remaining < maxReadSize)
|
||||
|
|
@ -331,12 +210,13 @@ internal static class Utility
|
|||
IReaderExtractionListener readerExtractionListener
|
||||
)
|
||||
{
|
||||
var array = GetTransferByteArray();
|
||||
var array = ArrayPool<byte>.Shared.Rent(TEMP_BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
var iterations = 0;
|
||||
long total = 0;
|
||||
while (ReadTransferBlock(source, array, out var count))
|
||||
int count;
|
||||
while ((count = source.Read(array, 0, array.Length)) != 0)
|
||||
{
|
||||
total += count;
|
||||
destination.Write(array, 0, count);
|
||||
|
|
@ -351,12 +231,10 @@ internal static class Utility
|
|||
}
|
||||
}
|
||||
|
||||
private static bool ReadTransferBlock(Stream source, byte[] array, out int count) =>
|
||||
(count = source.Read(array, 0, array.Length)) != 0;
|
||||
|
||||
private static bool ReadTransferBlock(Stream source, byte[] array, int size, out int count)
|
||||
private static bool ReadTransferBlock(Stream source, byte[] array, int maxSize, out int count)
|
||||
{
|
||||
if (size > array.Length)
|
||||
var size = maxSize;
|
||||
if (maxSize > array.Length)
|
||||
{
|
||||
size = array.Length;
|
||||
}
|
||||
|
|
@ -364,8 +242,34 @@ internal static class Utility
|
|||
return count != 0;
|
||||
}
|
||||
|
||||
private static byte[] GetTransferByteArray() => ArrayPool<byte>.Shared.Rent(81920);
|
||||
#if NET60_OR_GREATER
|
||||
|
||||
public static bool ReadFully(this Stream stream, byte[] buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
stream.ReadExactly(buffer);
|
||||
return true;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ReadFully(this Stream stream, Span<byte> buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
stream.ReadExactly(buffer);
|
||||
return true;
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
public static bool ReadFully(this Stream stream, byte[] buffer)
|
||||
{
|
||||
var total = 0;
|
||||
|
|
@ -395,6 +299,7 @@ internal static class Utility
|
|||
}
|
||||
return (total >= buffer.Length);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static string TrimNulls(this string source) => source.Replace('\0', ' ').Trim();
|
||||
|
||||
|
|
@ -439,7 +344,6 @@ internal static class Utility
|
|||
|
||||
public static string ReplaceInvalidFileNameChars(string fileName)
|
||||
{
|
||||
var invalidChars = new HashSet<char>(Path.GetInvalidFileNameChars());
|
||||
var sb = new StringBuilder(fileName.Length);
|
||||
foreach (var c in fileName)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public sealed class GZipWriter : AbstractWriter
|
|||
var stream = (GZipStream)OutputStream;
|
||||
stream.FileName = filename;
|
||||
stream.LastModified = modificationTime;
|
||||
source.TransferTo(stream);
|
||||
source.CopyTo(stream);
|
||||
_wroteToStream = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ZipWriter : AbstractWriter
|
|||
public void Write(string entryPath, Stream source, ZipWriterEntryOptions zipWriterEntryOptions)
|
||||
{
|
||||
using var output = WriteToStream(entryPath, zipWriterEntryOptions);
|
||||
source.TransferTo(output);
|
||||
source.CopyTo(output);
|
||||
}
|
||||
|
||||
public Stream WriteToStream(string entryPath, ZipWriterEntryOptions options)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
"version": 2,
|
||||
"dependencies": {
|
||||
".NETFramework,Version=v4.8": {
|
||||
"Microsoft.Bcl.AsyncInterfaces": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "3WA9q9yVqJp222P3x1wYIGDAkpjAku0TMUaaQV22g6L67AI0LdOIrVS7Ht2vJfLHGSPVuqN94vIr15qn+HEkHw==",
|
||||
"dependencies": {
|
||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.3, )",
|
||||
|
|
@ -23,9 +32,30 @@
|
|||
},
|
||||
"System.Buffers": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
"requested": "[4.6.1, )",
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "N8GXpmiLMtljq7gwvyS+1QvKT/W2J8sNAvx+HVg4NGmsG/H+2k/y9QI23auLJRterrzCiDH+IWAw4V/GPwsMlw=="
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.3, )",
|
||||
"resolved": "4.6.3",
|
||||
"contentHash": "qdcDOgnFZY40+Q9876JUHnlHu7bosOHX8XISRoH94fwk6hgaeQGSgfZd8srWRZNt5bV9ZW2TljcegDNxsf+96A==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.6.1",
|
||||
"System.Numerics.Vectors": "4.6.1",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.2"
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding.CodePages": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "OZIsVplFGaVY90G2SbpgU7EnCoOO5pw1t4ic21dBF3/1omrJFpAGoNAVpPyMVOC90/hvgkGG3VFqR13YgZMQfg==",
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.5",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"ZstdSharp.Port": {
|
||||
"type": "Direct",
|
||||
|
|
@ -55,13 +85,13 @@
|
|||
},
|
||||
"System.Numerics.Vectors": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ=="
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "sQxefTnhagrhoq2ReR0D/6K0zJcr9Hrd6kikeXsA1I8kOCboTavcUC4r7TSfpKFeE163uMuxZcyfO1mGO3EN8Q=="
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0",
|
||||
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
||||
"resolved": "6.1.2",
|
||||
"contentHash": "2hBr6zdbIBTDE3EhK7NSVNdX58uTK6iHW/P/Axmm9sl1xoGSLqDvMtpecn226TNwHByFokYwJmt/aQQNlO5CRw=="
|
||||
},
|
||||
"System.Threading.Tasks.Extensions": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -70,29 +100,18 @@
|
|||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8.1": {
|
||||
"Microsoft.Bcl.AsyncInterfaces": {
|
||||
"type": "CentralTransitive",
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "3WA9q9yVqJp222P3x1wYIGDAkpjAku0TMUaaQV22g6L67AI0LdOIrVS7Ht2vJfLHGSPVuqN94vIr15qn+HEkHw==",
|
||||
"dependencies": {
|
||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
}
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.5.5",
|
||||
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.5.1",
|
||||
"System.Numerics.Vectors": "4.5.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8.1": {
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.3, )",
|
||||
|
|
@ -114,9 +133,30 @@
|
|||
},
|
||||
"System.Buffers": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
"requested": "[4.6.1, )",
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "N8GXpmiLMtljq7gwvyS+1QvKT/W2J8sNAvx+HVg4NGmsG/H+2k/y9QI23auLJRterrzCiDH+IWAw4V/GPwsMlw=="
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.3, )",
|
||||
"resolved": "4.6.3",
|
||||
"contentHash": "qdcDOgnFZY40+Q9876JUHnlHu7bosOHX8XISRoH94fwk6hgaeQGSgfZd8srWRZNt5bV9ZW2TljcegDNxsf+96A==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.6.1",
|
||||
"System.Numerics.Vectors": "4.6.1",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.2"
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding.CodePages": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "OZIsVplFGaVY90G2SbpgU7EnCoOO5pw1t4ic21dBF3/1omrJFpAGoNAVpPyMVOC90/hvgkGG3VFqR13YgZMQfg==",
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.5",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"ZstdSharp.Port": {
|
||||
"type": "Direct",
|
||||
|
|
@ -146,13 +186,13 @@
|
|||
},
|
||||
"System.Numerics.Vectors": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ=="
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "sQxefTnhagrhoq2ReR0D/6K0zJcr9Hrd6kikeXsA1I8kOCboTavcUC4r7TSfpKFeE163uMuxZcyfO1mGO3EN8Q=="
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0",
|
||||
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
||||
"resolved": "6.1.2",
|
||||
"contentHash": "2hBr6zdbIBTDE3EhK7NSVNdX58uTK6iHW/P/Axmm9sl1xoGSLqDvMtpecn226TNwHByFokYwJmt/aQQNlO5CRw=="
|
||||
},
|
||||
"System.Threading.Tasks.Extensions": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -161,26 +201,6 @@
|
|||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.Bcl.AsyncInterfaces": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
|
||||
"dependencies": {
|
||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
}
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.5.5",
|
||||
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.5.1",
|
||||
"System.Numerics.Vectors": "4.5.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
".NETStandard,Version=v2.0": {
|
||||
|
|
@ -193,15 +213,6 @@
|
|||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.SourceLink.GitHub": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
|
|
@ -221,21 +232,15 @@
|
|||
"Microsoft.NETCore.Platforms": "1.1.0"
|
||||
}
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "OEkbBQoklHngJ8UD8ez2AERSk2g+/qpAaSWWCBFbpH727HxDq5ydVkuncBaKcKfwRqXGWx64dS6G1SUScMsitg==",
|
||||
"requested": "[4.6.3, )",
|
||||
"resolved": "4.6.3",
|
||||
"contentHash": "qdcDOgnFZY40+Q9876JUHnlHu7bosOHX8XISRoH94fwk6hgaeQGSgfZd8srWRZNt5bV9ZW2TljcegDNxsf+96A==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.6.0",
|
||||
"System.Numerics.Vectors": "4.6.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
|
||||
"System.Buffers": "4.6.1",
|
||||
"System.Numerics.Vectors": "4.6.1",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.2"
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding.CodePages": {
|
||||
|
|
@ -269,11 +274,6 @@
|
|||
"resolved": "1.1.0",
|
||||
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA=="
|
||||
},
|
||||
"Microsoft.SourceLink.Common": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
|
|
@ -281,13 +281,13 @@
|
|||
},
|
||||
"System.Numerics.Vectors": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "t+SoieZsRuEyiw/J+qXUbolyO219tKQQI0+2/YI+Qv7YdGValA6WiuokrNKqjrTNsy5ABWU11bdKOzUdheteXg=="
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "sQxefTnhagrhoq2ReR0D/6K0zJcr9Hrd6kikeXsA1I8kOCboTavcUC4r7TSfpKFeE163uMuxZcyfO1mGO3EN8Q=="
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.1.0",
|
||||
"contentHash": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg=="
|
||||
"resolved": "6.1.2",
|
||||
"contentHash": "2hBr6zdbIBTDE3EhK7NSVNdX58uTK6iHW/P/Axmm9sl1xoGSLqDvMtpecn226TNwHByFokYwJmt/aQQNlO5CRw=="
|
||||
},
|
||||
"System.Threading.Tasks.Extensions": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -296,18 +296,15 @@
|
|||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[4.6.1, )",
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "N8GXpmiLMtljq7gwvyS+1QvKT/W2J8sNAvx+HVg4NGmsG/H+2k/y9QI23auLJRterrzCiDH+IWAw4V/GPwsMlw=="
|
||||
}
|
||||
},
|
||||
"net6.0": {
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.SourceLink.GitHub": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
|
|
@ -318,12 +315,6 @@
|
|||
"Microsoft.SourceLink.Common": "8.0.0"
|
||||
}
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
},
|
||||
"ZstdSharp.Port": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.8.6, )",
|
||||
|
|
@ -335,11 +326,6 @@
|
|||
"resolved": "8.0.0",
|
||||
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA=="
|
||||
},
|
||||
"Microsoft.SourceLink.Common": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
|
|
@ -353,15 +339,6 @@
|
|||
"resolved": "8.0.17",
|
||||
"contentHash": "x5/y4l8AtshpBOrCZdlE4txw8K3e3s9meBFeZeR3l8hbbku2V7kK6ojhXvrbjg1rk3G+JqL1BI26gtgc1ZrdUw=="
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
|
||||
"dependencies": {
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3"
|
||||
}
|
||||
},
|
||||
"Microsoft.SourceLink.GitHub": {
|
||||
"type": "Direct",
|
||||
"requested": "[8.0.0, )",
|
||||
|
|
@ -372,12 +349,6 @@
|
|||
"Microsoft.SourceLink.Common": "8.0.0"
|
||||
}
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
},
|
||||
"ZstdSharp.Port": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.8.6, )",
|
||||
|
|
@ -389,11 +360,6 @@
|
|||
"resolved": "8.0.0",
|
||||
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA=="
|
||||
},
|
||||
"Microsoft.SourceLink.Common": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class RarReaderTests : ReaderTests
|
|||
var destinationFileName = Path.Combine(destdir, file);
|
||||
|
||||
using var fs = File.OpenWrite(destinationFileName);
|
||||
entryStream.TransferTo(fs);
|
||||
entryStream.CopyTo(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants);DEBUG_STREAMS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))">
|
||||
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\SharpCompress\SharpCompress.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
@ -17,7 +20,6 @@
|
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="Xunit.SkippableFact" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(VersionlessImplicitFrameworkDefine)' != 'NETFRAMEWORK' ">
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class TarReaderTests : ReaderTests
|
|||
var destinationFileName = Path.Combine(destdir, file.NotNull());
|
||||
|
||||
using var fs = File.OpenWrite(destinationFileName);
|
||||
entryStream.TransferTo(fs);
|
||||
entryStream.CopyTo(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
global using SharpCompress.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
|
|||
754
tests/SharpCompress.Test/UtilityTests.cs
Normal file
754
tests/SharpCompress.Test/UtilityTests.cs
Normal file
|
|
@ -0,0 +1,754 @@
|
|||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
|
||||
namespace SharpCompress.Test;
|
||||
|
||||
public class UtilityTests
|
||||
{
|
||||
#region URShift Tests
|
||||
|
||||
[Fact]
|
||||
public void URShift_Int_PositiveNumber_ShiftsCorrectly()
|
||||
{
|
||||
var result = Utility.URShift(16, 2);
|
||||
Assert.Equal(4, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void URShift_Int_NegativeNumber_PerformsUnsignedShift()
|
||||
{
|
||||
// -1 in binary is all 1s (0xFFFFFFFF), shifted right by 1 should be 0x7FFFFFFF
|
||||
var result = Utility.URShift(-1, 1);
|
||||
Assert.Equal(int.MaxValue, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void URShift_Int_Zero_ReturnsZero()
|
||||
{
|
||||
var result = Utility.URShift(0, 5);
|
||||
Assert.Equal(0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void URShift_Long_PositiveNumber_ShiftsCorrectly()
|
||||
{
|
||||
var result = Utility.URShift(32L, 3);
|
||||
Assert.Equal(4L, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void URShift_Long_NegativeNumber_PerformsUnsignedShift()
|
||||
{
|
||||
var result = Utility.URShift(-1L, 1);
|
||||
Assert.Equal(long.MaxValue, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void URShift_Long_Zero_ReturnsZero()
|
||||
{
|
||||
var result = Utility.URShift(0L, 10);
|
||||
Assert.Equal(0L, result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReadFully Tests
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_ByteArray_ReadsExactlyRequiredBytes()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var stream = new MemoryStream(data);
|
||||
var buffer = new byte[5];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.True(result);
|
||||
Assert.Equal(data, buffer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_ByteArray_ReturnsFalseWhenNotEnoughData()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3 };
|
||||
using var stream = new MemoryStream(data);
|
||||
var buffer = new byte[5];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_ByteArray_EmptyStream_ReturnsFalse()
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
var buffer = new byte[5];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_ByteArray_EmptyBuffer_ReturnsTrue()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3 };
|
||||
using var stream = new MemoryStream(data);
|
||||
var buffer = new byte[0];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_Span_ReadsExactlyRequiredBytes()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var stream = new MemoryStream(data);
|
||||
Span<byte> buffer = new byte[5];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.True(result);
|
||||
Assert.Equal(data, buffer.ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_Span_ReturnsFalseWhenNotEnoughData()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3 };
|
||||
using var stream = new MemoryStream(data);
|
||||
Span<byte> buffer = new byte[5];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_Span_EmptyStream_ReturnsFalse()
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
Span<byte> buffer = new byte[5];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.False(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadFully_Span_EmptyBuffer_ReturnsTrue()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3 };
|
||||
using var stream = new MemoryStream(data);
|
||||
Span<byte> buffer = new byte[0];
|
||||
|
||||
var result = stream.ReadFully(buffer);
|
||||
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Skip Tests
|
||||
|
||||
[Fact]
|
||||
public void Skip_SeekableStream_UsesSeek()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var stream = new MemoryStream(data);
|
||||
|
||||
stream.Skip(3);
|
||||
|
||||
Assert.Equal(3, stream.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Skip_SeekableStream_SkipsCorrectAmount()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var stream = new MemoryStream(data);
|
||||
|
||||
stream.Skip(2);
|
||||
var buffer = new byte[2];
|
||||
stream.Read(buffer);
|
||||
|
||||
Assert.Equal(new byte[] { 3, 4 }, buffer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Skip_NonSeekableStream_SkipsCorrectAmount()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var seekableStream = new MemoryStream(data);
|
||||
using var nonSeekableStream = new NonSeekableStream(seekableStream);
|
||||
|
||||
nonSeekableStream.Skip(2);
|
||||
var buffer = new byte[2];
|
||||
nonSeekableStream.Read(buffer);
|
||||
|
||||
Assert.Equal(new byte[] { 3, 4 }, buffer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Skip_NonSeekableStream_SkipsBeyondStreamEnd()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3 };
|
||||
using var seekableStream = new MemoryStream(data);
|
||||
using var nonSeekableStream = new NonSeekableStream(seekableStream);
|
||||
|
||||
// Should not throw, just skip what's available
|
||||
nonSeekableStream.Skip(10);
|
||||
|
||||
Assert.Equal(-1, nonSeekableStream.ReadByte());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Skip_Parameterless_SkipsEntireStream()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var stream = new MemoryStream(data);
|
||||
|
||||
stream.Skip();
|
||||
|
||||
Assert.Equal(-1, stream.ReadByte());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Skip_Zero_DoesNotMove()
|
||||
{
|
||||
var data = new byte[] { 1, 2, 3, 4, 5 };
|
||||
using var stream = new MemoryStream(data);
|
||||
stream.Position = 2;
|
||||
|
||||
stream.Skip(0);
|
||||
|
||||
Assert.Equal(2, stream.Position);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetSize Tests
|
||||
|
||||
[Fact]
|
||||
public void SetSize_GrowsList_AddsZeroBytes()
|
||||
{
|
||||
var list = new List<byte> { 1, 2, 3 };
|
||||
|
||||
Utility.SetSize(list, 5);
|
||||
|
||||
Assert.Equal(5, list.Count);
|
||||
Assert.Equal(new byte[] { 1, 2, 3, 0, 0 }, list);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetSize_ShrinksListByOne()
|
||||
{
|
||||
var list = new List<byte> { 1, 2, 3, 4, 5 };
|
||||
|
||||
Utility.SetSize(list, 3);
|
||||
|
||||
Assert.Equal(3, list.Count);
|
||||
Assert.Equal(new byte[] { 1, 2, 3 }, list);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetSize_ToZero_ClearsAllItems()
|
||||
{
|
||||
var list = new List<byte> { 1, 2, 3 };
|
||||
|
||||
Utility.SetSize(list, 0);
|
||||
|
||||
Assert.Empty(list);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetSize_SameSize_NoChange()
|
||||
{
|
||||
var list = new List<byte> { 1, 2, 3 };
|
||||
|
||||
Utility.SetSize(list, 3);
|
||||
|
||||
Assert.Equal(3, list.Count);
|
||||
Assert.Equal(new byte[] { 1, 2, 3 }, list);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ForEach Tests
|
||||
|
||||
[Fact]
|
||||
public void ForEach_ExecutesActionForEachItem()
|
||||
{
|
||||
var items = new[] { 1, 2, 3, 4, 5 };
|
||||
var results = new List<int>();
|
||||
|
||||
items.ForEach(x => results.Add(x));
|
||||
|
||||
Assert.Equal(items, results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ForEach_EmptyCollection_NoExecutions()
|
||||
{
|
||||
var items = Array.Empty<int>();
|
||||
var count = 0;
|
||||
|
||||
items.ForEach(x => count++);
|
||||
|
||||
Assert.Equal(0, count);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AsEnumerable Tests
|
||||
|
||||
[Fact]
|
||||
public void AsEnumerable_SingleItem_YieldsItem()
|
||||
{
|
||||
var item = 42;
|
||||
|
||||
var result = item.AsEnumerable().ToList();
|
||||
|
||||
Assert.Single(result);
|
||||
Assert.Equal(42, result[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AsEnumerable_String_YieldsString()
|
||||
{
|
||||
var item = "test";
|
||||
|
||||
var result = item.AsEnumerable().ToList();
|
||||
|
||||
Assert.Single(result);
|
||||
Assert.Equal("test", result[0]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DosDateToDateTime Tests
|
||||
|
||||
[Fact]
|
||||
public void DosDateToDateTime_ValidDate_ConvertsCorrectly()
|
||||
{
|
||||
// DOS date format: year (7 bits) | month (4 bits) | day (5 bits)
|
||||
// DOS time format: hour (5 bits) | minute (6 bits) | second (5 bits, in 2-second increments)
|
||||
// This represents: 2020-01-15 10:30:20 (approximately)
|
||||
ushort dosDate = (ushort)(((2020 - 1980) << 9) | (1 << 5) | 15); // 2020-01-15
|
||||
ushort dosTime = (ushort)((10 << 11) | (30 << 5) | 10); // 10:30:20
|
||||
|
||||
var result = Utility.DosDateToDateTime(dosDate, dosTime);
|
||||
|
||||
Assert.Equal(2020, result.Year);
|
||||
Assert.Equal(1, result.Month);
|
||||
Assert.Equal(15, result.Day);
|
||||
Assert.Equal(10, result.Hour);
|
||||
Assert.Equal(30, result.Minute);
|
||||
Assert.Equal(20, result.Second);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DosDateToDateTime_InvalidDate_DefaultsTo1980_01_01()
|
||||
{
|
||||
ushort dosDate = ushort.MaxValue;
|
||||
ushort dosTime = (ushort)((10 << 11) | (30 << 5) | 10);
|
||||
|
||||
var result = Utility.DosDateToDateTime(dosDate, dosTime);
|
||||
|
||||
Assert.Equal(1980, result.Year);
|
||||
Assert.Equal(1, result.Month);
|
||||
Assert.Equal(1, result.Day);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DosDateToDateTime_InvalidTime_DefaultsToMidnight()
|
||||
{
|
||||
ushort dosDate = (ushort)(((2020 - 1980) << 9) | (1 << 5) | 15);
|
||||
ushort dosTime = ushort.MaxValue;
|
||||
|
||||
var result = Utility.DosDateToDateTime(dosDate, dosTime);
|
||||
|
||||
Assert.Equal(0, result.Hour);
|
||||
Assert.Equal(0, result.Minute);
|
||||
Assert.Equal(0, result.Second);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DosDateToDateTime_FromUint_ConvertsCorrectly()
|
||||
{
|
||||
ushort dosDate = (ushort)(((2020 - 1980) << 9) | (6 << 5) | 20); // 2020-06-20
|
||||
ushort dosTime = (ushort)((14 << 11) | (45 << 5) | 15); // 14:45:30
|
||||
uint combined = (uint)(dosDate << 16) | dosTime;
|
||||
|
||||
var result = Utility.DosDateToDateTime(combined);
|
||||
|
||||
Assert.Equal(2020, result.Year);
|
||||
Assert.Equal(6, result.Month);
|
||||
Assert.Equal(20, result.Day);
|
||||
Assert.Equal(14, result.Hour);
|
||||
Assert.Equal(45, result.Minute);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DateTimeToDosTime Tests
|
||||
|
||||
[Fact]
|
||||
public void DateTimeToDosTime_ValidDateTime_ConvertsCorrectly()
|
||||
{
|
||||
//always do local time
|
||||
var dt = new DateTime(2020, 6, 15, 14, 30, 20, DateTimeKind.Local);
|
||||
|
||||
var result = Utility.DateTimeToDosTime(dt);
|
||||
|
||||
// Verify we can convert back
|
||||
var reversed = Utility.DosDateToDateTime(result);
|
||||
Assert.Equal(2020, reversed.Year);
|
||||
Assert.Equal(6, reversed.Month);
|
||||
Assert.Equal(15, reversed.Day);
|
||||
Assert.Equal(14, reversed.Hour);
|
||||
Assert.Equal(30, reversed.Minute);
|
||||
// Seconds are rounded down to nearest even number in DOS format
|
||||
Assert.True(reversed.Second == 20 || reversed.Second == 18);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DateTimeToDosTime_NullDateTime_ReturnsZero()
|
||||
{
|
||||
DateTime? dt = null;
|
||||
|
||||
var result = Utility.DateTimeToDosTime(dt);
|
||||
|
||||
Assert.Equal(0u, result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UnixTimeToDateTime Tests
|
||||
|
||||
[Fact]
|
||||
public void UnixTimeToDateTime_Zero_Returns1970_01_01()
|
||||
{
|
||||
var result = Utility.UnixTimeToDateTime(0);
|
||||
|
||||
Assert.Equal(1970, result.Year);
|
||||
Assert.Equal(1, result.Month);
|
||||
Assert.Equal(1, result.Day);
|
||||
Assert.Equal(0, result.Hour);
|
||||
Assert.Equal(0, result.Minute);
|
||||
Assert.Equal(0, result.Second);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnixTimeToDateTime_ValidTimestamp_ConvertsCorrectly()
|
||||
{
|
||||
// January 1, 2000 00:00:00 UTC is 946684800 seconds after epoch
|
||||
var result = Utility.UnixTimeToDateTime(946684800);
|
||||
|
||||
Assert.Equal(2000, result.Year);
|
||||
Assert.Equal(1, result.Month);
|
||||
Assert.Equal(1, result.Day);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnixTimeToDateTime_NegativeTimestamp_ReturnsBeforeEpoch()
|
||||
{
|
||||
// -86400 is one day before epoch
|
||||
var result = Utility.UnixTimeToDateTime(-86400);
|
||||
|
||||
Assert.Equal(1969, result.Year);
|
||||
Assert.Equal(12, result.Month);
|
||||
Assert.Equal(31, result.Day);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TransferTo Tests
|
||||
|
||||
[Fact]
|
||||
public void TransferTo_WithMaxLength_TransfersCorrectAmount()
|
||||
{
|
||||
var sourceData = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
using var source = new MemoryStream(sourceData);
|
||||
using var destination = new MemoryStream();
|
||||
|
||||
var transferred = source.TransferTo(destination, 5);
|
||||
|
||||
Assert.Equal(5, transferred);
|
||||
Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, destination.ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TransferTo_SourceSmallerThanMax_TransfersAll()
|
||||
{
|
||||
var sourceData = new byte[] { 1, 2, 3 };
|
||||
using var source = new MemoryStream(sourceData);
|
||||
using var destination = new MemoryStream();
|
||||
|
||||
var transferred = source.TransferTo(destination, 100);
|
||||
|
||||
Assert.Equal(3, transferred);
|
||||
Assert.Equal(sourceData, destination.ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TransferTo_EmptySource_TransfersNothing()
|
||||
{
|
||||
using var source = new MemoryStream();
|
||||
using var destination = new MemoryStream();
|
||||
|
||||
var transferred = source.TransferTo(destination, 100);
|
||||
|
||||
Assert.Equal(0, transferred);
|
||||
Assert.Empty(destination.ToArray());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SwapUINT32 Tests
|
||||
|
||||
[Fact]
|
||||
public void SwapUINT32_SimpleValue_SwapsEndianness()
|
||||
{
|
||||
uint value = 0x12345678;
|
||||
|
||||
var result = Utility.SwapUINT32(value);
|
||||
|
||||
Assert.Equal(0x78563412u, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SwapUINT32_Zero_ReturnsZero()
|
||||
{
|
||||
var result = Utility.SwapUINT32(0);
|
||||
|
||||
Assert.Equal(0u, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SwapUINT32_MaxValue_SwapsCorrectly()
|
||||
{
|
||||
var result = Utility.SwapUINT32(uint.MaxValue);
|
||||
|
||||
Assert.Equal(uint.MaxValue, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SwapUINT32_Involution_SwappingTwiceReturnsOriginal()
|
||||
{
|
||||
uint value = 0x12345678;
|
||||
|
||||
var result = Utility.SwapUINT32(Utility.SwapUINT32(value));
|
||||
|
||||
Assert.Equal(value, result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetLittleUInt32 Tests
|
||||
|
||||
[Fact]
|
||||
public void SetLittleUInt32_InsertsValueCorrectly()
|
||||
{
|
||||
byte[] buffer = new byte[10];
|
||||
uint value = 0x12345678;
|
||||
|
||||
Utility.SetLittleUInt32(ref buffer, value, 2);
|
||||
|
||||
Assert.Equal(0x78, buffer[2]);
|
||||
Assert.Equal(0x56, buffer[3]);
|
||||
Assert.Equal(0x34, buffer[4]);
|
||||
Assert.Equal(0x12, buffer[5]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetLittleUInt32_AtOffset_InsertsBehindOffset()
|
||||
{
|
||||
byte[] buffer = new byte[10];
|
||||
uint value = 0xDEADBEEF;
|
||||
|
||||
Utility.SetLittleUInt32(ref buffer, value, 5);
|
||||
|
||||
Assert.Equal(0xEF, buffer[5]);
|
||||
Assert.Equal(0xBE, buffer[6]);
|
||||
Assert.Equal(0xAD, buffer[7]);
|
||||
Assert.Equal(0xDE, buffer[8]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetBigUInt32 Tests
|
||||
|
||||
[Fact]
|
||||
public void SetBigUInt32_InsertsValueCorrectly()
|
||||
{
|
||||
byte[] buffer = new byte[10];
|
||||
uint value = 0x12345678;
|
||||
|
||||
Utility.SetBigUInt32(ref buffer, value, 2);
|
||||
|
||||
Assert.Equal(0x12, buffer[2]);
|
||||
Assert.Equal(0x34, buffer[3]);
|
||||
Assert.Equal(0x56, buffer[4]);
|
||||
Assert.Equal(0x78, buffer[5]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetBigUInt32_AtOffset_InsertsBehindOffset()
|
||||
{
|
||||
byte[] buffer = new byte[10];
|
||||
uint value = 0xDEADBEEF;
|
||||
|
||||
Utility.SetBigUInt32(ref buffer, value, 5);
|
||||
|
||||
Assert.Equal(0xDE, buffer[5]);
|
||||
Assert.Equal(0xAD, buffer[6]);
|
||||
Assert.Equal(0xBE, buffer[7]);
|
||||
Assert.Equal(0xEF, buffer[8]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReplaceInvalidFileNameChars Tests
|
||||
|
||||
#if WINDOWS
|
||||
[Theory]
|
||||
[InlineData("valid_filename.txt", "valid_filename.txt")]
|
||||
[InlineData("file<name>test.txt", "file_name_test.txt")]
|
||||
[InlineData("<>:\"|?*", "_______")]
|
||||
public void ReplaceInvalidFileNameChars_Windows(string fileName, string expected)
|
||||
{
|
||||
var result = Utility.ReplaceInvalidFileNameChars(fileName);
|
||||
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
#else
|
||||
[Theory]
|
||||
[InlineData("valid_filename.txt", "valid_filename.txt")]
|
||||
[InlineData("file<name>test.txt", "file<name>test.txt")]
|
||||
[InlineData("<>:\"|?*", "<>:\"|?*")]
|
||||
public void ReplaceInvalidFileNameChars_NonWindows(string fileName, string expected)
|
||||
{
|
||||
var result = Utility.ReplaceInvalidFileNameChars(fileName);
|
||||
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#region ToReadOnly Tests
|
||||
|
||||
[Fact]
|
||||
public void ToReadOnly_IList_ReturnsReadOnlyCollection()
|
||||
{
|
||||
var list = new List<int> { 1, 2, 3, 4, 5 };
|
||||
|
||||
var result = list.ToReadOnly();
|
||||
|
||||
Assert.Equal(5, result.Count);
|
||||
Assert.Equal(1, result[0]);
|
||||
Assert.Equal(5, result[4]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToReadOnly_EmptyList_ReturnsEmptyReadOnlyCollection()
|
||||
{
|
||||
var list = new List<int>();
|
||||
|
||||
var result = list.ToReadOnly();
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TrimNulls Tests
|
||||
|
||||
[Fact]
|
||||
public void TrimNulls_StringWithNulls_ReplacesAndTrims()
|
||||
{
|
||||
var input = " hello\0world\0 ";
|
||||
|
||||
var result = Utility.TrimNulls(input);
|
||||
|
||||
Assert.Equal("hello world", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TrimNulls_StringWithoutNulls_TrimsWhitespace()
|
||||
{
|
||||
var input = " hello world ";
|
||||
|
||||
var result = Utility.TrimNulls(input);
|
||||
|
||||
Assert.Equal("hello world", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TrimNulls_OnlyNulls_ReturnsEmpty()
|
||||
{
|
||||
var input = "\0\0\0";
|
||||
|
||||
var result = Utility.TrimNulls(input);
|
||||
|
||||
Assert.Empty(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper class for testing non-seekable streams
|
||||
/// </summary>
|
||||
internal class NonSeekableStream : Stream
|
||||
{
|
||||
private readonly Stream _inner;
|
||||
|
||||
public NonSeekableStream(Stream inner)
|
||||
{
|
||||
_inner = inner;
|
||||
}
|
||||
|
||||
public override bool CanRead => _inner.CanRead;
|
||||
public override bool CanSeek => false; // Force non-seekable
|
||||
public override bool CanWrite => _inner.CanWrite;
|
||||
public override long Length => _inner.Length;
|
||||
public override long Position
|
||||
{
|
||||
get => _inner.Position;
|
||||
set => throw new NotSupportedException("Stream is not seekable");
|
||||
}
|
||||
|
||||
public override void Flush() => _inner.Flush();
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count) =>
|
||||
_inner.Read(buffer, offset, count);
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin) =>
|
||||
throw new NotSupportedException("Stream is not seekable");
|
||||
|
||||
public override void SetLength(long value) =>
|
||||
throw new NotSupportedException("Stream is not seekable");
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count) =>
|
||||
_inner.Write(buffer, offset, count);
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_inner.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
|
@ -589,12 +589,10 @@ public class ZipArchiveTests : ArchiveTests
|
|||
}
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void Zip_Evil_Throws_Exception()
|
||||
#if WINDOWS
|
||||
[Fact]
|
||||
public void Zip_Evil_Throws_Exception_Windows()
|
||||
{
|
||||
//windows only because of the paths
|
||||
Skip.IfNot(Environment.OSVersion.Platform == PlatformID.Win32NT);
|
||||
|
||||
var zipFile = Path.Combine(TEST_ARCHIVES_PATH, "Zip.Evil.zip");
|
||||
|
||||
Assert.ThrowsAny<Exception>(() =>
|
||||
|
|
@ -609,6 +607,7 @@ public class ZipArchiveTests : ArchiveTests
|
|||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
private class NonSeekableMemoryStream : MemoryStream
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@
|
|||
".NETFramework,Version=v4.8": {
|
||||
"AwesomeAssertions": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.2.0, )",
|
||||
"resolved": "9.2.0",
|
||||
"contentHash": "RCkuFyKmesmZR74XLOzYvTpG/IbHfBeFapFTMvFskPzEK4z3YrVmHB2FIFJ0DhwjuIDdPL/hc8zS40IwMAN0BA==",
|
||||
"requested": "[9.2.1, )",
|
||||
"resolved": "9.2.1",
|
||||
"contentHash": "lbwhyQNXxxEGx4oCbFqNfFy2DsywsvNhN6qoOjY4wwhMgI2L9+YrxjyF/M0io99yrvWV1Cjj12LP2QGcC43Uhw==",
|
||||
"dependencies": {
|
||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
}
|
||||
},
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"type": "Direct",
|
||||
"requested": "[17.13.0, )",
|
||||
"resolved": "17.13.0",
|
||||
"contentHash": "W19wCPizaIC9Zh47w8wWI/yxuqR7/dtABwOrc8r2jX/8mUNxM2vw4fXDh+DJTeogxV+KzKwg5jNNGQVwf3LXyA==",
|
||||
"requested": "[18.0.0, )",
|
||||
"resolved": "18.0.0",
|
||||
"contentHash": "bvxj2Asb7nT+tqOFFerrhQeEjUYLwx0Poi0Rznu63WbqN+A4uDn1t5NWXfAOOQsF6lpmK6N2v+Vvgso7KWZS7g==",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeCoverage": "17.13.0"
|
||||
"Microsoft.CodeCoverage": "18.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
|
|
@ -49,20 +49,10 @@
|
|||
"Microsoft.TestPlatform.ObjectModel": "17.13.0"
|
||||
}
|
||||
},
|
||||
"Xunit.SkippableFact": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.5.23, )",
|
||||
"resolved": "1.5.23",
|
||||
"contentHash": "JlKobLTlsGcuJ8OtoodxL63bUagHSVBnF+oQ2GgnkwNqK+XYjeYyhQasULi5Ebx1MNDGNbOMplQYr89mR+nItQ==",
|
||||
"dependencies": {
|
||||
"Validation": "2.5.51",
|
||||
"xunit.extensibility.execution": "2.4.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeCoverage": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.13.0",
|
||||
"contentHash": "9LIUy0y+DvUmEPtbRDw6Bay3rzwqFV8P4efTrK4CZhQle3M/QwLPjISghfcolmEGAPWxuJi6m98ZEfk4VR4Lfg=="
|
||||
"resolved": "18.0.0",
|
||||
"contentHash": "DFPhMrsIofgJ1DDU3ModqqRArDm15/bNl4ecmcuBspZkZ4ONYnCC0R8U27WzK7cYv6r8l6Q/fRmvg7cb+I/dJA=="
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -84,8 +74,8 @@
|
|||
},
|
||||
"System.Numerics.Vectors": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.0",
|
||||
"contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ=="
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "sQxefTnhagrhoq2ReR0D/6K0zJcr9Hrd6kikeXsA1I8kOCboTavcUC4r7TSfpKFeE163uMuxZcyfO1mGO3EN8Q=="
|
||||
},
|
||||
"System.Reflection.Metadata": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -97,8 +87,8 @@
|
|||
},
|
||||
"System.Runtime.CompilerServices.Unsafe": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0",
|
||||
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
||||
"resolved": "6.1.2",
|
||||
"contentHash": "2hBr6zdbIBTDE3EhK7NSVNdX58uTK6iHW/P/Axmm9sl1xoGSLqDvMtpecn226TNwHByFokYwJmt/aQQNlO5CRw=="
|
||||
},
|
||||
"System.Threading.Tasks.Extensions": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -108,11 +98,6 @@
|
|||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
"Validation": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.5.51",
|
||||
"contentHash": "g/Aug7PVWaenlJ0QUyt/mEetngkQNsMCuNeRVXbcJED1nZS7JcK+GTU4kz3jcQ7bFuKfi8PF4ExXH7XSFNuSLQ=="
|
||||
},
|
||||
"xunit.abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.0.3",
|
||||
|
|
@ -156,34 +141,47 @@
|
|||
"sharpcompress": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"System.Buffers": "[4.6.0, )",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "[8.0.0, )",
|
||||
"System.Buffers": "[4.6.1, )",
|
||||
"System.Memory": "[4.6.3, )",
|
||||
"System.Text.Encoding.CodePages": "[8.0.0, )",
|
||||
"ZstdSharp.Port": "[0.8.6, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Bcl.AsyncInterfaces": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "3WA9q9yVqJp222P3x1wYIGDAkpjAku0TMUaaQV22g6L67AI0LdOIrVS7Ht2vJfLHGSPVuqN94vIr15qn+HEkHw==",
|
||||
"dependencies": {
|
||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||
}
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
"requested": "[4.6.1, )",
|
||||
"resolved": "4.6.1",
|
||||
"contentHash": "N8GXpmiLMtljq7gwvyS+1QvKT/W2J8sNAvx+HVg4NGmsG/H+2k/y9QI23auLJRterrzCiDH+IWAw4V/GPwsMlw=="
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.5.5",
|
||||
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
|
||||
"requested": "[4.6.3, )",
|
||||
"resolved": "4.6.3",
|
||||
"contentHash": "qdcDOgnFZY40+Q9876JUHnlHu7bosOHX8XISRoH94fwk6hgaeQGSgfZd8srWRZNt5bV9ZW2TljcegDNxsf+96A==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.5.1",
|
||||
"System.Numerics.Vectors": "4.5.0",
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
"System.Buffers": "4.6.1",
|
||||
"System.Numerics.Vectors": "4.6.1",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.1.2"
|
||||
}
|
||||
},
|
||||
"System.Text.Encoding.CodePages": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[8.0.0, )",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "OZIsVplFGaVY90G2SbpgU7EnCoOO5pw1t4ic21dBF3/1omrJFpAGoNAVpPyMVOC90/hvgkGG3VFqR13YgZMQfg==",
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.5",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"ZstdSharp.Port": {
|
||||
|
|
@ -201,18 +199,18 @@
|
|||
"net8.0": {
|
||||
"AwesomeAssertions": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.2.0, )",
|
||||
"resolved": "9.2.0",
|
||||
"contentHash": "RCkuFyKmesmZR74XLOzYvTpG/IbHfBeFapFTMvFskPzEK4z3YrVmHB2FIFJ0DhwjuIDdPL/hc8zS40IwMAN0BA=="
|
||||
"requested": "[9.2.1, )",
|
||||
"resolved": "9.2.1",
|
||||
"contentHash": "lbwhyQNXxxEGx4oCbFqNfFy2DsywsvNhN6qoOjY4wwhMgI2L9+YrxjyF/M0io99yrvWV1Cjj12LP2QGcC43Uhw=="
|
||||
},
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"type": "Direct",
|
||||
"requested": "[17.13.0, )",
|
||||
"resolved": "17.13.0",
|
||||
"contentHash": "W19wCPizaIC9Zh47w8wWI/yxuqR7/dtABwOrc8r2jX/8mUNxM2vw4fXDh+DJTeogxV+KzKwg5jNNGQVwf3LXyA==",
|
||||
"requested": "[18.0.0, )",
|
||||
"resolved": "18.0.0",
|
||||
"contentHash": "bvxj2Asb7nT+tqOFFerrhQeEjUYLwx0Poi0Rznu63WbqN+A4uDn1t5NWXfAOOQsF6lpmK6N2v+Vvgso7KWZS7g==",
|
||||
"dependencies": {
|
||||
"Microsoft.CodeCoverage": "17.13.0",
|
||||
"Microsoft.TestPlatform.TestHost": "17.13.0"
|
||||
"Microsoft.CodeCoverage": "18.0.0",
|
||||
"Microsoft.TestPlatform.TestHost": "18.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies": {
|
||||
|
|
@ -247,20 +245,10 @@
|
|||
"resolved": "3.1.5",
|
||||
"contentHash": "tKi7dSTwP4m5m9eXPM2Ime4Kn7xNf4x4zT9sdLO/G4hZVnQCRiMTWoSZqI/pYTVeI27oPPqHBKYI/DjJ9GsYgA=="
|
||||
},
|
||||
"Xunit.SkippableFact": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.5.23, )",
|
||||
"resolved": "1.5.23",
|
||||
"contentHash": "JlKobLTlsGcuJ8OtoodxL63bUagHSVBnF+oQ2GgnkwNqK+XYjeYyhQasULi5Ebx1MNDGNbOMplQYr89mR+nItQ==",
|
||||
"dependencies": {
|
||||
"Validation": "2.5.51",
|
||||
"xunit.extensibility.execution": "2.4.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeCoverage": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.13.0",
|
||||
"contentHash": "9LIUy0y+DvUmEPtbRDw6Bay3rzwqFV8P4efTrK4CZhQle3M/QwLPjISghfcolmEGAPWxuJi6m98ZEfk4VR4Lfg=="
|
||||
"resolved": "18.0.0",
|
||||
"contentHash": "DFPhMrsIofgJ1DDU3ModqqRArDm15/bNl4ecmcuBspZkZ4ONYnCC0R8U27WzK7cYv6r8l6Q/fRmvg7cb+I/dJA=="
|
||||
},
|
||||
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -269,35 +257,38 @@
|
|||
},
|
||||
"Microsoft.TestPlatform.ObjectModel": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.13.0",
|
||||
"contentHash": "bt0E0Dx+iqW97o4A59RCmUmz/5NarJ7LRL+jXbSHod72ibL5XdNm1Ke+UO5tFhBG4VwHLcSjqq9BUSblGNWamw==",
|
||||
"resolved": "18.0.0",
|
||||
"contentHash": "Al/a99ymb8UdEEh6DKNiaoFn5i8fvX5PdM9LfU9Z/Q8NJrlyHHzF+LRHLbR+t89gRsJ2fFMpwYxgEn3eH1BQwA==",
|
||||
"dependencies": {
|
||||
"System.Reflection.Metadata": "1.6.0"
|
||||
"System.Reflection.Metadata": "8.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.TestPlatform.TestHost": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.13.0",
|
||||
"contentHash": "9GGw08Dc3AXspjekdyTdZ/wYWFlxbgcF0s7BKxzVX+hzAwpifDOdxM+ceVaaJSQOwqt3jtuNlHn3XTpKUS9x9Q==",
|
||||
"resolved": "18.0.0",
|
||||
"contentHash": "aAxE8Thr9ZHGrljOYaDeLJqitQi75iE4xeEFn6CEGFirlHSn1KwpKPniuEn6zCLZ90Z3XqNlrC3ZJTuvBov45w==",
|
||||
"dependencies": {
|
||||
"Microsoft.TestPlatform.ObjectModel": "17.13.0",
|
||||
"Newtonsoft.Json": "13.0.1"
|
||||
"Microsoft.TestPlatform.ObjectModel": "18.0.0",
|
||||
"Newtonsoft.Json": "13.0.3"
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json": {
|
||||
"type": "Transitive",
|
||||
"resolved": "13.0.1",
|
||||
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
|
||||
"resolved": "13.0.3",
|
||||
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
|
||||
},
|
||||
"System.Collections.Immutable": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg=="
|
||||
},
|
||||
"System.Reflection.Metadata": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.6.0",
|
||||
"contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ=="
|
||||
},
|
||||
"Validation": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.5.51",
|
||||
"contentHash": "g/Aug7PVWaenlJ0QUyt/mEetngkQNsMCuNeRVXbcJED1nZS7JcK+GTU4kz3jcQ7bFuKfi8PF4ExXH7XSFNuSLQ=="
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==",
|
||||
"dependencies": {
|
||||
"System.Collections.Immutable": "8.0.0"
|
||||
}
|
||||
},
|
||||
"xunit.abstractions": {
|
||||
"type": "Transitive",
|
||||
|
|
@ -342,16 +333,9 @@
|
|||
"sharpcompress": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"System.Buffers": "[4.6.0, )",
|
||||
"ZstdSharp.Port": "[0.8.6, )"
|
||||
}
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[4.6.0, )",
|
||||
"resolved": "4.6.0",
|
||||
"contentHash": "lN6tZi7Q46zFzAbRYXTIvfXcyvQQgxnY7Xm6C6xQ9784dEL1amjM6S6Iw4ZpsvesAKnRVsM4scrDQaDqSClkjA=="
|
||||
},
|
||||
"ZstdSharp.Port": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[0.8.6, )",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue