private void ProcessAsDirectory(string sourcePath, string optionName, OptionsParser.ResultType resultType) { if (!Directory.Exists(sourcePath)) { throw new ArgumentException(string.Format("{0} directory `{1}` cannot be found", optionName, sourcePath)); } var fileNames = GetAllFileNames(sourcePath).ToArray(); if (!fileNames.Any()) { throw new ArgumentException(string.Format("{0} directory `{1}` doesn't contain any {2} files.", optionName, sourcePath, FileType)); } switch (resultType) { case OptionsParser.ResultType.Test: ResultDirectoryPaths.Add(sourcePath); break; case OptionsParser.ResultType.Baseline: foreach (var filename in fileNames) { BaselineFilePaths.Add(filename); } break; default: throw new InvalidEnumArgumentException(resultType.ToString()); } }
private void ProcessAsFile(string sourcePath, string optionName, OptionsParser.ResultType resultType) { if (!File.Exists(sourcePath)) { throw new ArgumentException(string.Format("{0} file `{1}` cannot be found", optionName, sourcePath)); } switch (resultType) { case OptionsParser.ResultType.Test: ResultFilePaths.Add(sourcePath); break; case OptionsParser.ResultType.Baseline: BaselineFilePaths.Add(sourcePath); break; default: throw new InvalidEnumArgumentException(resultType.ToString()); } }