Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api_list.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@
* `Task ExtractToFileAsync(string, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.zipfileextensions.extracttofileasync?view=net-11.0#system-io-compression-zipfileextensions-extracttofileasync(system-io-compression-ziparchiveentry-system-string-system-threading-cancellationtoken))
* `Stream Open(FileAccess)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.open?view=net-11.0)
* `Task<Stream> OpenAsync(CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-threading-cancellationtoken))
* `ValueTask<Stream> OpenAsync(FileAccess, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-io-fileaccess-system-threading-cancellationtoken))
* `Task<Stream> OpenAsync(FileAccess, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-io-fileaccess-system-threading-cancellationtoken))
* `int ExternalAttributes` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.externalattributes?view=net-11.0)


Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ The class `Polyfill` includes the following extension methods:
* `Task ExtractToFileAsync(string, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.zipfileextensions.extracttofileasync?view=net-11.0#system-io-compression-zipfileextensions-extracttofileasync(system-io-compression-ziparchiveentry-system-string-system-threading-cancellationtoken))
* `Stream Open(FileAccess)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.open?view=net-11.0)
* `Task<Stream> OpenAsync(CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-threading-cancellationtoken))
* `ValueTask<Stream> OpenAsync(FileAccess, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-io-fileaccess-system-threading-cancellationtoken))
* `Task<Stream> OpenAsync(FileAccess, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-io-fileaccess-system-threading-cancellationtoken))
* `int ExternalAttributes` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.externalattributes?view=net-11.0)


Expand Down
2 changes: 0 additions & 2 deletions src/Consume/Consume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2298,9 +2298,7 @@ void XCData_Methods(XCData cdata) =>
void ZipArchiveEntry_Methods(ZipArchive zip, ZipArchiveEntry entry)
{
entry.Open(FileAccess.Read);
#if FeatureValueTask
entry.OpenAsync(FileAccess.Read);
#endif
entry.OpenAsync();
zip.CreateEntryFromFile("file.txt", "entry.txt");
zip.CreateEntryFromFile("file.txt", "entry.txt", CompressionLevel.Optimal);
Expand Down
6 changes: 2 additions & 4 deletions src/Polyfill/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,16 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();

#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.ziparchiveentry.openasync?view=net-11.0#system-io-compression-ziparchiveentry-openasync(system-io-fileaccess-system-threading-cancellationtoken)
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
#endif

#if !NETSTANDARD2_1_OR_GREATER && !NETCOREAPP2_0_OR_GREATER

Expand Down
6 changes: 2 additions & 4 deletions src/Split/net10.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ static partial class Polyfill
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/net461/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net462/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net47/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net471/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net472/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net48/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net481/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
/// <summary>
/// Extracts all the files in the zip archive to a directory on the file system.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Split/net5.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/net6.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/net7.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/net8.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/net9.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/netcoreapp2.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/netcoreapp2.1/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/netcoreapp2.2/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/netcoreapp3.0/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
6 changes: 2 additions & 4 deletions src/Split/netcoreapp3.1/Polyfill_Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ public static Task ExtractToFileAsync(this ZipArchiveEntry source, string destin
/// </summary>
public static Stream Open(this ZipArchiveEntry target, FileAccess access) =>
target.Open();
#if FeatureValueTask
/// <summary>
/// Asynchronously opens the entry from the zip archive with the specified access mode.
/// </summary>
public static ValueTask<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
public static Task<Stream> OpenAsync(this ZipArchiveEntry target, FileAccess access, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
return new ValueTask<Stream>(target.Open());
return Task.FromResult(target.Open());
}
#endif
}
#endif
Loading
Loading