예제 #1
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); }
 }
예제 #2
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();
 }