fix and fmt

This commit is contained in:
Adam Hathcock
2024-04-23 09:16:05 +01:00
parent b94e75fabe
commit 9622853b8d
2 changed files with 13 additions and 6 deletions

View File

@@ -32,18 +32,22 @@ public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
{
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()

View File

@@ -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;
}