@@ -21,7 +21,7 @@ public partial class Install : Form
2121 ZipArchive archive ;
2222 IReader reader ;
2323
24- bool finishedWriting = false ;
24+ bool doneCancelling = false ;
2525
2626 public Install ( ) => InitializeComponent ( ) ;
2727
@@ -30,7 +30,7 @@ private async void Install_Load(object sender, EventArgs e)
3030 downloader . DownloadProgressChanged += OnDownloadProgressChanged ;
3131
3232 stream = await downloader . DownloadFileTaskAsync ( "https://bluepload.unstable.life/selif/flashpointdummy.zip" ) ;
33- //stream = System.IO.File.OpenRead(@"E:\Flashpoint 11 Infinity .zip");
33+ //stream = System.IO.File.OpenRead(@"E:\flashpointdummy .zip");
3434
3535 if ( ! downloader . IsCancelled )
3636 {
@@ -88,7 +88,9 @@ private void ExtractTask()
8888
8989 if ( reader . Cancelled )
9090 {
91- finishedWriting = true ;
91+ Directory . Delete ( Path . Combine ( mainForm . FolderTextBox . Text , "Flashpoint 11 Infinity" ) , true ) ;
92+
93+ doneCancelling = true ;
9294 }
9395 else
9496 {
@@ -134,17 +136,7 @@ private async void Cancel_Click(object sender, EventArgs e)
134136 {
135137 reader . Cancel ( ) ;
136138
137- await Task . Run ( ( ) =>
138- {
139- Info . Invoke ( ( MethodInvoker ) delegate
140- {
141- Info . Text = $ "Cancelling installation...";
142- } ) ;
143-
144- while ( ! finishedWriting ) { }
145-
146- Directory . Delete ( Path . Combine ( mainForm . FolderTextBox . Text , "Flashpoint 11 Infinity" ) , true ) ;
147- } ) ;
139+ await Task . Run ( ( ) => { while ( ! doneCancelling ) { } } ) ;
148140 }
149141
150142 Close ( ) ;
0 commit comments