private static void AddExtensionSchemas(XmlSchemaSet schemas, ExtensionsLoader loader)
        {
            if (schemas == null)
            {
                schemas = new XmlSchemaSet();
            }

            var validationExceptions = new List <Exception>();

            foreach (var xsdFile in loader.SchemaFileNames)
            {
                using (var reader = XmlReader.Create(xsdFile, new XmlReaderSettings()
                {
                    CloseInput = true
                }))
                {
                    var schema = XmlSchema.Read(reader, (s, a) => validationExceptions.Add(a.Exception));
                    if (schema.TargetNamespace != Constants.Namespace)
                    {
                        schemas.Add(schema);
                    }
                }
            }

            if (validationExceptions.Count > 0)
            {
                throw new ConfigurationException(validationExceptions);
            }
        }
        internal ConfigurationReader(string file)
        {
            var fileInfo = FileUtil.ProcessFileNameForLogging(file);

            this.File   = fileInfo.FullName;
            this.loader = ExtensionsLoader.GetOrCreateInstance(fileInfo.DirectoryName);
            FormatterElementFactory.FormatterElements = this.loader.FormatterElements;
        }
        internal static ExtensionsLoader GetOrCreateInstance(string probingPath)
        {
            ExtensionsLoader loader;

            if (!Instances.TryGetValue(probingPath, out loader))
            {
                loader = new ExtensionsLoader(probingPath);
                Instances.Add(probingPath, loader);
            }

            return(loader);
        }