Esempio n. 1
0
        private List <string> GetPluginTypesDirectiveList(ICspPluginTypesDirectiveConfiguration directive)
        {
            if (directive == null || !directive.Enabled || !directive.MediaTypes.Any())
            {
                return(null);
            }

            //We know there are MediaTypes, so not null.
            return(new List <string>(directive.MediaTypes));
        }
Esempio n. 2
0
        public ICspPluginTypesDirectiveConfiguration GetOverridenCspPluginTypesConfig(CspPluginTypesOverride directiveOverride,
                                                                                      ICspPluginTypesDirectiveConfiguration directiveConfig)
        {
            var result = directiveConfig ?? new CspPluginTypesDirectiveConfiguration();

            result.Enabled = directiveOverride.Enabled;


            if (!directiveOverride.InheritMediaTypes)
            {
                result.MediaTypes = EmptySources;
            }

            if (directiveOverride.MediaTypes != null && directiveOverride.MediaTypes.Length > 0)
            {
                var newSources = new List <string>(result.MediaTypes);
                newSources.AddRange(directiveOverride.MediaTypes);
                result.MediaTypes = newSources.Distinct();
            }


            return(result);
        }
Esempio n. 3
0
        private List<string> GetPluginTypesDirectiveList(ICspPluginTypesDirectiveConfiguration directive)
        {
            if (directive == null || !directive.Enabled || !directive.MediaTypes.Any())
                return null;

            //We know there are MediaTypes, so not null.
            return new List<string>(directive.MediaTypes);
        }
        public ICspPluginTypesDirectiveConfiguration GetOverridenCspPluginTypesConfig(CspPluginTypesOverride directiveOverride,
            ICspPluginTypesDirectiveConfiguration directiveConfig)
        {
            var result = directiveConfig ?? new CspPluginTypesDirectiveConfiguration();

            result.Enabled = directiveOverride.Enabled;

            
            if (!directiveOverride.InheritMediaTypes)
            {
                result.MediaTypes = EmptySources;
            }

            if (directiveOverride.MediaTypes != null && directiveOverride.MediaTypes.Length > 0)
            {
                var newSources = new List<string>(result.MediaTypes);
                newSources.AddRange(directiveOverride.MediaTypes);
                result.MediaTypes = newSources.Distinct();
            }


            return result;
        }