public static void FileOrDirectorySwitch(this IFileSystemOperator fileSystemOperator, string path, Action fileAction, Action directoryAction) { var pathIsFile = fileSystemOperator.ExistsFile(path); if (pathIsFile) { fileAction(); } else { directoryAction(); } }
public static T FileOrDirectorySwitch <T>(this IFileSystemOperator fileSystemOperator, string path, Func <T> fileFunction, Func <T> directoryFunction) { var pathIsFile = fileSystemOperator.ExistsFile(path); if (pathIsFile) { var output = fileFunction(); return(output); } else { var output = directoryFunction(); return(output); } }
public static bool IsFile(this IFileSystemOperator fileSystemOperator, string path) { var output = fileSystemOperator.ExistsFile(path); return(output); }