private void InitOutputEnumeration() { Logger.Verbose("Initializing Output directory enumeration"); if (outputFolderEnumeration != null) { outputFolderEnumeration.FileRemoved -= OutputFolderEnumeration_FileRemoved; outputFolderEnumeration.FolderRemoved -= OutputFolderEnumeration_FolderRemoved; outputFolderEnumeration.FileRenamed -= WarnPathRename; outputFolderEnumeration.FolderRenamed -= WarnPathRename; } if (!Directory.Exists(Settings.OutputDir)) { outputFolderEnumeration = null; Logger.Warning("Could not find output file directory {OutputDir}", Settings.OutputDir); return; } outputFolderEnumeration = new FolderEnumeration(AppSettings.Main.OutputDir); outputFolderEnumeration.Filter = ".jpg|.jpeg|.png|.mp4|.gif|.webm|.avi|.mov|.wmv"; outputFolderEnumeration.FileRemoved += OutputFolderEnumeration_FileRemoved; outputFolderEnumeration.FolderRemoved += OutputFolderEnumeration_FolderRemoved; outputFolderEnumeration.FileRenamed += WarnPathRename; outputFolderEnumeration.FolderRenamed += WarnPathRename; int numFiles = outputFolderEnumeration.FilePaths.Count(); Logger.Verbose("Finished initializing output directory, found {NumFiles} files", numFiles); }
private void InitInputEnumeration() { Logger.Verbose("Initializing Input directory enumeration"); if (inputFolderEnumeration != null) { inputFolderEnumeration.FileAdded -= InputFolderEnumeration_FileAdded; inputFolderEnumeration.FolderAdded -= InputFolderEnumeration_FolderAdded; inputFolderEnumeration.FileRenamed -= WarnPathRename; inputFolderEnumeration.FolderRenamed -= WarnPathRename; } if (!Directory.Exists(Settings.InputDir)) { inputFolderEnumeration = null; Logger.Warning("Could not find input file directory {InputDir}", Settings.InputDir); return; } Logger.Verbose("Built-in supported extensions: {SupportedExtensions}", SupportedFilesFilter); Logger.Verbose("User-defined ignored extensions: {IgnoredExtensions}", Settings.IgnoredFilesFilter); string[] supportedFiles = SupportedFilesFilter.Split('|'); string[] ignoredFiles = Settings.IgnoredFilesFilter.Split('|'); ignoredFiles = ignoredFiles.Select(ext => ext.ToLower().Trim()).ToArray(); string[] enabledFiles = (from ext in supportedFiles where !ignoredFiles.Any(ign => ign.ToLower().Trim('.') == ext.ToLower().Trim('.')) select ext.StartsWith(".") ? ext : "." + ext).ToArray(); string enabledFilesFilter = string.Join("|", enabledFiles); Logger.Verbose("Using search filter {SearchFilter}", enabledFilesFilter); inputFolderEnumeration = new FolderEnumeration(AppSettings.Main.InputDir); inputFolderEnumeration.Filter = enabledFilesFilter; inputFolderEnumeration.FileAdded += InputFolderEnumeration_FileAdded; inputFolderEnumeration.FileRemoved += InputFolderEnumeration_FileRemoved; inputFolderEnumeration.FolderAdded += InputFolderEnumeration_FolderAdded; inputFolderEnumeration.FileRenamed += WarnPathRename; inputFolderEnumeration.FolderRenamed += WarnPathRename; int numFiles = inputFolderEnumeration.FilePaths.Count(); Logger.Verbose("Finished initializing input directory, found {NumFiles} files", numFiles); }