/// <summary> /// Adds a Agent to the collection /// </summary> /// <param name="w">The Agent to add to the collection</param> public void Add(Agent w) { bool exists = false; for (int i = 0; i < this.Count; i++) { if (this[i].AgentId == w.AgentId) { exists = true; break; } } if (!exists) InnerList.Add(w); }
/// <summary> /// Discover all the Agents which are inside the path (recursive) /// </summary> /// <param name="StartupPath"></param> public void StartAgent(string path, string agentId) { Logger.WriteLine("Starting Agent: " + path, Logger.Severity.Debug, _nodeId); if (File.Exists(path)) { Agent a = new Agent(_nodeId, agentId, path, _com); Add(a); Logger.WriteLine("Agent added to collection: " + path, Logger.Severity.Debug, _nodeId); a.Start(); Logger.WriteLine("Agent Started: " + path, Logger.Severity.Debug, _nodeId); } else { Logger.WriteLine("Agent does not exists: " + path, Logger.Severity.Error, _nodeId); } }