Esempio n. 1
0
        private void GetNamespaces()
        {
            var async    = CimSession.EnumerateInstancesAsync("root", "__NAMESPACE");
            var observer = new GetNamespaceObserver(CimSession, Namespaces);

            observer.Disposable = async.Subscribe(observer);
        }
        public static void EnumerateASync(CimSession cimSession, string cimNamespace, string cimClassName)
        {
            // Check Arguments
            if (cimNamespace == null)
            {
                throw new ArgumentNullException("cimNamespace");
            }

            if (cimClassName == null)
            {
                throw new ArgumentNullException("cimClassName");
            }

            try
            {
                IObservable <CimInstance>  enumeratedInstances = cimSession.EnumerateInstancesAsync(cimNamespace, cimClassName, GetOperationOptions());
                TestObserver <CimInstance> observer            = new TestObserver <CimInstance>();
                IDisposable disposeable = enumeratedInstances.Subscribe(observer);
                observer.WaitForCompletion();
            }
            catch (CimException ex)
            {
                PrintCimException(ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 3
0
            public void OnNext(CimInstance value)
            {
                var ns = $"{value.CimSystemProperties.Namespace}/{value.CimInstanceProperties["Name"].Value}";

                _namespaces.AddOrUpdate(ns, i => new List <string>(), (a, b) => b);

                // collect classes
                var async    = _session.EnumerateClassesAsync(ns);
                var observer = new GetClassObserver(_session, _namespaces);

                observer.Disposable = async.Subscribe(observer);

                // collect nested namespaces
                var async2    = _session.EnumerateInstancesAsync(ns, "__NAMESPACE");
                var observer2 = new GetNamespaceObserver(_session, _namespaces);

                observer2.Disposable = async2.Subscribe(observer2);
            }