private void InstallUpdates(ICollection <ToolUpdateInfo> tools) { if (tools != null && tools.Count != 0 && !TestingDownloadOnly) { var failedUpdates = new Dictionary <string, string>(); var successfulUpdates = new Collection <string>(); int installCount = 0; foreach (var tool in tools) { labelOperation.Text = string.Format(Resources.ToolUpdatesDlg_InstallUpdates_Installing_updates_to__0_, tool._packageName); var toolList = ToolList.CopyTools(Settings.Default.ToolList); bool exceptionThrown = false; ToolInstaller.UnzipToolReturnAccumulator result = null; try { result = _updateHelper.UnpackZipTool(tool.FilePath, new ToolInstallUI.InstallZipToolHelper(_parent.InstallProgram)); } catch (ToolExecutionException x) { failedUpdates.Add(tool._packageName, x.Message); exceptionThrown = true; } catch (IOException x) { failedUpdates.Add(tool._packageName, TextUtil.LineSeparate(string.Format(Resources.ConfigureToolsDlg_UnpackZipTool_Failed_attempting_to_extract_the_tool_from__0_, Path.GetFileName(tool.FilePath)), x.Message)); exceptionThrown = true; } progressBar.Value = Convert.ToInt32((((((double)++installCount) / tools.Count) * 100) / 2) + 50); if (result == null) { // user cancelled if (!exceptionThrown) { failedUpdates.Add(tool._packageName, Resources.ToolUpdatesDlg_InstallUpdates_User_cancelled_installation); } // reset tool list Settings.Default.ToolList = toolList; continue; } // tool was successfully updated result.MessagesThrown.ForEach(message => MessageDlg.Show(this, message)); successfulUpdates.Add(tool._packageName); } // clean-up DirectoryEx.SafeDelete(ToolDir.FullName); progressBar.Value = 100; DisplayInstallSummary(successfulUpdates, failedUpdates); } }