public void AttemptMissingImageReplacements(string pathToFolderOfReplacementImages=null)
{
using (var dlg = new ProgressDialogBackground())
{
dlg.ShowAndDoWork((progress, args) => DoChecksOfAllBooksBackgroundWork(dlg, pathToFolderOfReplacementImages));
if (dlg.Progress.ErrorEncountered || dlg.Progress.WarningsEncountered)
{
MessageBox.Show("There were some problems. Bloom will now open a log of the attempt to replace missing images.");
}
else
{
MessageBox.Show("There are no more missing images. Bloom will now open a log of what it did.");
}
var path = Path.GetTempFileName() + ".txt";
RobustFile.WriteAllText(path, dlg.ProgressString.Text);
try
{
PathUtilities.OpenFileInApplication(path);
}
catch (System.OutOfMemoryException)
{
// This has happened at least once. See https://silbloom.myjetbrains.com/youtrack/issue/BL-3431.
MessageBox.Show("Bloom ran out of memory trying to open the log. You should quit and restart the program. (Your books should all be okay.)");
}
}
}