private void onLoaded(IIdentifiedSource settings) { var copy = Loaded; if (copy != null) { copy(this, new LoadedEventArgs(settings)); } }
public SettingsLoader LoadSettings(IIdentifiedSource setting) { if (CheckLoaded(setting)) return this; _settings.Add(setting); OnLoaded(setting); IncludeSettings(setting); return this; }
public Result LoadSettings(IIdentifiedSource setting, IDeserializer deserializer, string searchPath = null) { if (searchPath == null) { var rpo = setting as IFilePathOwner; if (rpo != null) { searchPath = rpo.Path; } } var context = new Context(deserializer, searchPath); context.Sources.Add(setting); onLoaded(setting); context.CheckLoaded(setting); return(new Result( new DefaultConfigNodeProvider(scanInclude(setting, context)), context.Sources.AsReadOnly())); }
public Result LoadSettings(IIdentifiedSource setting, string searchPath) { return(LoadSettings(setting, DefaultDeserializer.Instance, searchPath)); }
public Result LoadSettings(IIdentifiedSource setting) { return(LoadSettings(setting, DefaultDeserializer.Instance)); }
public bool CheckLoaded(IIdentifiedSource settings) { var key = new IdentityKey(settings.GetType(), settings.Identity); return(!_loaded.Add(key)); }
public LoadedEventArgs(IIdentifiedSource settings) { Settings = settings; }
private void IncludeSettings(IIdentifiedSource source) { var includeRoot = source.TryFirst<ICfgNode>("Include", false); if(includeRoot == null) return; foreach (var incNode in includeRoot.GetNodes()) { if (NameComparer.Equals(incNode.Key, "FinalSearch")) continue; ISettingsFactory factory; if(!_tagMap.TryGetValue(incNode.Key, out factory)) throw new InvalidOperationException(string.Format("unknown include type '{0}'", incNode.Key)); foreach (var incSetting in factory.CreateSettings(source, incNode.Value)) LoadSettings(incSetting); } }
private bool CheckLoaded(IIdentifiedSource settings) { var key = new IdentityKey(settings.GetType(), settings.Identity); return !_loaded.Add(key); }
private void OnLoaded(IIdentifiedSource settings) { var copy = Loaded; if (copy != null) copy(this, new LoadedEventArgs(settings)); }