public ConfigurationManager(string section) { AgentConfiguration4NetSection ns = (AgentConfiguration4NetSection)System.Configuration.ConfigurationManager.GetSection(section); if (ns == null) { throw new Configuration4NetError("{0} configuration factory section not found", section); } Load(ns); mTimer = new System.Threading.Timer(OnTrackUpdate, null, 10000, 10000); }
private void Load(AgentConfiguration4NetSection section) { if (section != null) { foreach (ManagerSection item in section.ConfigManagers) { string name = item.Name; Type loaderType = Type.GetType(item.LoaderType); if (loaderType == null) { throw new Configuration4NetError("loader type {0} not found", item.LoaderType); } IConfigLoader loader = (IConfigLoader)Activator.CreateInstance(loaderType); loader.AppName = item.AppName; loader.Name = item.Name; mConfigLoaders[name] = loader; SetLoadProperty(loader, item.Properties); Managers[item.Name] = CreateManager(loader); } } }