public void Configure(Configuration config)
 {
     this.Configure(new List<Configuration>(new[] { config }));
 }
        public void Configure()
        {
            if (Scintilla.IsDesignMode || Scintilla.IsInitializing)
                return;

            Configuration builtInDefault = null,
                builtInLang = null,
                customDefault = null,
                customLang = null,
                userDefault = null,
                userLang = null;

            if (this._isBuiltInEnabled)
            {
                using (Stream s = GetType().Assembly.GetManifestResourceStream("ARCed.Scintilla.Configuration.Builtin.default.xml"))
                    builtInDefault = new Configuration(s, "default", this._useXmlReader);
                if (!string.IsNullOrEmpty(this._language))
                    using (Stream s = GetType().Assembly.GetManifestResourceStream("ARCed.Scintilla.Configuration.Builtin." + this._language + ".xml"))
                        if (s != null)
                            builtInLang = new Configuration(s, this._language, this._useXmlReader);
            }

            if (this._isUserEnabled)
            {
                string defPath = Path.Combine(this.UserFolder, "default.xml");
                if (File.Exists(defPath))
                    userDefault = new Configuration(defPath, "default", this._useXmlReader);

                if (!string.IsNullOrEmpty(this._language))
                {
                    string langPath = Path.Combine(this.UserFolder, this._language + ".xml");
                    if (File.Exists(langPath))
                        userLang = new Configuration(langPath, this._language, this._useXmlReader);
                }
            }

            if (!string.IsNullOrEmpty(this._customLocation))
            {
                string customDefaultPath = this.GetCustomConfigPath("default");
                string customLanguagePath = this.GetCustomConfigPath(this._language);

                if (!string.IsNullOrEmpty(customDefaultPath))
                    customDefault = new Configuration(customDefaultPath, "default", this._useXmlReader);

                if (!string.IsNullOrEmpty(customLanguagePath))
                    customLang = new Configuration(customLanguagePath, this._language, this._useXmlReader);
                else
                    throw new FileNotFoundException("Could not find the custom configuration file.", this._customLocation);
            }

            var configList = new List<Configuration>();
            if (this._loadOrder == ConfigurationLoadOrder.BuiltInCustomUser)
            {
                if (builtInDefault != null && builtInDefault.HasData)
                    configList.Add(builtInDefault);

                if (builtInLang != null && builtInLang.HasData)
                    configList.Add(builtInLang);

                if (customDefault != null && customDefault.HasData)
                    configList.Add(customDefault);

                if (customLang != null && customLang.HasData)
                    configList.Add(customLang);

                if (userDefault != null && userDefault.HasData)
                    configList.Add(userDefault);

                if (userLang != null && userLang.HasData)
                    configList.Add(userLang);
            }
            else if (this._loadOrder == ConfigurationLoadOrder.BuiltInUserCustom)
            {
                if (builtInDefault != null && builtInDefault.HasData)
                    configList.Add(builtInDefault);

                if (builtInLang != null && builtInLang.HasData)
                    configList.Add(builtInLang);

                if (userDefault != null && userDefault.HasData)
                    configList.Add(userDefault);

                if (userLang != null && userLang.HasData)
                    configList.Add(userLang);

                if (customDefault != null && customDefault.HasData)
                    configList.Add(customDefault);

                if (customLang != null && customLang.HasData)
                    configList.Add(customLang);
            }
            else if (this._loadOrder == ConfigurationLoadOrder.CustomBuiltInUser)
            {
                if (customDefault != null && customDefault.HasData)
                    configList.Add(customDefault);

                if (customLang != null && customLang.HasData)
                    configList.Add(customLang);

                if (builtInDefault != null && builtInDefault.HasData)
                    configList.Add(builtInDefault);

                if (builtInLang != null && builtInLang.HasData)
                    configList.Add(builtInLang);

                if (userDefault != null && userDefault.HasData)
                    configList.Add(userDefault);

                if (userLang != null && userLang.HasData)
                    configList.Add(userLang);
            }
            else if (this._loadOrder == ConfigurationLoadOrder.CustomUserBuiltIn)
            {
                if (customDefault != null && customDefault.HasData)
                    configList.Add(customDefault);

                if (customLang != null && customLang.HasData)
                    configList.Add(customLang);

                if (userDefault != null && userDefault.HasData)
                    configList.Add(userDefault);

                if (userLang != null && userLang.HasData)
                    configList.Add(userLang);

                if (builtInDefault != null && builtInDefault.HasData)
                    configList.Add(builtInDefault);

                if (builtInLang != null && builtInLang.HasData)
                    configList.Add(builtInLang);
            }
            else if (this._loadOrder == ConfigurationLoadOrder.UserBuiltInCustom)
            {
                if (userDefault != null && userDefault.HasData)
                    configList.Add(userDefault);

                if (userLang != null && userLang.HasData)
                    configList.Add(userLang);

                if (builtInDefault != null && builtInDefault.HasData)
                    configList.Add(builtInDefault);

                if (builtInLang != null && builtInLang.HasData)
                    configList.Add(builtInLang);

                if (customDefault != null && customDefault.HasData)
                    configList.Add(customDefault);

                if (customLang != null && customLang.HasData)
                    configList.Add(customLang);

            }
            else if (this._loadOrder == ConfigurationLoadOrder.UserCustomBuiltIn)
            {
                if (userDefault != null && userDefault.HasData)
                    configList.Add(userDefault);

                if (userLang != null && userLang.HasData)
                    configList.Add(userLang);

                if (customDefault != null && customDefault.HasData)
                    configList.Add(customDefault);

                if (customLang != null && customLang.HasData)
                    configList.Add(customLang);

                if (builtInDefault != null && builtInDefault.HasData)
                    configList.Add(builtInDefault);

                if (builtInLang != null && builtInLang.HasData)
                    configList.Add(builtInLang);
            }

            Configure(configList);
        }