Exemple #1
0
        private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
        {
            if (radioButton1.Checked)
            {
                lbllist.Text = "List of Process";
                lblname.Text = "Process Name";
                lbltype.Text = "Process Type";

                serviceStatusTextBox.Visible = false;
                lblstatus.Visible            = false;

                if (clientListBox.SelectedIndex >= 0)
                {
                    //clientInfo client = (clientInfo) clientInformation[clientListBox.SelectedIndex];
                    //serviceListBox.DataSource = client.ProcessList;
                    //serviceListBox.DisplayMember = "ProcessName";

                    serviceListBox.Items.Clear();
                    IEnumerator en = selectedClient.ProcessList.GetEnumerator();

                    while (en.MoveNext())
                    {
                        ProcessObject processObject = (ProcessObject)en.Current;
                        serviceListBox.Items.Add(processObject.ProcessName);
                    }
                }
            }
        }
Exemple #2
0
        private void clientListBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            selectedClient          = (clientInfo)clientInformation[clientListBox.SelectedIndex];
            machineNameTextBox.Text = selectedClient.MachineName;
            userNameTextBox.Text    = selectedClient.UserName;
            ipAddressTextBox.Text   = selectedClient.IpAddress;
            portTextBox.Text        = selectedClient.PortNumber.ToString();
            protocolTextBox.Text    = selectedClient.ConnectedSocket.ProtocolType.ToString();

            if (radioButton1.Checked)
            {
                serviceListBox.Items.Clear();
                IEnumerator en = selectedClient.ProcessList.GetEnumerator();

                while (en.MoveNext())
                {
                    ProcessObject processObject = (ProcessObject)en.Current;
                    serviceListBox.Items.Add(processObject.ProcessName);
                }
            }
            else if (radioButton2.Checked)
            {
                serviceListBox.Items.Clear();
                IEnumerator en = selectedClient.ServiceList.GetEnumerator();

                while (en.MoveNext())
                {
                    ServiceObject serviceObject = (ServiceObject)en.Current;
                    serviceListBox.Items.Add(serviceObject.DisplayName);
                }
            }
        }
        public void getProcessList()
        {
            string processlist = "<command type=\"Process_List\">";

            processlist += "</command>$";


            byte[] buffer = new byte[3000];
            buffer = Encoding.ASCII.GetBytes(processlist);
            connectedSocket.Send(buffer);


            connectedSocket.Receive(buffer);
            string s = Encoding.ASCII.GetString(buffer);

            while (connectedSocket.Available > 0)
            {
                connectedSocket.Receive(buffer);
                s += Encoding.ASCII.GetString(buffer);
            }

            string resultXML = s.Substring(0, s.IndexOf('$'));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(resultXML);

            XmlNode node = doc.FirstChild;

            if (node.Attributes.GetNamedItem("type").Value == "Process_List")
            {
                XmlNodeList nodeList = node.ChildNodes;
                IEnumerator en       = nodeList.GetEnumerator();

                while (en.MoveNext())
                {
                    XmlNode       childNode     = (XmlNode)en.Current;
                    string        pname         = childNode.Attributes.GetNamedItem("name").Value;
                    string        ptime         = childNode.Attributes.GetNamedItem("time").Value;
                    ProcessObject processObject = new ProcessObject(pname, ptime);
                    processList.Add(processObject);
                }
            }
            else
            {
                throw new Exception("Wrong Packet Recieved");
            }
        }
Exemple #4
0
        private void serviceListBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            //clientInfo client = (clientInfo) clientInformation[clientListBox.SelectedIndex];

            if (radioButton1.Checked)
            {
                selectedProcess         = (ProcessObject)selectedClient.ProcessList[serviceListBox.SelectedIndex];
                serviceNameTextBox.Text = selectedProcess.ProcessName;
                serviceTypeTextBox.Text = selectedProcess.ProcessStartTime;
            }
            else
            {
                //MessageBox.Show("Hello World");
                selectedService           = (ServiceObject)selectedClient.ServiceList [serviceListBox.SelectedIndex];
                serviceNameTextBox.Text   = selectedService.DisplayName;
                serviceTypeTextBox.Text   = selectedService.ServiceType;
                serviceStatusTextBox.Text = selectedService.Status;
            }
        }