Exemple #1
0
        /// <summary>
        /// Returns a table that contains the position and strongly typed value of the property. If it does not exist, returns an empty collection.
        /// </summary>
        /// <param name="propertyKey">Key to the property to obtain</param>
        /// <returns>
        /// Reference to the object list that contains the position and strongly typed value of the property.
        /// </returns>
        public IDictionary <int, T> GetProperties <T>(PropertyKey propertyKey)
        {
            Enum propertyId = propertyKey.StructureId;
            Dictionary <int, T> properties = new Dictionary <int, T>();
            DmiStructure        structure  = this[(SmbiosStructure)propertyId];

            if (structure == null)
            {
                return(properties);
            }

            int i = 0;
            DmiClassCollection elements = structure.Elements;

            foreach (var element in elements)
            {
                properties.Add(i, element.GetProperty <T>(propertyKey));
                i++;
            }

            return(properties);
        }
Exemple #2
0
        /// <summary>
        /// Returns a table that contains the position and value of the property. If it does not exist, returns an empty collection.
        /// </summary>
        /// <param name="propertyKey">Key to the property to obtain</param>
        /// <returns>
        /// Reference to the object list that contains the position and value of the property
        /// </returns>
        public IDictionary <int, object> GetProperties(IPropertyKey propertyKey)
        {
            Enum propertyId = propertyKey.StructureId;
            Dictionary <int, object> properties = new Dictionary <int, object>();
            DmiStructure             structure  = this[(DmiStructureClass)propertyId];

            if (structure == null)
            {
                return(properties);
            }

            int i = 0;
            DmiClassCollection elements = structure.Elements;

            foreach (var element in elements)
            {
                properties.Add(i, element.GetPropertyValue(propertyKey));
                i++;
            }

            return(properties);
        }