private IEnumerable<IRenderingJob> CreateRenderingJobs(FileSystemInfo inputPath, IBatchRenderingOptions inputOutputInfo, RenderingMode? mode) { IEnumerable<IRenderingJob> output; if(inputPath != null && (inputPath is FileInfo)) { output = new [] { CreateRenderingJob((FileInfo) inputPath, mode, inputPath.GetParentDirectory()) }; } else if(inputPath != null && (inputPath is DirectoryInfo)) { var dir = (DirectoryInfo) inputPath; output = (from file in dir.GetFiles(inputOutputInfo.InputSearchPattern, SearchOption.AllDirectories) where !inputOutputInfo.IgnoredPaths.Any(x => file.IsChildOf(x)) select CreateRenderingJob(file, mode, dir)); } else { output = new IRenderingJob[0]; } return output; }
/// <summary> /// Determines if the directory directly contains the other directory or file. /// </summary> public static bool ContainsDirectly(this DirectoryInfo dir, FileSystemInfo other) { if (dir == null) throw new ArgumentNullException("dir"); if (other == null) throw new ArgumentNullException("other"); return dir.AreSame(other.GetParentDirectory()); }