Beispiel #1
0
        /// <summary>
        /// Generic PropertyQuery.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="wmiclass">WMI class.</param>
        /// <param name="property">Property inside the class.</param>
        /// <param name="condition">Condition the property needs to match.</param>
        /// <param name="scope">WMI scope.</param>
        /// <returns>The property value casted to the generic type.</returns>
        public static T PropertyQuery <T>(string wmiclass, string property, string condition, ManagementScope scope = null)
        {
            WmiProperty prop = PropertyQuery(wmiclass, property, condition, scope);

            return(prop.Value == null
                ? default(T)
                : (T)prop.Value);
        }
Beispiel #2
0
        // Token: 0x0600000D RID: 13 RVA: 0x000022F8 File Offset: 0x000004F8
        public static T PropertyQuery <T>(string wmiclass, string property, string condition, ManagementScope scope = null)
        {
            WmiProperty wmiProperty = Wmi.PropertyQuery(wmiclass, property, condition, scope);

            return((wmiProperty.Value == null) ? default(T) : ((T)((object)wmiProperty.Value)));
        }