public static Metadata Load(string configurationFileLocation) { var configuration = XDocument.Load(configurationFileLocation); var metaData = new Metadata { Title = GetField(configuration, "Title", String.Empty), WebsiteUrl = GetField(configuration, "WebsiteUrl", String.Empty), DefaultDescription = GetField(configuration, "DefaultDescription", String.Empty), DefaultKeywords = GetField(configuration, "DefaultKeywords", String.Empty), FileStorageConnectionString = GetField(configuration, "FileStorageConnectionString", String.Empty), FileStorageUrl = GetField(configuration, "FileStorageUrl", String.Empty), FacebookLogo = GetField(configuration, "FacebookLogo", String.Empty), FacebookApplicationId = GetField(configuration, "FacebookApplicationId", String.Empty), FacebookApplicationSecret = GetField(configuration, "FacebookApplicationSecret", String.Empty), SmtpHost = GetField(configuration, "SmtpHost", String.Empty), MailFrom = GetField(configuration, "MailFrom", String.Empty), SmtpUserName = GetField(configuration, "SmtpUserName", String.Empty), SmtpPassword = GetField(configuration, "SmtpPassword", String.Empty), SmtpPort = GetField(configuration, "SmtpPort", 25) }; return metaData; }
public static Metadata Load(string configurationFileLocation) { try { var configuration = XDocument.Load(configurationFileLocation); var instance = new Metadata { Title = GetField(configuration, "Title", String.Empty), WebsiteUrl = GetField(configuration, "WebsiteUrl", String.Empty), DefaultDescription = GetField(configuration, "DefaultDescription", String.Empty), DefaultKeywords = GetField(configuration, "DefaultKeywords", String.Empty), FileStorageConnectionString = GetField(configuration, "FileStorageConnectionString", String.Empty), FileStorageUrl = GetField(configuration, "FileStorageUrl", String.Empty), BlobContainerName = GetField(configuration, "BlobContainerName", String.Empty), FacebookLogo = GetField(configuration, "FacebookLogo", String.Empty), FacebookApplicationId = GetField(configuration, "FacebookApplicationId", String.Empty), FacebookApplicationSecret = GetField(configuration, "FacebookApplicationSecret", String.Empty), SmtpHost = GetField(configuration, "SmtpHost", String.Empty), MailFrom = GetField(configuration, "MailFrom", String.Empty), SmtpUserName = GetField(configuration, "SmtpUserName", String.Empty), SmtpPassword = GetField(configuration, "SmtpPassword", String.Empty), SupportEmail = GetField(configuration, "SupportEmail", String.Empty), SmtpPort = GetField(configuration, "SmtpPort", 25), PageSize = GetField(configuration, "PageSize", 15) }; return instance; } catch { return null; } }
public static void Initialize(Metadata metadata) { _current = metadata; }