Skip to content

Commit b8f91c3

Browse files
committed
Moving virtual path provider into core package
1 parent 7b14a50 commit b8f91c3

File tree

4 files changed

+7
-46
lines changed

4 files changed

+7
-46
lines changed

src/UmbracoFileSystemProviders.Azure.Media/AzureMediaFileSystemComponent.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
// </copyright>
55
namespace Our.Umbraco.FileSystemProviders.Azure
66
{
7+
using System;
78
using global:: Umbraco.Core.Composing;
89
using global::Umbraco.Core.IO;
910

1011
public class AzureMediaFileSystemComponent : IComponent
1112
{
12-
1313
private readonly SupportingFileSystems supportingFileSystems;
1414
private readonly AzureBlobFileSystemConfig config;
1515

@@ -22,19 +22,14 @@ public AzureMediaFileSystemComponent(SupportingFileSystems supportingFileSystems
2222
public void Initialize()
2323
{
2424
var azureFs = this.supportingFileSystems.For<IMediaFileSystem>() as AzureBlobFileSystem;
25+
2526
if (!this.config.DisableVirtualPathProvider && azureFs != null)
2627
{
2728
AzureFileSystem azureFileSystem = azureFs.FileSystem;
2829

29-
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
30-
if (azureFileSystem.UseDefaultRoute)
31-
{
32-
FileSystemVirtualPathProvider.ConfigureMedia(Constants.DefaultMediaRoute);
33-
}
34-
else
35-
{
36-
FileSystemVirtualPathProvider.ConfigureMedia(azureFileSystem.ContainerName);
37-
}
30+
var route = azureFileSystem.UseDefaultRoute ? Constants.DefaultMediaRoute : azureFileSystem.ContainerName;
31+
32+
FileSystemVirtualPathProvider.Configure(route, new Lazy<IFileSystem>(() => azureFileSystem));
3833
}
3934
}
4035

src/UmbracoFileSystemProviders.Azure.Media/FileSystemVirtualFile.cs renamed to src/UmbracoFileSystemProviders.Azure/FileSystemVirtualFile.cs

File renamed without changes.

src/UmbracoFileSystemProviders.Azure.Media/FileSystemVirtualPathProvider.cs renamed to src/UmbracoFileSystemProviders.Azure/FileSystemVirtualPathProvider.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
namespace Our.Umbraco.FileSystemProviders.Azure
77
{
88
using System;
9-
using System.Diagnostics.CodeAnalysis;
109
using System.Reflection;
1110
using System.Web;
1211
using System.Web.Compilation;
1312
using System.Web.Hosting;
14-
using global::Umbraco.Core.Composing;
1513
using global::Umbraco.Core.IO;
1614

1715
/// <summary>
@@ -115,40 +113,6 @@ public static void Configure(string pathPrefix, Lazy<IFileSystem> fileSystem)
115113
}
116114
}
117115

118-
/// <summary>
119-
/// Configures the virtual path provider.
120-
/// </summary>
121-
/// <param name="pathPrefix">
122-
/// The path prefix.
123-
/// </param>
124-
/// <exception cref="ArgumentNullException">
125-
/// Thrown if <paramref name="pathPrefix"/> is null.
126-
/// </exception>
127-
[Obsolete("Use ConfigureMedia to set the media path, or pass a provider to set the path for any file system")]
128-
public static void Configure(string pathPrefix = Constants.DefaultMediaRoute)
129-
{
130-
ConfigureMedia(pathPrefix);
131-
}
132-
133-
/// <summary>
134-
/// Configures the virtual path provider for media.
135-
/// </summary>
136-
/// <param name="pathPrefix">
137-
/// The path prefix.
138-
/// </param>
139-
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1126:PrefixCallsCorrectly", Justification = "Resharper seems drunk.")]
140-
public static void ConfigureMedia(string pathPrefix = Constants.DefaultMediaRoute)
141-
{
142-
if (string.IsNullOrEmpty(pathPrefix))
143-
{
144-
throw new ArgumentNullException(nameof(pathPrefix));
145-
}
146-
147-
Lazy<IFileSystem> fileSystem = new Lazy<IFileSystem>(() => Current.MediaFileSystem.Unwrap());
148-
149-
Configure(pathPrefix, fileSystem);
150-
}
151-
152116
/// <summary>
153117
/// Gets a value that indicates whether a file exists in the virtual file system.
154118
/// </summary>

src/UmbracoFileSystemProviders.Azure/UmbracoFileSystemProviders.Azure.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@
305305
<Compile Include="AzureBlobFileSystemConfig.cs" />
306306
<Compile Include="AzureFileSystem.cs" />
307307
<Compile Include="Constants.cs" />
308+
<Compile Include="FileSystemVirtualFile.cs" />
309+
<Compile Include="FileSystemVirtualPathProvider.cs" />
308310
<Compile Include="Helpers\ConfigurationHelper.cs" />
309311
<Compile Include="Helpers\IMimeTypeResolver.cs" />
310312
<Compile Include="Helpers\MimeTypeResolver.cs" />

0 commit comments

Comments
 (0)