* Run code cleanup * Start manual cleanup after dotnet format * Finish up manual pass * Fix up missed warnings * Fix after merge * Update src/Umbraco.Core/Cache/ContentTypeCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/DataTypeCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/DeepCloneAppCache.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/DomainCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MacroCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MediaCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MemberCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MemberGroupCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Composing/OrderedCollectionBuilderBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Composing/SetCollectionBuilderBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Composing/WeightedCollectionBuilderBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/ContentApps/ContentAppFactoryCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Dashboards/DashboardCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentTypeRefreshedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentTypeSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentTypeSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DataTypeCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentUnpublishingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryItemDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryItemSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryItemSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DomainCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/LanguageCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MacroCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaEmptiedRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaEmptyingRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovingToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTreeChangeNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTreeChangeNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeChangedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeRefreshedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeChangedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeDeletedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeRefreshedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/UriExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovingToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovingToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PartialViewDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/UriExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/IO/PhysicalFileSystem.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/IO/PhysicalFileSystem.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/IO/ShadowWrapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Logging/DisposableTimer.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Install/InstallSteps/UpgradeStep.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Mapping/MapDefinitionCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Media/EmbedProviders/EmbedProvidersCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PartialViewSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/ContentEditing/ContentVariationDisplay.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PartialViewSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntryDeletedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntryDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntryDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntrySavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntrySavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntrySavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/StatefulNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/StylesheetDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/StylesheetSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/DeepCloneHelper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/File.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/PropertyGroupExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/PropertyGroupExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Fix based on review * Fix after merge Signed-off-by: Zeegaan <nge@umbraco.dk> Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk> Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> Co-authored-by: Zeegaan <nge@umbraco.dk>
178 lines
6.5 KiB
C#
178 lines
6.5 KiB
C#
namespace Umbraco.Cms.Core.IO;
|
|
|
|
/// <summary>
|
|
/// Provides methods allowing the manipulation of files.
|
|
/// </summary>
|
|
public interface IFileSystem
|
|
{
|
|
/// <summary>
|
|
/// Gets a value indicating whether the filesystem can add/copy
|
|
/// a file which is on a physical filesystem.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// In other words, whether the filesystem can copy/move a file
|
|
/// that is on local disk, in a fast and efficient way.
|
|
/// </remarks>
|
|
bool CanAddPhysical { get; }
|
|
|
|
/// <summary>
|
|
/// Gets all directories matching the given path.
|
|
/// </summary>
|
|
/// <param name="path">The path to the directories.</param>
|
|
/// <returns>
|
|
/// The <see cref="IEnumerable{String}" /> representing the matched directories.
|
|
/// </returns>
|
|
IEnumerable<string> GetDirectories(string path);
|
|
|
|
/// <summary>
|
|
/// Deletes the specified directory.
|
|
/// </summary>
|
|
/// <param name="path">The name of the directory to remove.</param>
|
|
void DeleteDirectory(string path);
|
|
|
|
/// <summary>
|
|
/// Deletes the specified directory and, if indicated, any subdirectories and files in the directory.
|
|
/// </summary>
|
|
/// <remarks>Azure blob storage has no real concept of directories so deletion is always recursive.</remarks>
|
|
/// <param name="path">The name of the directory to remove.</param>
|
|
/// <param name="recursive">Whether to remove directories, subdirectories, and files in path.</param>
|
|
void DeleteDirectory(string path, bool recursive);
|
|
|
|
/// <summary>
|
|
/// Determines whether the specified directory exists.
|
|
/// </summary>
|
|
/// <param name="path">The directory to check.</param>
|
|
/// <returns>
|
|
/// <c>True</c> if the directory exists and the user has permission to view it; otherwise <c>false</c>.
|
|
/// </returns>
|
|
bool DirectoryExists(string path);
|
|
|
|
/// <summary>
|
|
/// Adds a file to the file system.
|
|
/// </summary>
|
|
/// <param name="path">The path to the given file.</param>
|
|
/// <param name="stream">The <see cref="Stream" /> containing the file contents.</param>
|
|
void AddFile(string path, Stream stream);
|
|
|
|
/// <summary>
|
|
/// Adds a file to the file system.
|
|
/// </summary>
|
|
/// <param name="path">The path to the given file.</param>
|
|
/// <param name="stream">The <see cref="Stream" /> containing the file contents.</param>
|
|
/// <param name="overrideIfExists">Whether to override the file if it already exists.</param>
|
|
void AddFile(string path, Stream stream, bool overrideIfExists);
|
|
|
|
/// <summary>
|
|
/// Gets all files matching the given path.
|
|
/// </summary>
|
|
/// <param name="path">The path to the files.</param>
|
|
/// <returns>
|
|
/// The <see cref="IEnumerable{String}" /> representing the matched files.
|
|
/// </returns>
|
|
IEnumerable<string> GetFiles(string path);
|
|
|
|
/// <summary>
|
|
/// Gets all files matching the given path and filter.
|
|
/// </summary>
|
|
/// <param name="path">The path to the files.</param>
|
|
/// <param name="filter">A filter that allows the querying of file extension.
|
|
/// <example>*.jpg</example>
|
|
/// </param>
|
|
/// <returns>
|
|
/// The <see cref="IEnumerable{String}" /> representing the matched files.
|
|
/// </returns>
|
|
IEnumerable<string> GetFiles(string path, string filter);
|
|
|
|
/// <summary>
|
|
/// Gets a <see cref="Stream" /> representing the file at the given path.
|
|
/// </summary>
|
|
/// <param name="path">The path to the file.</param>
|
|
/// <returns>
|
|
/// <see cref="Stream" />.
|
|
/// </returns>
|
|
Stream OpenFile(string path);
|
|
|
|
/// <summary>
|
|
/// Deletes the specified file.
|
|
/// </summary>
|
|
/// <param name="path">The name of the file to remove.</param>
|
|
void DeleteFile(string path);
|
|
|
|
/// <summary>
|
|
/// Determines whether the specified file exists.
|
|
/// </summary>
|
|
/// <param name="path">The file to check.</param>
|
|
/// <returns>
|
|
/// <c>True</c> if the file exists and the user has permission to view it; otherwise <c>false</c>.
|
|
/// </returns>
|
|
bool FileExists(string path);
|
|
|
|
/// <summary>
|
|
/// Returns the application relative path to the file.
|
|
/// </summary>
|
|
/// <param name="fullPathOrUrl">The full path or URL.</param>
|
|
/// <returns>
|
|
/// The <see cref="string" /> representing the relative path.
|
|
/// </returns>
|
|
string GetRelativePath(string fullPathOrUrl);
|
|
|
|
/// <summary>
|
|
/// Gets the full qualified path to the file.
|
|
/// </summary>
|
|
/// <param name="path">The file to return the full path for.</param>
|
|
/// <returns>
|
|
/// The <see cref="string" /> representing the full path.
|
|
/// </returns>
|
|
string GetFullPath(string path);
|
|
|
|
/// <summary>
|
|
/// Returns the application relative URL to the file.
|
|
/// </summary>
|
|
/// <param name="path">The path to return the URL for.</param>
|
|
/// <returns>
|
|
/// <see cref="string" /> representing the relative URL.
|
|
/// </returns>
|
|
string GetUrl(string? path);
|
|
|
|
/// <summary>
|
|
/// Gets the last modified date/time of the file, expressed as a UTC value.
|
|
/// </summary>
|
|
/// <param name="path">The path to the file.</param>
|
|
/// <returns>
|
|
/// <see cref="DateTimeOffset" />.
|
|
/// </returns>
|
|
DateTimeOffset GetLastModified(string path);
|
|
|
|
/// <summary>
|
|
/// Gets the created date/time of the file, expressed as a UTC value.
|
|
/// </summary>
|
|
/// <param name="path">The path to the file.</param>
|
|
/// <returns>
|
|
/// <see cref="DateTimeOffset" />.
|
|
/// </returns>
|
|
DateTimeOffset GetCreated(string path);
|
|
|
|
/// <summary>
|
|
/// Gets the size of a file.
|
|
/// </summary>
|
|
/// <param name="path">The path to the file.</param>
|
|
/// <returns>The size (in bytes) of the file.</returns>
|
|
long GetSize(string path);
|
|
|
|
/// <summary>
|
|
/// Adds a file which is on a physical filesystem.
|
|
/// </summary>
|
|
/// <param name="path">The path to the file.</param>
|
|
/// <param name="physicalPath">The absolute physical path to the source file.</param>
|
|
/// <param name="overrideIfExists">A value indicating what to do if the file already exists.</param>
|
|
/// <param name="copy">A value indicating whether to move (default) or copy.</param>
|
|
void AddFile(string path, string physicalPath, bool overrideIfExists = true, bool copy = false);
|
|
|
|
// TODO: implement these
|
|
//
|
|
// void CreateDirectory(string path);
|
|
//
|
|
//// move or rename, directory or file
|
|
// void Move(string source, string target);
|
|
}
|