Moved filesytem abstractions + removed resharper warnings
This commit is contained in:
@@ -1,178 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides methods allowing the manipulation of files.
|
||||
/// </summary>
|
||||
public interface IFileSystem
|
||||
{
|
||||
/// <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>
|
||||
/// 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>
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace Umbraco.Core.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the system filesystems.
|
||||
/// </summary>
|
||||
public interface IFileSystems
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the macro partials filesystem.
|
||||
/// </summary>
|
||||
IFileSystem MacroPartialsFileSystem { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the partial views filesystem.
|
||||
/// </summary>
|
||||
IFileSystem PartialViewsFileSystem { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stylesheets filesystem.
|
||||
/// </summary>
|
||||
IFileSystem StylesheetsFileSystem { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scripts filesystem.
|
||||
/// </summary>
|
||||
IFileSystem ScriptsFileSystem { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MVC views filesystem.
|
||||
/// </summary>
|
||||
IFileSystem MvcViewsFileSystem { get; }
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,9 @@
|
||||
<Compile Include="Composing\TargetedServiceFactory.cs" />
|
||||
<Compile Include="Composing\TypeFinder.cs" />
|
||||
<Compile Include="Composing\TypeLoader.cs" />
|
||||
<Compile Include="IO\IMediaFileSystem.cs" />
|
||||
<Compile Include="IO\IMediaPathScheme.cs" />
|
||||
<Compile Include="IO\IOHelper.cs" />
|
||||
<Compile Include="IO\MediaPathSchemes\UniqueMediaPathScheme.cs" />
|
||||
<Compile Include="Logging\Viewer\LogTimePeriod.cs" />
|
||||
<Compile Include="Manifest\IManifestFilter.cs" />
|
||||
@@ -339,6 +342,7 @@
|
||||
<Compile Include="Services\Changes\TreeChange.cs" />
|
||||
<Compile Include="Services\Changes\TreeChangeExtensions.cs" />
|
||||
<Compile Include="Services\IDataTypeService.cs" />
|
||||
<Compile Include="Services\IEntityService.cs" />
|
||||
<Compile Include="Services\IFileService.cs" />
|
||||
<Compile Include="Services\ILocalizationService.cs" />
|
||||
<Compile Include="Services\IMacroService.cs" />
|
||||
@@ -408,11 +412,8 @@
|
||||
<Compile Include="Deploy\IDataTypeConfigurationConnector.cs" />
|
||||
<Compile Include="Events\CancellableObjectEventArgsOfTEventObject.cs" />
|
||||
<Compile Include="Events\RolesEventArgs.cs" />
|
||||
<Compile Include="IO\IFileSystems.cs" />
|
||||
<Compile Include="IO\IMediaFileSystem.cs" />
|
||||
<Compile Include="GuidUtils.cs" />
|
||||
<Compile Include="IO\MediaPathSchemes\CombinedGuidsMediaPathScheme.cs" />
|
||||
<Compile Include="IO\IMediaPathScheme.cs" />
|
||||
<Compile Include="IO\MediaPathSchemes\OriginalMediaPathScheme.cs" />
|
||||
<Compile Include="IO\MediaPathSchemes\TwoGuidsMediaPathScheme.cs" />
|
||||
<Compile Include="IO\SupportingFileSystems.cs" />
|
||||
@@ -594,8 +595,6 @@
|
||||
<Compile Include="IO\FileSystemExtensions.cs" />
|
||||
<Compile Include="IO\FileSystems.cs" />
|
||||
<Compile Include="IO\FileSystemWrapper.cs" />
|
||||
<Compile Include="IO\IFileSystem.cs" />
|
||||
<Compile Include="IO\IOHelper.cs" />
|
||||
<Compile Include="IO\MediaFileSystem.cs" />
|
||||
<Compile Include="IO\PhysicalFileSystem.cs" />
|
||||
<Compile Include="IO\ShadowFileSystem.cs" />
|
||||
@@ -1160,7 +1159,6 @@
|
||||
<Compile Include="Services\IContentTypeService.cs" />
|
||||
<Compile Include="Services\IContentTypeServiceBase.cs" />
|
||||
<Compile Include="Services\IdkMap.cs" />
|
||||
<Compile Include="Services\IEntityService.cs" />
|
||||
<Compile Include="Services\IExternalLoginService.cs" />
|
||||
<Compile Include="Services\IMediaService.cs" />
|
||||
<Compile Include="Services\IMediaTypeService.cs" />
|
||||
|
||||
Reference in New Issue
Block a user