Example #1
0
		public Process( string name, 
			Computer computer)
		{
			m_name=name;
			m_computer=computer;
			m_status=Status.Unknown;
			m_defined=false;
		}
Example #2
0
        public Process( string name, 
					string owner, string database,
					Computer computer)
        {
            m_name=name;
            m_owner=owner;
            m_computer=computer;
            m_status=Status.Unknown;
            m_database=database;
            m_defined=false;
            m_path="";
            m_cwd="";
            m_args="";
            m_other="";
        }
Example #3
0
        public static void parse(ArrayList processes, Computer c, SocketComm comm)
        {
            string line=comm.readLine();//reader.ReadLine();
            while(line.Equals(""))
            {
                line=comm.readLine();
            }

            if(line.Equals("start processes"))
            {
                listProcesses(processes, c, comm);
                line="";
                return;
            }
        }
Example #4
0
 public void setComputer(Computer c)
 {
     m_computer=c;
 }
Example #5
0
        private static void listProcesses(ArrayList processes, Computer c, SocketComm comm)
        {
            bool processExist = false;

            string line=comm.readLine();//reader.ReadLine();
            while(!line.Equals("end processes"))
            {
                if(line.Equals("process"))
                {
                    line=comm.readLine();
                    Process p = new Process();

                    while(!line.Equals(""))
                    {
                        if(line.StartsWith("id:"))
                        {
                            string pid;
                            line=line.Remove(0,3);
                            pid=line.Trim();
                            /*check if process already exist*/
                            processExist=findProcess(processes,pid);
                            if(!processExist)
                            {
                                p.setId(pid);
                            }
                        }

                        if(line.StartsWith("name:"))
                        {

                            line=line.Remove(0,5);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setName(line);
                            }
                        }

                        if(line.StartsWith("path:"))
                        {

                            line=line.Remove(0,5);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setPath(line);
                            }
                        }

                        if(line.StartsWith("args:"))
                        {

                            line=line.Remove(0,5);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setArgs(line);
                            }
                        }

                        if(line.StartsWith("type:"))
                        {

                            line=line.Remove(0,5);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {

                            }
                        }

                        if(line.StartsWith("cwd:"))
                        {

                            line=line.Remove(0,4);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setCwd(line);
                            }
                        }

                        if(line.StartsWith("env:"))
                        {

                            line=line.Remove(0,4);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setEnv(line);
                            }
                        }

                        if(line.StartsWith("owner:"))
                        {

                            line=line.Remove(0,6);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setOwner(line);
                            }
                        }
                        if(line.StartsWith("group:"))
                        {

                            line=line.Remove(0,6);
                            line=line.Trim();
                            /*check if process already exist*/
                            if(!processExist)
                            {
                                p.setDatabase(line);
                            }
                        }

                        if(line.StartsWith("status:"))
                        {

                            line=line.Remove(0,7);
                            line=line.Trim();
                            /*check if process already exist*/
                            //if(!processExist)
                            //{
                                if(line.Equals("0"))
                                    p.setStatus(Process.Status.Stopped);
                                if(line.Equals("1"))
                                    p.setStatus(Process.Status.Running);
                                if(line.Equals("2"))
                                    p.setStatus(Process.Status.Unknown);
                            //}
                        }

                        line=comm.readLine();
                    }
                    if(!processExist)
                    {
                        p.setComputer(c);
                        p.setDefined(true);
                        processes.Add(p);
                    }
                    processExist=false;
                }
                line=comm.readLine();

            }
        }