-
Notifications
You must be signed in to change notification settings - Fork 1
Description
There's a significant amount of UI blocking and lag during import/export. Is there anything else we can do?
Loading screen:
- The loading screen indicator animation should always play smoothly and never be blocked during work
- During export, the loading indicator screen should be shown while the archive is being created instead of only while saving
- There should be a "Do not close the app" warning on the loading screen
Maybe we can improve the actual export/import time as well as it takes several seconds currently.
.NET 10 introduces new asynchronous APIs that make it easier to perform non-blocking operations when reading from or writing to ZIP files. This feature was highly requested by the community.
New async methods are available for extracting, creating, and updating ZIP archives. These methods enable developers to efficiently handle large files and improve application responsiveness, especially in scenarios involving I/O-bound operations. These methods include:
ZipArchive.CreateAsync(Stream, ZipArchiveMode, Boolean, Encoding, CancellationToken)
ZipArchiveEntry.OpenAsync(CancellationToken)
ZipFile.CreateFromDirectoryAsync
ZipFile.ExtractToDirectoryAsync
ZipFile.OpenAsync
ZipFile.OpenReadAsync(String, CancellationToken)
ZipFileExtensions.CreateEntryFromFileAsync
ZipFileExtensions.ExtractToDirectoryAsync
ZipFileExtensions.ExtractToFileAsync
Examples:
// Extract a Zip archive
await ZipFile.ExtractToDirectoryAsync("archive.zip", "destinationFolder", overwriteFiles: true);
// Create a Zip archive
await ZipFile.CreateFromDirectoryAsync("sourceFolder", "archive.zip", CompressionLevel.SmallestSize, includeBaseDirectory: true, entryNameEncoding: Encoding.UTF8);
// Open an archive
await using ZipArchive archive = ZipFile.OpenReadAsync("archive.zip");
// Fine-grained manipulation
using FileStream archiveStream = File.OpenRead("archive.zip");
await using (ZipArchive archive = await ZipArchive.CreateAsync(archiveStream, ZipArchiveMode.Update, leaveOpen: false, entryNameEncoding: Encoding.UTF8))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
// Extract an entry to the filesystem
await entry.ExtractToFileAsync(destinationFileName: "file.txt", overwrite: true);
// Open an entry's stream
await using Stream entryStream = await entry.OpenAsync();
// Create an entry from a filesystem object
ZipArchiveEntry createdEntry = await archive.CreateEntryFromFileAsync(sourceFileName "path/to/file.txt", entryName: "file.txt");
}
}