public WebSource(XElement xml)
: base(xml)
{
ResourceType = ResourceType.WebSource;
AuthenticationType = AuthenticationType.Anonymous;
var properties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "Address", string.Empty },
{ "DefaultQuery", string.Empty },
{ "AuthenticationType", string.Empty },
{ "UserName", string.Empty },
{ "Password", string.Empty }
};
var conString = xml.AttributeSafe("ConnectionString");
var connectionString = conString.CanBeDecrypted() ? DpapiWrapper.Decrypt(conString) : conString;
ParseProperties(connectionString, properties);
Address = properties["Address"];
DefaultQuery = properties["DefaultQuery"];
UserName = properties["UserName"];
Password = properties["Password"];
AuthenticationType authType;
AuthenticationType = Enum.TryParse(properties["AuthenticationType"], true, out authType) ? authType : AuthenticationType.Windows;
}