Example #1
0
 public void SaveAgent(string name, Agent agent)
 {
     string pathToAgent = GetAgentPath(name);
     IFormatter formatter = new BinaryFormatter();
     Stream stream = new FileStream(pathToAgent, FileMode.Create, FileAccess.Write, FileShare.None);
     formatter.Serialize(stream, agent);
     stream.Close();
 }
Example #2
0
 public GuardianAgentSession(Agent agent, string process,
     IStrategy redStrategy, IStrategy yellowStrategy, double e1, double e2)
 {
     this.Agent = agent;
     this.TargetProcess = process;
     this.RedStrategy = redStrategy;
     this.YellowStrategy = yellowStrategy;
     this.E1 = e1;
     this.E2 = e2;
 }
Example #3
0
 public void AddWatcher(Agent agent, IStrategy redStrategy, IStrategy yellowStrategy,
     double p1, double p2)
 {
     m_WatchingAgents.AddWatcher(agent, redStrategy, yellowStrategy, p1, p2);
 }
Example #4
0
 public void AddGuardian(Agent agent, string processName, IStrategy redStrategy, IStrategy yellowStrategy,
     double p1, double p2)
 {
     m_GuardianAgents.AddGuardian(agent, processName, redStrategy, yellowStrategy, p1, p2);
 }
Example #5
0
 public void AddGuardian(Agent agent, string process, IStrategy redStrategy,
     IStrategy yellowStrategy, double e1, double e2)
 {
     lock (syncRoot)
     {
         if (!m_Agents.ContainsKey(agent))
         {
             GuardianAgentSession session =
                 new GuardianAgentSession(agent, process, redStrategy, yellowStrategy, e1, e2);
             m_Agents.Add(agent, session);
             session.Start();
         }
     }
 }
Example #6
0
 public WatchingAgentSession(Agent agent, IStrategy redStrategy, IStrategy yellowStrategy,
     double p1, double p2)
 {
     P1 = p1;
     P2 = p2;
     m_Agent = agent;
     RedStrategy = redStrategy;
     YellowStrategy = yellowStrategy;
 }
Example #7
0
 public void AddWatcher(Agent agent, IStrategy redStrategy, IStrategy yellowStrategy, double p1, double p2)
 {
     lock (syncRoot)
     {
         if (!m_Agents.ContainsKey(agent))
         {
             m_Agents.Add(agent, new WatchingAgentSession(agent, redStrategy, yellowStrategy, p1, p2));
         }
     }
 }