public static void EnsureDownloadFolderExists()
        {
            // We need the download folder to exist if we are asked to download a book.
            // We also want it to exist, to show the (planned) link that offers to launch the web site.
            // Another advantage of creating it early is that we don't have to create it in the UI when we want to add
            // a downloaded book to the UI.
            // So, we just make sure it exists here at startup.
            string downloadFolder = BookDownload.DownloadFolder;

            if (!Directory.Exists(downloadFolder))
            {
                var pathToSettingsFile = CollectionSettings.GetPathForNewSettings(Path.GetDirectoryName(downloadFolder),
                                                                                  Path.GetFileName(downloadFolder));
                var settings = new NewCollectionSettings()
                {
                    IsSourceCollection = true,
                    PathToSettingsFile = pathToSettingsFile
                                         // All other defaults are fine
                };
                settings.Language1.Iso639Code = "en";
                settings.Language1.SetName("English", false);
                CollectionSettings.CreateNewCollection(settings);
                ProjectContext.ClearUserInstalledDirectoriesCache();
            }
        }
        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;
            }
            ProjectContext.ClearUserInstalledDirectoriesCache();             // we're about to make a new collection it needs to notice
            _rootDestFolder = ProjectContext.GetInstalledCollectionsDirectory();
            if (_folderName.ToLowerInvariant().Contains("xmatter"))
            {
                _rootDestFolder = ProjectContext.XMatterAppDataFolder;
            }
            string destinationFolder = Path.Combine(_rootDestFolder, _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();
        }