Example #1
0
        protected override void EndProcessing()
        {
            var props = new List <PoshProperty>();

            for (int i = 0; i < list.Count; i++)
            {
                Type t = list[i];
                IEnumerable <PropertyInfo> typeProps = t.GetProperties(RealFlags);
                if (this.MyInvocation.BoundParameters.ContainsKey("PropertyName"))
                {
                    typeProps = typeProps.Where(x => PropertyName.Any(n => n.Equals(x.Name, StringComparison.CurrentCultureIgnoreCase)));
                }
                foreach (PropertyInfo pi in typeProps)
                {
                    props.Add(pi);
                }
            }
            props.Sort(new PoshPropertySorter());

            Func <PoshProperty, bool>  function   = this.GetCondition();
            IEnumerable <PoshProperty> finalProps = props.Where(function);

            if (this.MyInvocation.BoundParameters.ContainsKey("CSharpFormat"))
            {
                WriteObject(this.ToCSharpFormat(finalProps), true);
            }
            else if (this.MyInvocation.BoundParameters.ContainsKey("PSFormatFile"))
            {
                WriteObject(this.ToPSFileFormat(finalProps));
            }
            else
            {
                WriteObject(finalProps, true);
            }
        }