Ejemplo n.º 1
0
        private TreeNode getModel(WMIC wmic)
        {
            TreeNode model    = new TreeNode();
            string   response = wmicCall(wmic.createQuery((int)Query.model));

            model.Name = "Model";
            model.Text = response.Replace("Name", "").Trim();
            return(model);
        }
Ejemplo n.º 2
0
        private TreeNode getSerial(WMIC wmic)
        {
            TreeNode serial   = new TreeNode();
            string   response = wmicCall(wmic.createQuery((int)Query.serial));

            serial.Name = "SerialNO";
            serial.Text = "Serial Number: " + response.Replace("SerialNumber", "").Trim();
            serial.Tag  = response;
            return(serial);
        }
Ejemplo n.º 3
0
        // Change this so it only gets software and adds it to a node
        /// <summary>
        /// Gets a list of software from the target node.
        /// ToDo: Configure for adaptable WMIC calls rather than hard coded.
        /// ToDo: Edit Node names
        /// </summary>
        /// <param name="nodeName"></param>
        /// <returns></returns>
        private TreeNode getSoftware(WMIC wmic)
        {
            TreeNode softNode = new TreeNode();

            softNode.Name = "Software";
            softNode.Text = "Software";
            TreeNode node;
            string   response = "";
            string   dupResponse;


            response    = wmicCall(wmic.createQuery((int)Query.software));
            dupResponse = response;
            foreach (string l in filterResponse(response, wmic.Version))
            {
                if (!string.IsNullOrEmpty(l.Trim()))
                {
                    TreeNode version = new TreeNode();
                    TreeNode n       = new TreeNode();
                    n.Name = l.Substring(0, l.LastIndexOf(" ")).Replace(' ', '.');
                    n.Text = l.Substring(0, l.LastIndexOf(" "));
                    if (wmic.Version)
                    {
                        version.Name = "Version";
                        version.Text = "Version: " + l.Substring(l.LastIndexOf(" "));
                        n.Nodes.Add(version);
                    }
                    softNode.Nodes.Add(n);

                    AddToSoftware(l);
                }
            }

            node      = new TreeNode();
            node.Text = wmic.Name;
            node.Name = wmic.Name;
            if (softNode.GetNodeCount(true) > 1)
            {
                node.Nodes.Add(softNode);
            }
            return(node);
        }