private void InitializeCaptureFilenames() { string defaultName = "Capture"; string image; string video; if (index == 0) { image = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageFile; video = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoFile; } else { image = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageFile; video = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoFile; } string nextImage = string.IsNullOrEmpty(image) ? defaultName : Filenamer.ComputeNextFilename(image); view.UpdateNextImageFilename(nextImage); string nextVideo = string.IsNullOrEmpty(video) ? defaultName : Filenamer.ComputeNextFilename(video); view.UpdateNextVideoFilename(nextVideo); }
private void StopRecording() { if (!cameraLoaded || !recording || !consumerRecord.Active) { return; } recording = false; consumerRecord.Deactivate(); view.Toast(ScreenManagerLang.Toast_StopRecord, 750); NotificationCenter.RaiseRefreshFileExplorer(this, false); if (recordingThumbnail != null) { AddCapturedFile(consumerRecord.Filename, recordingThumbnail, true); recordingThumbnail.Dispose(); recordingThumbnail = null; } CaptureHistoryEntry entry = CreateHistoryEntry(); CaptureHistory.AddEntry(entry); // We need to use the original filename with patterns still in it. string filenameWithoutExtension = view.CurrentVideoFilename; if (index == 0) { PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoFile = filenameWithoutExtension; } else { PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoFile = filenameWithoutExtension; } PreferencesManager.Save(); string next = Filenamer.ComputeNextFilename(filenameWithoutExtension); view.UpdateNextVideoFilename(next); view.UpdateRecordingStatus(recording); }
private void StartRecording() { if (!cameraLoaded || !cameraConnected || recording) { return; } string root; string subdir; if (index == 0) { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoSubdir; } else { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoSubdir; } string filenameWithoutExtension = view.CurrentVideoFilename; string extension = Filenamer.GetVideoFileExtension(); Dictionary <FilePatternContexts, string> context = BuildCaptureContext(); string path = Filenamer.GetFilePath(root, subdir, filenameWithoutExtension, extension, context); FilesystemHelper.CreateDirectory(path); if (!FilePathSanityCheck(path)) { return; } if (!OverwriteCheck(path)) { return; } if (consumerRecord.Active) { consumerRecord.Deactivate(); } if (recordingThumbnail != null) { recordingThumbnail.Dispose(); recordingThumbnail = null; } double interval = cameraGrabber.Framerate > 0 ? 1000.0 / cameraGrabber.Framerate : 40; SaveResult result = pipelineManager.StartRecord(path, interval); recording = result == SaveResult.Success; if (recording) { recordingStart = DateTime.Now; view.UpdateRecordingStatus(recording); view.Toast(ScreenManagerLang.Toast_StartRecord, 1000); } else { //DisplayError(result); } }
private void MakeSnapshot() { if (!cameraLoaded || consumerDisplay.Bitmap == null) { return; } string root; string subdir; if (index == 0) { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageSubdir; } else { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageSubdir; } string filenameWithoutExtension = view.CurrentImageFilename; string extension = Filenamer.GetImageFileExtension(); Dictionary <FilePatternContexts, string> context = BuildCaptureContext(); string path = Filenamer.GetFilePath(root, subdir, filenameWithoutExtension, extension, context); FilesystemHelper.CreateDirectory(path); if (!FilePathSanityCheck(path)) { return; } if (!OverwriteCheck(path)) { return; } //Actual save. Bitmap outputImage = BitmapHelper.Copy(consumerDisplay.Bitmap); if (outputImage == null) { return; } ImageHelper.Save(path, outputImage); view.Toast(ScreenManagerLang.Toast_ImageSaved, 750); // After save routines. NotificationCenter.RaiseRefreshFileExplorer(this, false); AddCapturedFile(path, outputImage, false); CaptureHistoryEntry entry = CreateHistoryEntrySnapshot(path); CaptureHistory.AddEntry(entry); if (index == 0) { PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageFile = filenameWithoutExtension; } else { PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageFile = filenameWithoutExtension; } PreferencesManager.Save(); // Compute next name for user feedback. string next = Filenamer.ComputeNextFilename(filenameWithoutExtension); view.UpdateNextImageFilename(next); }