public void Configure(Configuration config) { Configure(new List<Configuration>(new Configuration[] { config })); }
public void Configure() { if (Scintilla.IsDesignMode || Scintilla.IsInitializing) return; Configuration builtInDefault = null, builtInLang = null, customDefault = null, customLang = null, userDefault = null, userLang = null; if (_isBuiltInEnabled) { using(Stream s = GetType().Assembly.GetManifestResourceStream("ScintillaNET.Configuration.Builtin.default.xml")) builtInDefault = new Configuration(s, "default", _useXmlReader); if (!string.IsNullOrEmpty(_language)) using (Stream s = GetType().Assembly.GetManifestResourceStream("ScintillaNET.Configuration.Builtin." + _language + ".xml")) if (s != null) builtInLang = new Configuration(s, _language, _useXmlReader); } if (_isUserEnabled) { string defPath = Path.Combine(UserFolder, "default.xml"); if (File.Exists(defPath)) userDefault = new Configuration(defPath, "default", _useXmlReader); if (!string.IsNullOrEmpty(_language)) { string langPath = Path.Combine(UserFolder, _language + ".xml"); if (File.Exists(langPath)) userLang = new Configuration(langPath, _language, _useXmlReader); } } if (!string.IsNullOrEmpty(_customLocation)) { string customDefaultPath = GetCustomConfigPath("default"); string customLanguagePath = GetCustomConfigPath(_language); if (!string.IsNullOrEmpty(customDefaultPath)) customDefault = new Configuration(customDefaultPath, "default", _useXmlReader); if (!string.IsNullOrEmpty(customLanguagePath)) customLang = new Configuration(customLanguagePath, _language, _useXmlReader); else throw new FileNotFoundException("Could not find the custom configuration file.", _customLocation); } List<Configuration> configList = new List<Configuration>(); if (_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 (_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 (_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 (_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 (_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 (_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); }