diff --git a/src/SharpCompress/Archives/ArchiveFactory.Information.Async.cs b/src/SharpCompress/Archives/ArchiveFactory.Information.Async.cs index c4fd4fa2..cb5b763a 100644 --- a/src/SharpCompress/Archives/ArchiveFactory.Information.Async.cs +++ b/src/SharpCompress/Archives/ArchiveFactory.Information.Async.cs @@ -528,6 +528,7 @@ public static partial class ArchiveFactory _ => entries.Aggregate(0L, (total, entry) => total + entry.CompressedSize), }; + [Zomp.SyncMethodGenerator.CreateSyncVersion] private static async ValueTask<( ZipArchiveInformation? Information, long DeferredSizeEntryCount @@ -545,7 +546,9 @@ public static partial class ArchiveFactory long deferredSizeEntryCount = 0; foreach (var entry in entries.OfType()) { +#if !SYNC_ONLY cancellationToken.ThrowIfCancellationRequested(); +#endif var filePart = entry.Parts.OfType().Single(); if (!filePart.HasDeferredSizes) { diff --git a/src/SharpCompress/Archives/ArchiveFactory.Information.cs b/src/SharpCompress/Archives/ArchiveFactory.Information.cs index 264e55c9..01a06ed5 100644 --- a/src/SharpCompress/Archives/ArchiveFactory.Information.cs +++ b/src/SharpCompress/Archives/ArchiveFactory.Information.cs @@ -387,35 +387,6 @@ public static partial class ArchiveFactory ? ArchiveInformationStatus.Complete : ArchiveInformationStatus.Partial; - private static ( - ZipArchiveInformation? Information, - long DeferredSizeEntryCount - ) GetZipInformation(bool isZipArchive, IEnumerable entries) - { - if (!isZipArchive) - { - return (null, 0); - } - - long deferredSizeEntryCount = 0; - foreach (var entry in entries.OfType()) - { - var filePart = entry.Parts.OfType().Single(); - if (!filePart.HasDeferredSizes) - { - continue; - } - - var localHeader = filePart.GetRawLocalHeader(); - if (localHeader.CompressedSize == 0 && localHeader.UncompressedSize == 0) - { - deferredSizeEntryCount++; - } - } - - return (new ZipArchiveInformation(deferredSizeEntryCount > 0), deferredSizeEntryCount); - } - private static (bool IsSolid, long SolidStreamCount) GetSolidInformation( IArchive archive, IReadOnlyCollection entries diff --git a/src/SharpCompress/Common/Zip/SeekableZipFilePart.Async.cs b/src/SharpCompress/Common/Zip/SeekableZipFilePart.Async.cs index f4ff6799..c81c11ed 100644 --- a/src/SharpCompress/Common/Zip/SeekableZipFilePart.Async.cs +++ b/src/SharpCompress/Common/Zip/SeekableZipFilePart.Async.cs @@ -26,6 +26,9 @@ internal partial class SeekableZipFilePart .GetLocalHeaderAsync(BaseStream, _directoryEntryHeader) .ConfigureAwait(false); - internal ValueTask GetRawLocalHeaderAsync() => - _headerFactory.GetRawLocalHeaderAsync(BaseStream, _directoryEntryHeader); + [Zomp.SyncMethodGenerator.CreateSyncVersion] + internal async ValueTask GetRawLocalHeaderAsync() => + await _headerFactory + .GetRawLocalHeaderAsync(BaseStream, _directoryEntryHeader) + .ConfigureAwait(false); } diff --git a/src/SharpCompress/Common/Zip/SeekableZipFilePart.cs b/src/SharpCompress/Common/Zip/SeekableZipFilePart.cs index 166c55b8..baab3218 100644 --- a/src/SharpCompress/Common/Zip/SeekableZipFilePart.cs +++ b/src/SharpCompress/Common/Zip/SeekableZipFilePart.cs @@ -22,9 +22,6 @@ internal partial class SeekableZipFilePart : ZipFilePart _directoryEntryHeader = header; } - internal LocalEntryHeader GetRawLocalHeader() => - _headerFactory.GetRawLocalHeader(BaseStream, _directoryEntryHeader); - internal bool HasDeferredSizes => FlagUtility.HasFlag(_directoryEntryHeader.Flags, HeaderFlags.UsePostDataDescriptor);