private void BeginInstall()
{
if (!RobustFile.Exists(_path))
{
string msg = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.DoesNotExist", "{0} does not exist");
ErrorReport.NotifyUserOfProblem(msg, _path);
return;
}
//For BL-3061 at the moment, I'm just trying to log more information.
Logger.WriteEvent("BloomPackInstallDialog.BeginInstall. _path is " + _path);
_folderName = GetRootFolderName();
Logger.WriteEvent("BloomPackInstallDialog.BeginInstall. _folderName is " + _folderName);
if (_folderName == null)
return;
string destinationFolder = Path.Combine(ProjectContext.GetInstalledCollectionsDirectory(), _folderName);
if (Directory.Exists(destinationFolder))
{
Logger.WriteEvent("Bloom Pack already exists, asking...");
string title = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.BloomPackInstaller",
"Bloom Pack Installer", "Displayed as the message box title");
string msg = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.Replace",
"This computer already has a Bloom collection named '{0}'. Do you want to replace it with the one from this Bloom Pack?");
msg = string.Format(msg, _folderName);
if (DialogResult.OK != MessageBox.Show(msg, title, MessageBoxButtons.OKCancel))
{
_message.Text = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.NotInstalled", "The Bloom collection will not be installed.");
_okButton.Text = L10NSharp.LocalizationManager.GetString("Common.CancelButton", "&Cancel");
return;
}
try
{
Logger.WriteEvent("Deleting existing Bloom Pack at " + destinationFolder);
DeleteExistingDirectory(destinationFolder);
}
catch (Exception error)
{
string text = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.UnableToReplace", "Bloom was not able to remove the existing copy of '{0}'. Quit Bloom if it is running & try again. Otherwise, try again after restarting your computer.");
throw new ApplicationException(string.Format(text, destinationFolder), error);
}
}
Logger.WriteEvent("Installing Bloom Pack " + _path);
_okButton.Enabled = false;
_message.Text = L10NSharp.LocalizationManager.GetString("BloomPackInstallDialog.Extracting", "Extracting...", "Shown while Bloom Packs are being installed");
_backgroundWorker.RunWorkerAsync();
}