diff --git a/src/SharpCompress/Archives/Rar/RarArchive.cs b/src/SharpCompress/Archives/Rar/RarArchive.cs index 2afd20be..a05ad417 100644 --- a/src/SharpCompress/Archives/Rar/RarArchive.cs +++ b/src/SharpCompress/Archives/Rar/RarArchive.cs @@ -32,18 +32,22 @@ protected override IEnumerable 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() diff --git a/tests/SharpCompress.Test/OperatingSystemExtensions.cs b/tests/SharpCompress.Test/OperatingSystemExtensions.cs index 96fbd6d4..c8ca768e 100644 --- a/tests/SharpCompress.Test/OperatingSystemExtensions.cs +++ b/tests/SharpCompress.Test/OperatingSystemExtensions.cs @@ -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; }