Skip to content

Commit

Permalink
update and rerun csharpier
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Hathcock committed Dec 18, 2023
1 parent c0e01ac commit ea3a96e
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.26.1",
"version": "0.26.7",
"commands": [
"dotnet-csharpier"
]
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.101",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
3 changes: 1 addition & 2 deletions src/SharpCompress/Archives/ArchiveFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public static IArchive Open(Stream stream, ReaderOptions? readerOptions = null)
public static IWritableArchive Create(ArchiveType type)
{
var factory = Factory
.Factories
.OfType<IWriteableArchiveFactory>()
.Factories.OfType<IWriteableArchiveFactory>()
.FirstOrDefault(item => item.KnownArchiveType == type);

if (factory != null)
Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Archives/Rar/RarArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ protected override IEnumerable<RarVolume> LoadVolumes(SourceStream srcStream)
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
{
Expand Down
12 changes: 5 additions & 7 deletions src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,11 @@ var group in entries.Where(x => !x.IsDirectory).GroupBy(x => x.FilePart.Folder)
}
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)
{
Expand Down
10 changes: 5 additions & 5 deletions src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ private void Initialize()
var rfc2898 = new Rfc2898DeriveBytes(_password, _salt, RFC2898_ITERATIONS);
#else
var rfc2898 = new Rfc2898DeriveBytes(
_password,
_salt,
RFC2898_ITERATIONS,
HashAlgorithmName.SHA1
);
_password,
_salt,
RFC2898_ITERATIONS,
HashAlgorithmName.SHA1
);
#endif

KeyBytes = rfc2898.GetBytes(KeySizeInBytes); // 16 or 24 or 32 ???
Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/Common/Zip/ZipHeaderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ private void LoadHeader(ZipFileEntry entryHeader, Stream stream)

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];
Expand Down
7 changes: 3 additions & 4 deletions src/SharpCompress/Compressors/Rar/UnpackV1/Unpack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,10 +1269,9 @@ private bool AddVMCode(int firstByte, List<byte> vmCode, int length)
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;
Expand Down
4 changes: 1 addition & 3 deletions src/SharpCompress/Writers/WriterFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ public static class WriterFactory
public static IWriter Open(Stream stream, ArchiveType archiveType, WriterOptions writerOptions)
{
var factory = Factories
.Factory
.Factories
.OfType<IWriterFactory>()
.Factory.Factories.OfType<IWriterFactory>()
.FirstOrDefault(item => item.KnownArchiveType == archiveType);

if (factory != null)
Expand Down
6 changes: 3 additions & 3 deletions tests/SharpCompress.Test/Tar/TarArchiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ public void Tar_Random_Write_Remove()

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);
}
Expand Down
23 changes: 9 additions & 14 deletions tests/SharpCompress.Test/Tar/TarReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,9 @@ public void Tar_Broken_Stream()
[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"))
)
Expand Down Expand Up @@ -256,15 +254,12 @@ public void Tar_GZip_With_Symlink_Entries()
{
// 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());
}
Expand Down
8 changes: 4 additions & 4 deletions tests/SharpCompress.Test/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
24 changes: 12 additions & 12 deletions tests/SharpCompress.Test/Zip/ZipArchiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ public void Zip_Random_Write_Remove()

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);
Expand Down Expand Up @@ -252,9 +252,9 @@ public void Zip_Removal_Poly()
)
);
Assert.Null(
((IArchive)vfs)
.Entries
.FirstOrDefault(v => v.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))
((IArchive)vfs).Entries.FirstOrDefault(
v => v.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
)
);
}
}
Expand Down Expand Up @@ -391,14 +391,14 @@ var file in Directory.EnumerateFiles(
{
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);
Expand Down

0 comments on commit ea3a96e

Please sign in to comment.