ImgMetadataRemover/ImageCore/Files/LocalSystemFileBrowser.cs

35 lines
1.1 KiB
C#
Raw Normal View History

2022-01-23 17:30:05 +00:00
using System.Collections.Generic;
using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
2022-01-25 20:57:22 +00:00
namespace Image.Files
2022-01-23 17:30:05 +00:00
{
/// <summary>
/// LocalSystemFileBrowser reads files from the provided directory on the local system.
2022-01-23 17:30:05 +00:00
/// </summary>
public class LocalSystemFileBrowser : IFilesBrowser
2022-01-23 17:30:05 +00:00
{
public static ILogger Logger = NullLogger.Instance;
private LocalSystemFileBrowser()
2022-01-23 17:30:05 +00:00
{
}
/// <summary>
/// Give a directory path it returns all the filenames.
/// </summary>
/// <param name="directoryPath">An absolute path pointing to a directory.</param>
/// <returns>A list of file names found in the directory.</returns>
public IEnumerable<string> GetFilenamesFromPath(string directoryPath)
{
Logger.LogInformation($"Getting files from {directoryPath}.");
return Directory.GetFiles(directoryPath, "*.*");
}
public static LocalSystemFileBrowser Create()
2022-01-23 17:30:05 +00:00
{
return new LocalSystemFileBrowser();
2022-01-23 17:30:05 +00:00
}
}
}