diff --git a/src/Umbraco.Core/IO/IFileSystemExtensions.cs b/src/Umbraco.Core/IO/FileSystemExtensions.cs similarity index 57% rename from src/Umbraco.Core/IO/IFileSystemExtensions.cs rename to src/Umbraco.Core/IO/FileSystemExtensions.cs index 516049a146..fdf3a7dd0a 100644 --- a/src/Umbraco.Core/IO/IFileSystemExtensions.cs +++ b/src/Umbraco.Core/IO/FileSystemExtensions.cs @@ -2,11 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.IO { - public static class IFileSystemExtensions + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] + public static class FileSystemExtensions { + [UmbracoExperimentalFeature("", "Will be declared public after 4.10")] internal static long GetSize(this IFileSystem fs, string path) { var s = fs.OpenFile(path); @@ -16,6 +19,7 @@ namespace Umbraco.Core.IO return size; } + [UmbracoExperimentalFeature("", "Will be declared public after 4.10")] internal static void CopyFile(this IFileSystem fs, string path, string newPath) { fs.AddFile(newPath, fs.OpenFile(path)); diff --git a/src/Umbraco.Core/IO/FileSystemProvider.cs b/src/Umbraco.Core/IO/FileSystemProvider.cs index 31f767f28e..1f6013078f 100644 --- a/src/Umbraco.Core/IO/FileSystemProvider.cs +++ b/src/Umbraco.Core/IO/FileSystemProvider.cs @@ -2,9 +2,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.IO { + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] internal class FileSystemProvider { public const string Media = "media"; diff --git a/src/Umbraco.Core/IO/FileSystemProviderAttribute.cs b/src/Umbraco.Core/IO/FileSystemProviderAttribute.cs index 4d09bc4f1e..39bb8db8dc 100644 --- a/src/Umbraco.Core/IO/FileSystemProviderAttribute.cs +++ b/src/Umbraco.Core/IO/FileSystemProviderAttribute.cs @@ -2,9 +2,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.IO { + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] internal class FileSystemProviderAttribute : Attribute { diff --git a/src/Umbraco.Core/IO/FileSystemProviderManager.cs b/src/Umbraco.Core/IO/FileSystemProviderManager.cs index 99d9eb5833..5654e764d6 100644 --- a/src/Umbraco.Core/IO/FileSystemProviderManager.cs +++ b/src/Umbraco.Core/IO/FileSystemProviderManager.cs @@ -5,10 +5,12 @@ using System.Configuration; using System.Linq; using System.Reflection; using System.Text; +using Umbraco.Core.CodeAnnotations; using Umbraco.Core.Configuration; namespace Umbraco.Core.IO { + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] internal class FileSystemProviderManager { private readonly FileSystemProvidersSection _config; diff --git a/src/Umbraco.Core/IO/FileSystemWrapper.cs b/src/Umbraco.Core/IO/FileSystemWrapper.cs index f0fcff213d..236a79a380 100644 --- a/src/Umbraco.Core/IO/FileSystemWrapper.cs +++ b/src/Umbraco.Core/IO/FileSystemWrapper.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.IO { @@ -14,6 +15,7 @@ namespace Umbraco.Core.IO /// /// This abstract class just wraps the 'real' IFileSystem object passed in to its constructor. /// + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] internal abstract class FileSystemWrapper : IFileSystem { private readonly IFileSystem _wrapped; diff --git a/src/Umbraco.Core/IO/IFileSystem.cs b/src/Umbraco.Core/IO/IFileSystem.cs index 2c11d290d0..d0e7490890 100644 --- a/src/Umbraco.Core/IO/IFileSystem.cs +++ b/src/Umbraco.Core/IO/IFileSystem.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; using System.IO; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.IO { + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] internal interface IFileSystem { IEnumerable GetDirectories(string path); diff --git a/src/Umbraco.Core/IO/MediaFileSystem.cs b/src/Umbraco.Core/IO/MediaFileSystem.cs index 3c8b3429b6..0193f7480a 100644 --- a/src/Umbraco.Core/IO/MediaFileSystem.cs +++ b/src/Umbraco.Core/IO/MediaFileSystem.cs @@ -1,5 +1,9 @@ -using System.Linq; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Text; +using Umbraco.Core.CodeAnnotations; +using Umbraco.Core.Configuration; namespace Umbraco.Core.IO { @@ -7,11 +11,47 @@ namespace Umbraco.Core.IO /// A custom file system provider for media /// [FileSystemProvider("media")] + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] internal class MediaFileSystem : FileSystemWrapper { public MediaFileSystem(IFileSystem wrapped) : base(wrapped) { } + + public string GetRelativePath(int propertyId, string fileName) + { + var seperator = UmbracoSettings.UploadAllowDirectories + ? Path.DirectorySeparatorChar + : '-'; + + return propertyId.ToString() + seperator + fileName; + } + + public IEnumerable GetThumbnails(string path) + { + var parentDirectory = System.IO.Path.GetDirectoryName(path); + var extension = System.IO.Path.GetExtension(path); + + return GetFiles(parentDirectory) + .Where(x => x.StartsWith(path.TrimEnd(extension) + "_thumb")) + .ToList(); + } + + public void DeleteFile(string path, bool deleteThumbnails) + { + DeleteFile(path); + + if (!deleteThumbnails) + return; + + DeleteThumbnails(path); + } + + public void DeleteThumbnails(string path) + { + GetThumbnails(path) + .ForEach(DeleteFile); + } } } diff --git a/src/Umbraco.Core/IO/MediaFileSystemExtensions.cs b/src/Umbraco.Core/IO/MediaFileSystemExtensions.cs deleted file mode 100644 index 3fb79fff4e..0000000000 --- a/src/Umbraco.Core/IO/MediaFileSystemExtensions.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using Umbraco.Core.Configuration; - -namespace Umbraco.Core.IO -{ - public static class MediaFileSystemExtensions - { - internal static string GetRelativePath(this MediaFileSystem fs, int propertyId, string fileName) - { - var seperator = UmbracoSettings.UploadAllowDirectories - ? Path.DirectorySeparatorChar - : '-'; - - return propertyId.ToString() + seperator + fileName; - } - - internal static IEnumerable GetThumbnails(this MediaFileSystem fs, string path) - { - var parentDirectory = System.IO.Path.GetDirectoryName(path); - var extension = System.IO.Path.GetExtension(path); - - return fs.GetFiles(parentDirectory) - .Where(x => x.StartsWith(path.TrimEnd(extension) + "_thumb")) - .ToList(); - } - - internal static void DeleteFile(this MediaFileSystem fs, string path, bool deleteThumbnails) - { - fs.DeleteFile(path); - - if(!deleteThumbnails) - return; - - fs.DeleteThumbnails(path); - } - - internal static void DeleteThumbnails(this MediaFileSystem fs, string path) - { - fs.GetThumbnails(path) - .ForEach(fs.DeleteFile); - } - } -} diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index 4c7dd42f5e..a53b5b1784 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -4,9 +4,12 @@ using System.IO; using System.Linq; using System.Text; using System.Web; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.IO { + + [UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")] internal class PhysicalFileSystem : IFileSystem { private readonly string _rootPath; diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index f9f56a3c81..d44959f632 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -81,7 +81,7 @@ - + @@ -144,7 +144,6 @@ -