using System.Collections.Generic;
using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
namespace ConsoleInterface
{
///
/// LocalFileBrowser reads files from the provided directory on the local system.
///
public class LocalFileBrowser : IFileBrowser
{
public static ILogger Logger = NullLogger.Instance;
private LocalFileBrowser()
{
}
///
/// Give a directory path it returns all the filenames.
///
/// An absolute path pointing to a directory.
/// A list of file names found in the directory.
public IEnumerable GetFilenamesFromPath(string directoryPath)
{
Logger.LogInformation($"Getting files from {directoryPath}.");
return Directory.GetFiles(directoryPath, "*.*");
}
public static LocalFileBrowser Create()
{
return new LocalFileBrowser();
}
}
}