Skip to content

Commit

Permalink
fix and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Hathcock committed Apr 23, 2024
1 parent b94e75f commit 9622853
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/SharpCompress/Archives/Rar/RarArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,22 @@ protected override IEnumerable<RarVolume> LoadVolumes(SourceStream sourceStream)
{
sourceStream.LoadAllParts(); //request all streams
var streams = sourceStream.Streams.ToArray();
var i = 0;
if (streams.Length > 1 && IsRarFile(streams[1], ReaderOptions)) //test part 2 - true = multipart not split
{
sourceStream.IsVolumes = true;
streams[1].Position = 0;
sourceStream.Position = 0;

return sourceStream.Streams.Select(a => new StreamRarArchiveVolume(a, ReaderOptions, 0));
}
else //split mode or single file
{
return new StreamRarArchiveVolume(sourceStream, ReaderOptions, 0).AsEnumerable();
return sourceStream.Streams.Select(a => new StreamRarArchiveVolume(
a,
ReaderOptions,
i++
));
}

//split mode or single file
return new StreamRarArchiveVolume(sourceStream, ReaderOptions, i++).AsEnumerable();
}

protected override IReader CreateReaderForSolidExtraction()
Expand Down
5 changes: 4 additions & 1 deletion tests/SharpCompress.Test/OperatingSystemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ namespace SharpCompress.Test;

public static class OperatingSystemExtensions
{
public static bool IsWindows(this OperatingSystem os) => os.Platform == PlatformID.Win32NT || os.Platform == PlatformID.Win32Windows || os.Platform == PlatformID.Win32S;
public static bool IsWindows(this OperatingSystem os) =>
os.Platform == PlatformID.Win32NT
|| os.Platform == PlatformID.Win32Windows
|| os.Platform == PlatformID.Win32S;
}

0 comments on commit 9622853

Please sign in to comment.