/// <summary> /// FileConverter contains all the data for the /// videos to be converted in a particular directory /// as well as interfaces with ffmpeg /// </summary> /// <param name="dirPath">Path to the directory where the /// files are locateed</param> /// <param name="outputLogRelayer">Output logger to log messages /// to the UI</param> public FileConverter(string dirPath, OutputTextRelayer outputLogRelayer = null) { fileSorter = new FileSorter(dirPath); ffmpegDriver = new FFMPEGDriver(dirPath, outputLogRelayer); this.outputLogRelayer = outputLogRelayer; convertVideoThread = null; }
/// <summary> /// Will read files out of directory and /// fill out the VideoData object with /// start datetime and file info. /// </summary> /// <param name="dirPath">Path to directory, leave blank to use /// the directory passed in through constructor</param> /// <returns>True if files were found with the extension</returns> public bool AnalyzeDirectory(string dirPath = "") { bool bSuccess = false; if (convertVideoThread == null) { if (!String.IsNullOrEmpty(dirPath)) { fileSorter = new FileSorter(dirPath); } else { SendOutputToRelayer("Directory path error has occurred"); } List <string> files = fileSorter.FindAndSort(fileExt); if (files.Count > 0) { videoData = new VideoData(); videoData.FilesInDirectory = files; // Since the files are sorted, we should be able // to get the date from just the first file. videoData.StartDateTime = DetermineStartTime(files[0]); videoData.TestName += "Baseline"; videoData.GenerateStandardOutputName(); SendOutputToRelayer("Directory " + dirPath + " and files added."); bSuccess = true; } else { SendOutputToRelayer("No files were found in directory " + dirPath); } } else { SendOutputToRelayer("Can not analyze directory while running conversion"); } return(bSuccess); }