public RuntimeSettings(MExConfiguration config, string agentGroup, FactoryInitializer factoryInitializer) { AgentInfo[] enabledAgentsByType = config.GetEnabledAgentsByType(agentGroup); this.factoryTable = new FactoryTable(enabledAgentsByType, factoryInitializer); this.agentsInDefaultOrder = new AgentRecord[enabledAgentsByType.Length]; this.monitoringOptions = config.MonitoringOptions; for (int i = 0; i < this.agentsInDefaultOrder.Length; i++) { AgentInfo agentInfo = enabledAgentsByType[i]; this.agentsInDefaultOrder[i] = new AgentRecord(agentInfo.Id, agentInfo.AgentName, agentInfo.BaseTypeName, i, agentInfo.IsInternal); } string[] agents; string[][] eventTopics; AgentRecord[] array; RuntimeSettings.InitializeAgentsAndSubscriptions(config, agentGroup, false, out agents, out eventTopics, out array); this.agentSubscription = new AgentSubscription(agentGroup, agents, eventTopics); RuntimeSettings.InitializeAgentsAndSubscriptions(config, agentGroup, true, out agents, out eventTopics, out this.publicAgentsInDefaultOrder); this.disposeAgents = config.DisposeAgents; }
private static void InitializeAgentsAndSubscriptions(MExConfiguration config, string agentGroup, bool publicAgentsOnly, out string[] agents, out string[][] subscriptions, out AgentRecord[] agentsInDefaultOrder) { AgentInfo[] array = publicAgentsOnly ? config.GetEnaledPublicAgentsByType(agentGroup) : config.GetEnabledAgentsByType(agentGroup); agents = new string[array.Length]; agentsInDefaultOrder = new AgentRecord[array.Length]; subscriptions = new string[array.Length][]; for (int i = 0; i < array.Length; i++) { AgentInfo agentInfo = array[i]; agentsInDefaultOrder[i] = new AgentRecord(agentInfo.Id, agentInfo.AgentName, agentInfo.BaseTypeName, i, agentInfo.IsInternal); agents[i] = agentInfo.AgentName; subscriptions[i] = new string[0]; } }