Example #1
0
        private void EnumerateInstanceNames(string className)
        {
            baseKeyClassMap = new Dictionary<CimName, CimName>();
            EnumerateInstanceNamesOpSettings ei = new EnumerateInstanceNamesOpSettings(className);
            mainKBSet = new KeyBindingSet();

            //try
            //{
                progress = new ProgressForm();
                progress.Show();
                progress.Refresh();

                CimInstanceNameList list = mainWbemClient.EnumerateInstanceNames(ei);

                progress.Status = ProgressForm.Updating;
                progress.Refresh();

                int count = list.Count;
                int curCount = 0;
                foreach (CimInstanceName curCIN in list)
                {
                    if (!mainKBSet.Contains(curCIN.KeyBindings, FindBaseKeyClass(curCIN.ClassName)))
                    {
                        mainKBSet.Add(curCIN.KeyBindings, FindBaseKeyClass(curCIN.ClassName));
                    }
                    else
                    {
                        // inc the number in this set item.
                        mainKBSet.Find(curCIN.KeyBindings, FindBaseKeyClass(curCIN.ClassName)).NumInstances++;
                    }
                    curCount++;
                    float val = ((float)curCount * 100) / count;
                    progress.UIupdateComplete(Convert.ToInt32(val));
                }

                list.RemoveRange(0, list.Count);

                list = null;
                DisplayList(mainKBSet, count);
                progress.Close();
            //}
            //catch (Exception e)
            //{
            //    MessageBox.Show(e.Message);
            //}
        }
Example #2
0
        public CimInstanceNameList EnumerateInstanceNames(EnumerateInstanceNamesOpSettings settings)
        {
            SingleResponse response = MakeSingleRequest("EnumerateInstanceNames", settings);

            if (response.Value == null)
            {
                return new CimInstanceNameList();  // return an empty list
            }

            CheckSingleResponse(response, typeof(CimInstanceNameList));

            return (CimInstanceNameList)response.Value;
        }
Example #3
0
        public string[] EnumerateNamespaces()
        {
            List<string> nsStrings = new List<string>();
            EnumerateInstanceNamesOpSettings eino = new EnumerateInstanceNamesOpSettings("CIM_NamespaceInManager");
            eino.Namespace = "Interop";

            CimInstanceNameList cinl = this.EnumerateInstanceNames(eino);

            //Changed for MONO
            for (int i = 0; i < cinl.Count; ++i)
            {
                CimInstanceName curIN = cinl[i];

                CimKeyBinding tmpKB = curIN.KeyBindings["Dependent"];
                CimInstanceNamePath tmpCLIP = (CimInstanceNamePath)((CimValueReference)tmpKB.Value).CimObject;
                CimKeyValue tmpKV = (CimKeyValue)tmpCLIP.InstanceName.KeyBindings["name"].Value;
                nsStrings.Add(tmpKV.Value);
            }

            return nsStrings.ToArray();
        }
Example #4
0
        public void EnumerateInstanceNames(EnumerateInstanceNamesOpSettings settings, CimDataTypeHandler callBack)
        {
            ParseResponse pr = new ParseResponse();
            string reqXml = Wbem.CimXml.CreateRequest.ToXml(settings, this.DefaultNamespace);
            string respXml = ExecuteRequest("EnumerateInstances", reqXml);

            pr.ParseXml(respXml, callBack);
        }