예제 #1
0
        /// <summary>
        /// Ask for a filename and then save the metadata to this filename.
        /// </summary>
        public void UserSaveAs(Metadata metadata, string videoFile)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Title = ScreenManagerLang.dlgSaveAnalysisTitle;

            // Go to this video directory and suggest sidecar filename.
            saveFileDialog.InitialDirectory = Path.GetDirectoryName(videoFile);
            saveFileDialog.FileName         = Path.GetFileNameWithoutExtension(videoFile);
            saveFileDialog.Filter           = FilesystemHelper.SaveKVAFilter();
            saveFileDialog.FilterIndex      = 1;

            if (saveFileDialog.ShowDialog() != DialogResult.OK || string.IsNullOrEmpty(saveFileDialog.FileName))
            {
                return;
            }

            string filename = saveFileDialog.FileName;

            if (!filename.ToLower().EndsWith(".kva") && !filename.ToLower().EndsWith(".xml"))
            {
                filename += ".kva";
            }

            SaveToFile(metadata, filename);
            metadata.LastKVAPath = filename;
            metadata.AfterManualExport();
        }
예제 #2
0
 /// <summary>
 /// Save to the last known storage location of this KVA if any, otherwise ask for a target filename.
 /// </summary>
 public void UserSave(Metadata metadata, string videoFile)
 {
     if (string.IsNullOrEmpty(metadata.LastKVAPath))
     {
         UserSaveAs(metadata, videoFile);
     }
     else
     {
         SaveToFile(metadata, metadata.LastKVAPath);
         metadata.AfterManualExport();
     }
 }
예제 #3
0
        /// <summary>
        /// Main video saving pipeline. Saves either a video or the analysis data.
        /// </summary>
        public void Save(double playbackFrameInterval, double slowmotionPercentage, ImageRetriever imageRetriever)
        {
            // Let the user select what he wants to save exactly.
            formVideoExport fve = new formVideoExport(videoReader.FilePath, metadata, slowmotionPercentage);

            if (fve.ShowDialog() != DialogResult.OK)
            {
                fve.Dispose();
                return;
            }

            if (!FilesystemHelper.CanWrite(fve.Filename))
            {
                DisplayErrorMessage(ScreenManagerLang.Error_SaveMovie_FileError);
                fve.Dispose();
                return;
            }

            if (fve.SaveAnalysis)
            {
                MetadataSerializer serializer = new MetadataSerializer();
                serializer.SaveToFile(metadata, fve.Filename);
                metadata.AfterManualExport();
            }
            else
            {
                DoSave(fve.Filename,
                       fve.UseSlowMotion ? playbackFrameInterval : metadata.UserInterval,
                       fve.BlendDrawings,
                       false,
                       false,
                       imageRetriever);

                PreferencesManager.PlayerPreferences.VideoFormat = FilesystemHelper.GetVideoFormat(fve.Filename);
                PreferencesManager.Save();
            }

            fve.Dispose();
        }