public ICollection<Agent> TrainAll(IPID iPID, HistorySnapshot snapshot)
        {
            ICollection<Agent> readyAgents = new List<Agent>();
            foreach (LearningAgent learningAgent in m_LearningAgents)
            {
                if (learningAgent.IsNative(iPID))
                {
                    learningAgent.Train(snapshot, true);
                }
                else if (learningAgent.IsForeign(iPID))
                {
                    learningAgent.Train(snapshot, false);
                }
                else
                {
                    continue;
                }

                if (learningAgent.Ready)
                {
                    readyAgents.Add(learningAgent.TurnToAgent());
                }
            }
            return readyAgents;
        }
Example #2
0
 public void Apply(IPID iPID)
 {
     if (!m_NativePIDs.Contains(iPID.PID))
     {
         m_NativePIDs.Add(iPID.PID);
     }
 }
Example #3
0
 public void SetDynamicName(IPID processID, string recognizedAgentName, double res)
 {
     if (m_History.ContainsKey(processID))
     {
         IProcessHistory history = m_History[processID];
         if (history.Res < res)
         {
             history.DynamicName = recognizedAgentName;
         }
     }
 }
Example #4
0
        public LimitedProcessHistory(IPID processID, int limit)
        {
            this.m_ProcessID = processID;
            this.m_Limit = limit;
            this.m_List = new IProcessAction[limit];

            this.DiskFileActivity = 0;
            this.NetActivity = 0;
            this.RegistryActivity = 0;

            this.AffectedKeys = new AffectedKeys();
            this.DynamicName = "";
            this.Res = -1;
        }
Example #5
0
 public int CompareTo(IPID other)
 {
     if (other == null || other.GetType() != typeof(WinPID))
     {
         return 1;
     }
     WinPID another = (WinPID) other;
     if (this.PID > another.PID)
     {
         return 1;
     }
     if (this.PID == another.PID)
     {
         return 0;
     }
     return -1;
 }
Example #6
0
        public ICollection<Agent> Handle(IPID iPID, IList<IProcessAction> actions)
        {
            HistorySnapshot snapshot = new HistorySnapshot(iPID, actions);

            IRecognizedAgent recognized = m_WatchingAgents.Compute(snapshot);
            if (recognized.Apply(iPID.PID))
            {
                m_History.SetDynamicName(iPID, recognized.Name, recognized.MaxRes);
            }

            IEnumerable<AgentReaction> reactions = m_GuardianAgents.Compute(snapshot);
            foreach (AgentReaction reaction in reactions)
            {
                reaction.Apply();
            }

            return m_LearningAgents.TrainAll(iPID, snapshot);
        }
Example #7
0
 public void Add(IPID processID, IProcessAction action)
 {
     if (processID.PID <= 0)
     {
         return;
     }
     IProcessHistory processHistory;
     if (!m_History.ContainsKey(processID))
     {
         string name;
         if (String.IsNullOrEmpty(processID.Name))
         {
             try
             {
                 name = Process.GetProcessById(processID.PID).ProcessName;
             }
             catch (Exception ex)
             {
                 name = "UNKNOWN";
             }
         }
         else
         {
             name = processID.Name;
         }
         IPID pid = new WinPID(processID.PID, name);
         processHistory = m_ProcessHistoryFactory.CreateProcessHistory(pid);
         processHistory.SnapshotReady += new EventHandler<SnapshotReadyEventArgs>(ProcessHistory_SnapshotReady);
         m_History.Add(pid, processHistory);
     }
     else
     {
         processHistory = m_History[processID];
     }
     processHistory.Add(action);
 }
 private string GetProcessNameById(IPID iPID)
 {
     foreach (IWatchableProcessInfo info in m_ProcessInfos)
     {
         if (info.PID.Equals(iPID))
         {
             return info.ProcessName;
         }
     }
     return null;
 }
 public void NewAction(IPID processID, IProcessAction action)
 {
     if (m_Filter.Count == 0 || m_Filter.Contains(processID))
     {
         m_GlobalHistory.Add(processID, action);
     }
 }
 public IProcessHistory this[IPID processID]
 {
     get { return m_GlobalHistory[processID]; }
 }
 public IProcessHistory CreateProcessHistory(IPID processID)
 {
     return new LimitedProcessHistory(processID, Limit);
 }
Example #12
0
 public bool ContainsKey(IPID processID)
 {
     return m_History.ContainsKey(processID);
 }
Example #13
0
 public HistorySnapshot(IPID pid, IList<IProcessAction> list)
     : this()
 {
     PID = pid;
     Events = list;
 }
Example #14
0
 public SnapshotReadyEventArgs(IList<IProcessAction> list, IPID pid)
 {
     this.Events = list;
     this.PID = pid;
 }