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);
            }
        }
Exemplo n.º 2
0
 private void saveSceneThumbInfo(Slide slide, SceneThumbInfo thumbInfo)
 {
     try
     {
         using (Stream stream = slideEditController.ResourceProvider.openWriteStream(slide.SceneThumbInfoName))
         {
             SharedXmlSaver.Save(thumbInfo, stream);
         }
         saveThumbnail(slide.SceneThumbName, thumbInfo.SceneThumb);
     }
     catch (Exception ex)
     {
         Logging.Log.Error("{0} exception updating thumbnail info. Message: {1}", ex.GetType().Name, ex.Message);
     }
 }
 void save_MouseButtonClick(Widget source, EventArgs e)
 {
     if (recordingSequence != null)
     {
         FileSaveDialog saveDialog = new FileSaveDialog(MainWindow.Instance, message: "Save Recorded Sequence", wildcard: "Movement Sequence (*.seq)|*.seq");
         saveDialog.showModal((result, path) =>
         {
             if (result == NativeDialogResult.OK)
             {
                 using (Stream stream = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
                 {
                     SharedXmlSaver.Save(recordingSequence, stream);
                 }
             }
         });
     }
 }