@@ -35,22 +35,19 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer
35
35
[ PluginController ( "FileSystemProviders" ) ]
36
36
public class InstallerController : UmbracoAuthorizedApiController
37
37
{
38
- private const string ProviderType = "Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure" ;
39
- private static readonly string ImageProcessorWebAssemblyPath = HostingEnvironment . MapPath ( "~/bin/ImageProcessor.Web.dll" ) ;
40
- private static readonly Version ImageProcessorWebMinRequiredVersion = new Version ( "4.3.2.0" ) ;
38
+ private static readonly string ImageProcessorWebAssemblyPath = HostingEnvironment . MapPath ( Constants . ImageProcessor . WebAssemblyPath ) ;
39
+ private static readonly Version ImageProcessorWebMinRequiredVersion = new Version ( Constants . ImageProcessor . WebMinRequiredVersion ) ;
41
40
42
- private static readonly string ImageProcessorConfigPath = HostingEnvironment . MapPath ( "~/Config/imageprocessor/" ) ;
41
+ private static readonly string ImageProcessorConfigPath = HostingEnvironment . MapPath ( Constants . ImageProcessor . ConfigPath ) ;
43
42
44
- private static readonly string ImageProcessorSecurityConfigPath = HostingEnvironment . MapPath ( "~/Config/imageprocessor/security.config" ) ;
45
- private static readonly string ImageProcessorSecurityDefaultConfigPath = HostingEnvironment . MapPath ( "~/App_Plugins/UmbracoFileSystemProviders/Azure/Install/security.config" ) ;
46
- private static readonly string ImageProcessorSecurityInstallXdtPath = HostingEnvironment . MapPath ( "~/App_Plugins/UmbracoFileSystemProviders/Azure/Install/security.config.install.xdt" ) ;
47
- private static readonly string ImageProcessorSecurityServiceType = "ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web" ;
48
- private static readonly string ImageProcessorSecurityServiceName = "CloudImageService" ;
43
+ private static readonly string ImageProcessorSecurityConfigPath = HostingEnvironment . MapPath ( $ "{ Constants . ImageProcessor . ConfigPath } { Constants . ImageProcessor . SecurityConfigFile } ") ;
44
+ private static readonly string ImageProcessorSecurityDefaultConfigPath = HostingEnvironment . MapPath ( $ "{ Constants . InstallerPath } { Constants . ImageProcessor . SecurityConfigFile } ") ;
45
+ private static readonly string ImageProcessorSecurityInstallXdtPath = HostingEnvironment . MapPath ( $ "{ Constants . InstallerPath } { Constants . ImageProcessor . SecurityConfigFile } .install.xdt") ;
49
46
50
- private readonly string fileSystemProvidersConfigInstallXdtPath = HostingEnvironment . MapPath ( "~/App_Plugins/UmbracoFileSystemProviders/Azure/Install/FileSystemProviders.config .install.xdt") ;
51
- private readonly string fileSystemProvidersConfigPath = HostingEnvironment . MapPath ( "~/Config/FileSystemProviders.config ") ;
47
+ private readonly string fileSystemProvidersConfigInstallXdtPath = HostingEnvironment . MapPath ( $ " { Constants . InstallerPath } { Constants . FileSystemProvidersConfigFile } .install.xdt") ;
48
+ private readonly string fileSystemProvidersConfigPath = HostingEnvironment . MapPath ( $ " { Constants . UmbracoConfigPath } { Constants . FileSystemProvidersConfigFile } ") ;
52
49
53
- private readonly string webConfigXdtPath = HostingEnvironment . MapPath ( "~/App_Plugins/UmbracoFileSystemProviders/Azure/Install/web.config .install.xdt") ;
50
+ private readonly string webConfigXdtPath = HostingEnvironment . MapPath ( $ " { Constants . InstallerPath } { Constants . WebConfigFile } .install.xdt") ;
54
51
55
52
// /Umbraco/backoffice/FileSystemProviders/Installer/GetParameters
56
53
public IEnumerable < Parameter > GetParameters ( )
@@ -122,7 +119,7 @@ internal static bool SaveParametersToFileSystemProvidersXdt(string xdtPath, IEnu
122
119
var strNamespace = "http://schemas.microsoft.com/XML-Document-Transform" ;
123
120
nsMgr . AddNamespace ( "xdt" , strNamespace ) ;
124
121
125
- var providerElement = document . SelectSingleNode ( string . Format ( "//Provider[@type = '{0 }']" , ProviderType ) ) ;
122
+ var providerElement = document . SelectSingleNode ( $ "//Provider[@type = '{ Constants . ProviderType } ']") ;
126
123
var parametersElement = providerElement . SelectSingleNode ( "./Parameters" ) ;
127
124
var parameterRemoveElement = document . CreateNode ( "element" , "Parameters" , null ) ;
128
125
var tranformAttr = document . CreateAttribute ( "Transform" , strNamespace ) ;
@@ -131,7 +128,7 @@ internal static bool SaveParametersToFileSystemProvidersXdt(string xdtPath, IEnu
131
128
parameterRemoveElement . Attributes . Append ( tranformAttr ) ;
132
129
providerElement . InsertBefore ( parameterRemoveElement , parametersElement ) ;
133
130
134
- var parameters = document . SelectNodes ( string . Format ( "//Provider[@type = '{0 }']/Parameters/add" , ProviderType ) ) ;
131
+ var parameters = document . SelectNodes ( $ "//Provider[@type = '{ Constants . ProviderType } ']/Parameters/add") ;
135
132
136
133
if ( parameters == null )
137
134
{
@@ -213,7 +210,7 @@ internal static bool SaveBlobPathToImageProcessorSecurityXdt(string xdtPath, str
213
210
var document = XmlHelper . OpenAsXmlDocument ( xdtPath ) ;
214
211
215
212
// Set the prefix attribute on both the Remove and InsertIfMissing actions
216
- var rawServices = document . SelectNodes ( $ "//services/service[@name = '{ ImageProcessorSecurityServiceName } ' and @type = '{ ImageProcessorSecurityServiceType } ']") ;
213
+ var rawServices = document . SelectNodes ( $ "//services/service[@name = '{ Constants . ImageProcessor . SecurityServiceName } ' and @type = '{ Constants . ImageProcessor . SecurityServiceType } ']") ;
217
214
if ( rawServices == null )
218
215
{
219
216
return false ;
@@ -225,7 +222,7 @@ internal static bool SaveBlobPathToImageProcessorSecurityXdt(string xdtPath, str
225
222
}
226
223
227
224
// Set the settings within the InsertIfMissing action
228
- var rawSettings = document . SelectNodes ( $ "//services/service[@prefix = '{ prefix } /' and @name = '{ ImageProcessorSecurityServiceName } ' and @type = '{ ImageProcessorSecurityServiceType } ']/settings/setting") ;
225
+ var rawSettings = document . SelectNodes ( $ "//services/service[@prefix = '{ prefix } /' and @name = '{ Constants . ImageProcessor . SecurityServiceName } ' and @type = '{ Constants . ImageProcessor . SecurityServiceType } ']/settings/setting") ;
229
226
if ( rawSettings == null )
230
227
{
231
228
return false ;
@@ -280,7 +277,7 @@ internal static IEnumerable<Parameter> GetParametersFromXml(string xmlPath)
280
277
281
278
var document = XmlHelper . OpenAsXmlDocument ( xmlPath ) ;
282
279
283
- var parameters = document . SelectNodes ( string . Format ( "//Provider[@type = '{0 }']/Parameters/add" , ProviderType ) ) ;
280
+ var parameters = document . SelectNodes ( $ "//Provider[@type = '{ Constants . ProviderType } ']/Parameters/add") ;
284
281
285
282
if ( parameters == null )
286
283
{
@@ -363,7 +360,7 @@ private static bool TestAzureCredentials(string connectionString, string contain
363
360
}
364
361
catch ( Exception e )
365
362
{
366
- LogHelper . Error < InstallerController > ( string . Format ( "Error validating Azure storage connection: {0}" , e . Message ) , e ) ;
363
+ LogHelper . Error < InstallerController > ( $ "Error validating Azure storage connection: { e . Message } " , e ) ;
367
364
return false ;
368
365
}
369
366
0 commit comments