I'm having an issue with my background worker... It just stops.. It doesn't go through all the code that it is supposed to go through...
In the code below it just stops at String gName = comboBox1.SelectedItem.ToString();
With no errors nothing.. The code below simply does not get run.. I tested this by puting a breakpoint at ZipFile pack = new ZipFile();
... The breakpoint does not get triggered... I have gone through my code over and over again... I can't find out why it does that...
Background worker:
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
String appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString();
String gpsPath = appDataFolder + "/GameProfileSaver";
String userDir = gpsPath + "/profiles/" + currentUserLabel.Text;
XmlDocument doc = new XmlDocument();
doc.Load(userDir + "\\games.xml");
String gName = comboBox1.SelectedItem.ToString();
ZipFile pack = new ZipFile();
foreach (XmlNode node in doc.SelectNodes("//games/game[gameName='" + gName + "']/Files/file"))
{
try
{
if (!Directory.Exists(userDir + "\\" + gName))
{
Directory.CreateDirectory(userDir + "\\" + gName);
}
pack.AddFile(node.InnerText);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
pack.Save(userDir + "\\" + gName);
}