private void Completed(object sender, AsyncCompletedEventArgs e, string updatedFile)
{
FileInfo destFile = new FileInfo(Path.Combine(updatedFile, @"\Chromatics.zip"));
if (destFile.Extension.ToLower() == ".zip")
{
lbl_data.Text = "Extracting Update..";
ZipArchive zipArchive = ZipFile.OpenRead(updatedFile + @"\Chromatics.zip");
foreach (ZipArchiveEntry entry in zipArchive.Entries)
{
string fullPath = Path.Combine(updatedFile + @"\", entry.FullName);
if (String.IsNullOrEmpty(entry.Name))
{
Directory.CreateDirectory(fullPath);
}
else
{
if (!entry.Name.Equals("updater.exe"))
{
entry.ExtractToFile(fullPath, true);
}
}
}
zipArchive.Dispose();
//File.Delete(updatedFile + @"\Chromatics.zip");
lbl_data.Text = "Closing Updater";
if (File.Exists(@"C:\Program Files (x86)\Advanced Combat Tracker\Advanced Combat Tracker.exe"))
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\Program Files (x86)\Advanced Combat Tracker\Advanced Combat Tracker.exe";
Process.Start(startInfo);
}
System.Windows.Forms.Application.Exit();
}
else
{
lbl_data.Text = "The downloaded file did not contain a valid Chromatics file (Unknown file type)";
}
}