From 54b57f7d51e7c4e78d7f4e552d393cb533a408f6 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 15 Apr 2017 17:21:48 +1000 Subject: [PATCH] Document the IFileSystem interface --- src/Umbraco.Core/IO/IFileSystem.cs | 111 ++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/IO/IFileSystem.cs b/src/Umbraco.Core/IO/IFileSystem.cs index 3b38432c5c..a5a935ebb5 100644 --- a/src/Umbraco.Core/IO/IFileSystem.cs +++ b/src/Umbraco.Core/IO/IFileSystem.cs @@ -7,39 +7,144 @@ namespace Umbraco.Core.IO //TODO: There is no way to create a directory here without creating a file in a directory and then deleting it //TODO: Should probably implement a rename? - public interface IFileSystem + /// + /// Provides methods allowing the manipulation of files within an Umbraco application. + /// + public interface IFileSystem { + /// + /// Gets all directories matching the given path. + /// + /// The path to the directories. + /// + /// The representing the matched directories. + /// IEnumerable GetDirectories(string path); + /// + /// Deletes the specified directory. + /// + /// The name of the directory to remove. void DeleteDirectory(string path); + /// + /// Deletes the specified directory and, if indicated, any subdirectories and files in the directory. + /// + /// Azure blob storage has no real concept of directories so deletion is always recursive. + /// The name of the directory to remove. + /// Whether to remove directories, subdirectories, and files in path. void DeleteDirectory(string path, bool recursive); + /// + /// Determines whether the specified directory exists. + /// + /// The directory to check. + /// + /// True if the directory exists and the user has permission to view it; otherwise false. + /// bool DirectoryExists(string path); - + + /// + /// Adds a file to the file system. + /// + /// The path to the given file. + /// The containing the file contents. void AddFile(string path, Stream stream); + /// + /// Adds a file to the file system. + /// + /// The path to the given file. + /// The containing the file contents. + /// Whether to override the file if it already exists. void AddFile(string path, Stream stream, bool overrideIfExists); + /// + /// Gets all files matching the given path. + /// + /// The path to the files. + /// + /// The representing the matched files. + /// IEnumerable GetFiles(string path); + /// + /// Gets all files matching the given path and filter. + /// + /// The path to the files. + /// A filter that allows the querying of file extension. *.jpg + /// + /// The representing the matched files. + /// IEnumerable GetFiles(string path, string filter); + /// + /// Gets a representing the file at the gieven path. + /// + /// The path to the file. + /// + /// . + /// Stream OpenFile(string path); + /// + /// Deletes the specified file. + /// + /// The name of the file to remove. void DeleteFile(string path); + /// + /// Determines whether the specified file exists. + /// + /// The file to check. + /// + /// True if the file exists and the user has permission to view it; otherwise false. + /// bool FileExists(string path); - + /// + /// Returns the application relative path to the file. + /// + /// The full path or url. + /// + /// The representing the relative path. + /// string GetRelativePath(string fullPathOrUrl); + /// + /// Gets the full qualified path to the file. + /// + /// The file to return the full path for. + /// + /// The representing the full path. + /// string GetFullPath(string path); + /// + /// Returns the application relative url to the file. + /// + /// The path to return the url for. + /// + /// representing the relative url. + /// string GetUrl(string path); + /// + /// Gets the last modified date/time of the file, expressed as a UTC value. + /// + /// The path to the file. + /// + /// . + /// DateTimeOffset GetLastModified(string path); + /// + /// Gets the created date/time of the file, expressed as a UTC value. + /// + /// The path to the file. + /// + /// . + /// DateTimeOffset GetCreated(string path); } }