@@ -35,22 +35,19 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer
3535 [ PluginController ( "FileSystemProviders" ) ]
3636 public class InstallerController : UmbracoAuthorizedApiController
3737 {
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 ) ;
4140
42- private static readonly string ImageProcessorConfigPath = HostingEnvironment . MapPath ( "~/Config/imageprocessor/" ) ;
41+ private static readonly string ImageProcessorConfigPath = HostingEnvironment . MapPath ( Constants . ImageProcessor . ConfigPath ) ;
4342
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") ;
4946
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 } ") ;
5249
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") ;
5451
5552 // /Umbraco/backoffice/FileSystemProviders/Installer/GetParameters
5653 public IEnumerable < Parameter > GetParameters ( )
@@ -122,7 +119,7 @@ internal static bool SaveParametersToFileSystemProvidersXdt(string xdtPath, IEnu
122119 var strNamespace = "http://schemas.microsoft.com/XML-Document-Transform" ;
123120 nsMgr . AddNamespace ( "xdt" , strNamespace ) ;
124121
125- var providerElement = document . SelectSingleNode ( string . Format ( "//Provider[@type = '{0 }']" , ProviderType ) ) ;
122+ var providerElement = document . SelectSingleNode ( $ "//Provider[@type = '{ Constants . ProviderType } ']") ;
126123 var parametersElement = providerElement . SelectSingleNode ( "./Parameters" ) ;
127124 var parameterRemoveElement = document . CreateNode ( "element" , "Parameters" , null ) ;
128125 var tranformAttr = document . CreateAttribute ( "Transform" , strNamespace ) ;
@@ -131,7 +128,7 @@ internal static bool SaveParametersToFileSystemProvidersXdt(string xdtPath, IEnu
131128 parameterRemoveElement . Attributes . Append ( tranformAttr ) ;
132129 providerElement . InsertBefore ( parameterRemoveElement , parametersElement ) ;
133130
134- var parameters = document . SelectNodes ( string . Format ( "//Provider[@type = '{0 }']/Parameters/add" , ProviderType ) ) ;
131+ var parameters = document . SelectNodes ( $ "//Provider[@type = '{ Constants . ProviderType } ']/Parameters/add") ;
135132
136133 if ( parameters == null )
137134 {
@@ -213,7 +210,7 @@ internal static bool SaveBlobPathToImageProcessorSecurityXdt(string xdtPath, str
213210 var document = XmlHelper . OpenAsXmlDocument ( xdtPath ) ;
214211
215212 // 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 } ']") ;
217214 if ( rawServices == null )
218215 {
219216 return false ;
@@ -225,7 +222,7 @@ internal static bool SaveBlobPathToImageProcessorSecurityXdt(string xdtPath, str
225222 }
226223
227224 // 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") ;
229226 if ( rawSettings == null )
230227 {
231228 return false ;
@@ -280,7 +277,7 @@ internal static IEnumerable<Parameter> GetParametersFromXml(string xmlPath)
280277
281278 var document = XmlHelper . OpenAsXmlDocument ( xmlPath ) ;
282279
283- var parameters = document . SelectNodes ( string . Format ( "//Provider[@type = '{0 }']/Parameters/add" , ProviderType ) ) ;
280+ var parameters = document . SelectNodes ( $ "//Provider[@type = '{ Constants . ProviderType } ']/Parameters/add") ;
284281
285282 if ( parameters == null )
286283 {
@@ -363,7 +360,7 @@ private static bool TestAzureCredentials(string connectionString, string contain
363360 }
364361 catch ( Exception e )
365362 {
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 ) ;
367364 return false ;
368365 }
369366
0 commit comments