private void AddIncludes(ICFG_Source cfgsource) { foreach (IConfig config in Config.Configs) { foreach (string key in config.GetKeys()) { if (key.StartsWith("Include")) { AddSource(cfgsource, config.GetString(key)); config.Remove(key); } } } }
private void AddSource(ICFG_Source cfgsource, string file) { Uri configUri; if (Uri.TryCreate(file, UriKind.Absolute, out configUri)) { m_Sources.Enqueue(new CFG_NiniXmlUriSource(file)); } else { m_Sources.Enqueue(new CFG_IniFileSource(Path.Combine(cfgsource.DirName, file))); } }
private void ProcessConfigurations(bool processParameterMap = true) { IConfig importedInfo = Config.Configs["ImportedConfigs"] ?? Config.AddConfig("ImportedConfigs"); while (m_Sources.Count != 0) { ICFG_Source source = m_Sources.Dequeue(); try { #if DEBUG System.Console.WriteLine("Processing config \"{0}\"", source.Name); #endif importedInfo.Set("Imported-" + source.Name, true); Config.Merge(source.ConfigSource); } catch (Exception e) { string eInfo = string.Format(source.Message, source.Name); System.Console.Write(eInfo); System.Console.WriteLine(); throw new ConfigurationErrorException(eInfo, e); } LoadGridsXml(); ProcessUseSourceParameter(); AddIncludes(source); ProcessImportResources(); if (processParameterMap) { ProcessParameterMap(); ProcessDefaultValues(); } ProcessResourceMap(); } LoadGridsXml(); if (processParameterMap) { ProcessParameterMap(); ProcessDefaultValues(); } ProcessUseTemplates(); bool res = ProcessParameterMapTemplates(); if (res && processParameterMap) { ProcessParameterMap(); ProcessDefaultValues(); } }