mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
stop fastzip from extracting on cancellation
This commit is contained in:
parent
55f5ef48e8
commit
98e72e29b6
@ -16,6 +16,9 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
|
using ICSharpCode.SharpZipLib.Core;
|
||||||
|
|
||||||
using Bloxstrap.AppData;
|
using Bloxstrap.AppData;
|
||||||
|
|
||||||
namespace Bloxstrap
|
namespace Bloxstrap
|
||||||
@ -1048,6 +1051,12 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnFastZipProcessFile(object sender, ScanEventArgs e)
|
||||||
|
{
|
||||||
|
// stop extracting if cancellation requested
|
||||||
|
e.ContinueRunning = !_cancelTokenSource.IsCancellationRequested;
|
||||||
|
}
|
||||||
|
|
||||||
private void ExtractPackage(Package package, List<string>? files = null)
|
private void ExtractPackage(Package package, List<string>? files = null)
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "Bootstrapper::ExtractPackage";
|
const string LOG_IDENT = "Bootstrapper::ExtractPackage";
|
||||||
@ -1068,7 +1077,10 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, $"Extracting {package.Name}...");
|
App.Logger.WriteLine(LOG_IDENT, $"Extracting {package.Name}...");
|
||||||
|
|
||||||
var fastZip = new ICSharpCode.SharpZipLib.Zip.FastZip();
|
var events = new FastZipEvents();
|
||||||
|
events.ProcessFile += OnFastZipProcessFile;
|
||||||
|
|
||||||
|
var fastZip = new FastZip(events);
|
||||||
fastZip.ExtractZip(package.DownloadPath, packageFolder, fileFilter);
|
fastZip.ExtractZip(package.DownloadPath, packageFolder, fileFilter);
|
||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, $"Finished extracting {package.Name}");
|
App.Logger.WriteLine(LOG_IDENT, $"Finished extracting {package.Name}");
|
||||||
|
Loading…
Reference in New Issue
Block a user