Пример #1
0
        /// <summary>
        /// Serializes properties of PSObject
        /// </summary>
        private void CreateCimInstanceForPSObjectProperties
        (
            PSObject source,
            int depth,
            IEnumerable<PSPropertyInfo> specificPropertiesToSerialize,
            out List<CimInstance> listOfCimInstances
        )
        {
            listOfCimInstances = new List<CimInstance>();

            Dbg.Assert(source != null, "caller should validate the information");

            //TODO, insivara : Depth implementation will come later

            if (specificPropertiesToSerialize != null)
            {
                SerializeProperties(specificPropertiesToSerialize, depth, out listOfCimInstances);
            }
            else
            {
                if (source.ShouldSerializeAdapter())
                {
                    IEnumerable<PSPropertyInfo> adapterCollection = null;
                    adapterCollection = source.GetAdaptedProperties();
                    if (adapterCollection != null)
                    {
                        SerializeProperties(adapterCollection, depth, out listOfCimInstances);
                    }
                }
            }
        }