public int Get_(string wszName, int lFlags, out object pVal, out int plFlavor)
        {
            var obj = _handler.GetQualifier(wszName);

            pVal     = obj.Value;
            plFlavor = 0;
            return(0);
        }
Esempio n. 2
0
        public object Get(object nativeObj)
        {
            var  obj        = nativeObj as UnixMetaClass;
            Type targetType = Type.GetType(obj.ImplementationType, false, true);

            if (targetType != null)
            {
                IUnixWbemClassHandler targetHandler = WMIDatabaseFactory.GetHandler(targetType);
                foreach (var p in targetHandler.PropertyInfos)
                {
                    RegisterProperty(p.Name, p.Type, p.Flavor);
                    _prop.Add(p.Name, null);
                }

                foreach (var qualifierName in targetHandler.QualifierNames)
                {
                    _qualifiers.Add(qualifierName, targetHandler.GetQualifier(qualifierName));
                }

                foreach (var method in targetHandler.Methods)
                {
                    AddMethod(method.Name, method);
                }
            }
            if (obj != null)
            {
                _prop.Add("__GENUS", 1);
                _prop.Add("__SERVER", System.Net.Dns.GetHostName().ToLower());
                _prop.Add("__NAMESPACE", obj.Namespace);
                _prop.Add("__UID", obj.Id);
                _prop.Add("__CLASS", obj.ClassName);
                _prop.Add("__IMPLEMENTATION_TYPE", obj.ImplementationType);
                _prop.Add("__DERIVATION", GetDerivations(targetType));
                _prop.Add("__PATH", string.Format("//{0}/{1}/{2}/{3}=\"{4}\"", _prop ["__SERVER"], _prop ["__NAMESPACE"], "META_CLASS", PathField, _prop [PathField]));
                _prop.Add("__RELATIVE_PATH", string.Format("{0}/{1}=\"{2}\"", _prop ["__CLASS"], PathField, _prop [PathField]));
            }

            return(this);
        }