Open Helios747 opened 7 years ago
Culprit is this block of code found in Backend.cs , method Download(string url, string version):
while (client.IsBusy) { Application.DoEvents(); }
Basically code is very messy and kinda broken.
In that Download method you called the DownloadFileAsync method which will put download task in a separate thread which is a good thing since you can monitor and update your loading bar that way.
BUT it also means that the program will CONTINUE to run after that method is called and it looks like you completely missed that part and programmed the code as if the program will wait until the download is done.
My guess is that you made a quick fix by calling while (client.IsBusy)
which solved your problem because it basically "paused" the program and didn't allow it to go further to the extracting part(which will result in an error since it can't extract a file that that isn't yet downloaded).
So how do we fix this? Basically it sounds easy; just remove that block of code and add something like this in the Download method:
client.DownloadFileCompleted += DownloadCompleted;
Which will call:
public void DownloadCompleted(object senderMain, AsyncCompletedEventArgs e) { Console.WriteLine("Download completed, extracting"); }
But since you have a bunch of weird while loops it's actually quite more difficult, meaning you would have to rewrite most of the Backend.cs so that the functions considering extracting and running build are called in the new DownloadCompleted(object senderMain, AsyncCompletedEventArgs e)
method.
Hey, thanks for looking into this!
Yeah, it's a bit messy. I can look into implementing your ideas when I get a chance to sit down and look at this possibly later this weekend.
I do want to rewrite backend.cs a bit. All of the downloading code can be pulled out to it's own class. The core program loop can probably also be cleaned up. I just need to sit down and do a general clean up of the code. Too many "oh crap, I broke that, this fixes it real quick" things. :P
no idea whats causing this.