private static IEnumerable<string> GetDirectoriesForType(string path, string pattern, ReadTypes type)
{
if (type == ReadTypes.Files)
{
if (string.IsNullOrEmpty(pattern))
{
return Directory.EnumerateFiles(path);
}
return Directory.EnumerateFiles(path, pattern);
}
if (type == ReadTypes.Folders)
{
if (string.IsNullOrEmpty(pattern))
{
return Directory.EnumerateDirectories(path);
}
return Directory.EnumerateDirectories(path, pattern);
}
if (string.IsNullOrEmpty(pattern))
{
return Directory.EnumerateFileSystemEntries(path);
}
return Directory.EnumerateFileSystemEntries(path, pattern);
}