using System.IO;
namespace AggregateConfigBuildTask
{
///
/// Interface for a file system abstraction, allowing various implementations to handle file operations.
///
internal interface IFileSystem
{
///
/// Retrieves the file paths that match a specified search pattern in a specified directory.
///
/// The directory to search for files.
/// The search pattern (e.g., "*.txt") to filter the files.
/// An array of file paths that match the specified search pattern.
string[] GetFiles(string path, string searchPattern);
///
/// Reads all lines from the specified file.
///
/// The path of the file to read.
/// A string containing all the lines from the file.
string[] ReadAllLines(string path);
///
/// Reads all text from the specified file.
///
/// The path of the file to read.
/// A string containing all the text from the file.
string ReadAllText(string path);
///
/// Writes the specified text to the specified file, overwriting the file if it already exists.
///
/// The path of the file to write to.
/// The text to write to the file.
void WriteAllText(string path, string text);
///
/// Checks if the specified file exists at the given path.
///
/// The full path of the file to check for existence.
///
/// true if the file exists; otherwise, false.
///
bool FileExists(string path);
///
/// Checks whether the specified directory exists in the virtual file system.
///
/// The full path of the directory to check.
///
/// true if the directory exists (i.e., if any files are present in that directory);
/// otherwise, false.
///
///
/// The method checks for the existence of the directory by verifying if any file paths
/// in the virtual file system start with the specified directory path.
///
bool DirectoryExists(string directoryPath);
///
/// Creates a directory at the specified path in the file system.
///
/// The full path of the directory to create.
///
/// If the directory already exists, no action is taken. If any part of the directory path does not exist,
/// all necessary subdirectories are created. Throws an exception if the directory cannot be created.
///
void CreateDirectory(string directoryPath);
///
/// Opens a text file for reading and returns a TextReader.
///
/// The file path to open for reading.
/// A TextReader for reading the file content.
TextReader OpenText(string path);
///
/// Opens a file at the specified path for reading.
///
/// The path of the file to be opened.
///
/// A that represents the file opened for reading.
///
///
/// The returned provides read-only access to the file.
/// Ensure that the file exists and the application has appropriate read permissions.
///
Stream OpenRead(string inputPath);
}
}