//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.Configuration { using System.Configuration; /// /// Represents the <xriResolver> element in the host's .config file. /// internal class XriResolverElement : ConfigurationElement { /// /// Gets the name of the @enabled attribute. /// private const string EnabledAttributeName = "enabled"; /// /// The default value for . /// private const bool EnabledDefaultValue = true; /// /// The name of the <proxy> sub-element. /// private const string ProxyElementName = "proxy"; /// /// The default XRI proxy resolver to use. /// private static readonly HostNameElement ProxyDefault = new HostNameElement("xri.net"); /// /// Initializes a new instance of the class. /// internal XriResolverElement() { } /// /// Gets or sets a value indicating whether this XRI resolution is enabled. /// /// The default value is true. [ConfigurationProperty(EnabledAttributeName, DefaultValue = EnabledDefaultValue)] internal bool Enabled { get { return (bool)this[EnabledAttributeName]; } set { this[EnabledAttributeName] = value; } } /// /// Gets or sets the proxy to use for resolving XRIs. /// /// The default value is "xri.net". [ConfigurationProperty(ProxyElementName)] internal HostNameElement Proxy { get { var host = (HostNameElement)this[ProxyElementName] ?? ProxyDefault; return string.IsNullOrEmpty(host.Name.Trim()) ? ProxyDefault : host; } set { this[ProxyElementName] = value; } } } }