Replaces more calls to legacy UmbracoSettings with the new configuration section, fixes loads of null checks when dealing with package repository APIs

This commit is contained in:
Shannon
2013-09-16 11:22:11 +10:00
parent 7538698e7b
commit 046dcdcaf7
19 changed files with 255 additions and 148 deletions

View File

@@ -6,5 +6,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
string Name { get; }
Guid Id { get; }
string RepositoryUrl { get; }
string WebServiceUrl { get; }
bool HasCustomWebServiceUrl { get; }
}
}

View File

@@ -5,19 +5,42 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class RepositoryElement : ConfigurationElement, IRepository
{
[ConfigurationProperty("name")]
[ConfigurationProperty("name", IsRequired = true)]
public string Name
{
get { return (string)base["name"]; }
set { base["name"] = value; }
}
[ConfigurationProperty("guid")]
[ConfigurationProperty("guid", IsRequired = true)]
public Guid Id
{
get { return (Guid)base["guid"]; }
set { base["guid"] = value; }
}
[ConfigurationProperty("repositoryurl", DefaultValue = "http://packages.umbraco.org")]
public string RepositoryUrl
{
get { return (string)base["repositoryurl"]; }
set { base["repositoryurl"] = value; }
}
[ConfigurationProperty("repositoryurl", DefaultValue = "/umbraco/webservices/api/repository.asmx")]
public string WebServiceUrl
{
get { return (string)base["repositoryurl"]; }
set { base["repositoryurl"] = value; }
}
public bool HasCustomWebServiceUrl
{
get
{
var prop = Properties["repositoryurl"];
var repoUrl = this[prop] as ConfigurationElement;
return (repoUrl != null && repoUrl.ElementInformation.IsPresent);
}
}
}
}