NicholasMag

Ok, well this is a patcher i am currently using and it unzips what is in the .zip archive just downloaded. But i run into the problem of it not unzipping. It used to unzip it but would freeze the program, so i said a background worker would be best.

I Couldnt figure out any other way to call this up so here is what calls the background worker:

// Client download has successfully downloaded and calls this function

private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)

{

backgroundWorker1.RunWorkerAsync();

}

// The background worker

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)

{

DirectoryInfo Dir = new DirectoryInfo(System.Environment.CurrentDirectory);

FileInfo[] file = Dir.GetFiles("*.zip"); // grab the file list of all zip files in directory

// MessageBox.Show(Dir.ToString()); // Testing purposes

FastZip zip = new FastZip();

foreach (FileInfo Fi in file)

{

if (Fi.Exists)

{

zip.ExtractZip(Fi.ToString(), "", ""); // extract the file

Fi.Delete();

}

}

button2.Enabled = true; //enabling the Start Program Button

updated = true; //Setting the updated status to true, so they cannot repeat the update

}

Ive tried to debug the application but nothing, reports it working fine



Re: Visual C# Express Edition Background service not doing its job...

Andreas Johansson

What do you mean that the debugging the app gives nothing

I have looked it over and I am not able to see that it would fail.