using System.Collections.Generic;
using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
namespace Image
{
///
/// LocalSystemFilesRetriever reads files from the provided directory on the local system.
///
public class LocalSystemFilesRetriever : IFilesRetriever
{
public static ILogger Logger = NullLogger.Instance;
private LocalSystemFilesRetriever()
{
}
///
/// 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 LocalSystemFilesRetriever Create()
{
return new LocalSystemFilesRetriever();
}
}
}