コード例 #1
0
        private IReadOnlyDictionary <string, string> LoadContentTypesByExtension()
        {
            var filesConfiguration = this.Settings.Resolve <Configuration.FilesConfiguration>();

            if (filesConfiguration == null)
            {
                throw new LogicConfigurationException(
                          this.ConfigurationSectionName,
                          "No FilesConfiguration is defined.");
            }

            if (String.IsNullOrWhiteSpace(filesConfiguration.ContentTypeAssociationsXamlPath))
            {
                throw new LogicConfigurationException(
                          this.ConfigurationSectionName,
                          "The ContentTypeAssociationsXamlPath property of FilesConfiguration is not specified.");
            }

            var contentTypeAssociations =
                XamlConfiguration <Configuration.ContentTypeAssociations> .LoadSettings(
                    filesConfiguration.ContentTypeAssociationsXamlPath);

            return(contentTypeAssociations.ToDictionary(
                       a => a.FileExtension.Trim().ToLower(),
                       a => a.MIMEType.Trim()));
        }
 /// <summary>
 /// Load the <see cref="Configuration.PermissionsSetup"/> from the
 /// XAML file specified in the constructor.
 /// </summary>
 public PermissionsSetup Load()
 {
     return(XamlConfiguration <PermissionsSetup> .LoadSettings(xamlFilename));
 }