public void cleanup() { //Cleanup slide trash CleanupInfo cleanupInfo = new CleanupInfo(); slideshow.cleanup(cleanupInfo, ResourceProvider); undoBuffer.clear(); //Can't really recover from this one, so just erase all undo List <Guid> cleanupSlides = new List <Guid>(projectGuidDirectories()); foreach (Slide slide in slideshow.Slides) { Guid guid; if (Guid.TryParse(slide.UniqueName, out guid)) { cleanupSlides.Remove(guid); } foreach (String file in ResourceProvider.listFiles("*", slide.UniqueName, true)) { if (!cleanupInfo.isClaimed(file)) { try { editorController.ResourceProvider.delete(file); } catch (Exception ex) { Logging.Log.Error("Cleanup -- Failed to delete file '{0}'. Reason: {1}", file, ex.Message); } } } } foreach (Guid dir in cleanupSlides) { try { editorController.ResourceProvider.delete(dir.ToString("D")); } catch (Exception ex) { Logging.Log.Error("Cleanup -- Failed to delete directory '{0}'. Reason: {1}", dir, ex.Message); } } PropFactory propFactory = standaloneController.PropFactory; DDAtlasPlugin plugin; using (Stream pluginFileStream = editorController.ResourceProvider.openFile("Plugin.ddp")) { plugin = SharedXmlSaver.Load <DDAtlasPlugin>(pluginFileStream); } plugin.setDependencyIds(cleanupInfo.getObjects <String>(ShowPropAction.PropClass) .Select(n => propFactory.getDependencyIdForProp(n)) .Where(id => id.HasValue) .Select(id => id.Value)); using (Stream pluginFileStream = editorController.ResourceProvider.openWriteStream("Plugin.ddp")) { SharedXmlSaver.Save(plugin, pluginFileStream); } }