Ejemplo n.º 1
0
        void QueryNamespaces()
        {
            FormSplash.ShowForm("Searching for WMI Namespaces... Please, wait");

            RecurseNamespaces("root", treeNS.Nodes.Add("root", "root", 1, 2).Nodes);
            treeNS.Nodes[0].Expand();

            xDoc = new XDocument(new XElement("root"));
            AddXNodeRecursive(xDoc.Root, treeNS.Nodes[0]);
            SaveNamespacesTree();
            FormSplash.CloseForm();
        }
Ejemplo n.º 2
0
 void RecurseNamespaces(string path, TreeNodeCollection nodes)
 {
     try
     {
         ManagementClass mc = new ManagementClass(
             new ManagementScope(path),
             new ManagementPath("__namespace"), null);
         foreach (ManagementObject mo in mc.GetInstances())
         {
             string name = path + "\\" + mo["Name"].ToString();
             nsCount++;
             string s = mo["Name"].ToString();
             FormSplash.AddItem(name);
             RecurseNamespaces(name, nodes.Add(s, s, 1, 2).Nodes);
         }
     }
     catch (ManagementException e) { SetError(e.Message, path); }
 }
Ejemplo n.º 3
0
 void GetClasses(string ns)
 {
     FormSplash.ShowForm("Searching for WMI Classes... Please, wait");
     try
     {
         ManagementObjectSearcher searcher = new ManagementObjectSearcher(
             new ManagementScope(ns),
             new SelectQuery("meta_class"), null);
         foreach (ManagementClass c in searcher.Get())
         {
             string name = c["__CLASS"].ToString();
             nClasses++;
             AddClass(name, c);
             FormSplash.AddItem(name);
         }
     }
     catch (Exception e) { SetError(e.Message, ns); }
     FormSplash.CloseForm();
 }
Ejemplo n.º 4
0
 void SetError(string msg, string path)
 {
     FormSplash.AddMsg(msg + ":  " + path);
     DeleteNode(path);
 }