public VideoRecordingResult SaveVideo(string saveLocation, string testName) { var result = new VideoRecordingResult(); try { StopCapture(); } catch (Exception e) { result.SavedException = e; result.IsSuccessfullySaved = false; } if (Directory.Exists(saveLocation)) { var moveToPath = GenerateFinalFilePath(saveLocation, testName); File.Move(_screenCaptureJob.OutputScreenCaptureFileName, moveToPath); } else { result.SavedException = new ArgumentException("The specified save location does not exists."); result.IsSuccessfullySaved = false; } return(result); }
public VideoRecordingResult StartCapture() { var result = new VideoRecordingResult(); try { Initialize(); _screenCaptureJob.Start(); } catch (Exception ex) { var argumentExceptionMessage = string.Format("Video capturing failed with the following exception:{0}. Resolution: width - {1}, height - {2}. ", ex.Message, _height, _width); result.SavedException = new ArgumentException(argumentExceptionMessage); result.IsSuccessfullySaved = false; } return(result); }