private GroupTransition ComputeGroupTransition(PSObject so)
 {
     InnerFormatShapeCommandBase.FormattingContext context = (InnerFormatShapeCommandBase.FormattingContext)base.contextManager.Peek();
     if (context.state == InnerFormatShapeCommandBase.FormattingContext.State.document)
     {
         this.viewManager.ViewGenerator.UpdateGroupingKeyValue(so);
         return(GroupTransition.enter);
     }
     if (!this.viewManager.ViewGenerator.UpdateGroupingKeyValue(so))
     {
         return(GroupTransition.none);
     }
     return(GroupTransition.startNew);
 }
 internal override void EndProcessing()
 {
     while (true)
     {
         InnerFormatShapeCommandBase.FormattingContext context = (InnerFormatShapeCommandBase.FormattingContext)base.contextManager.Peek();
         if (context.state == InnerFormatShapeCommandBase.FormattingContext.State.none)
         {
             return;
         }
         if (context.state == InnerFormatShapeCommandBase.FormattingContext.State.group)
         {
             this.PopGroup();
         }
         else if (context.state == InnerFormatShapeCommandBase.FormattingContext.State.document)
         {
             FormatEndData o = new FormatEndData();
             this.WriteObject(o);
             base.contextManager.Pop();
         }
     }
 }
        private void ProcessObject(PSObject so)
        {
            if (this.formatObjectDeserializer.IsFormatInfoData(so))
            {
                this.WriteObject(so);
            }
            else if (!this.ProcessOutOfBandObjectOutsideDocumentSequence(so))
            {
                InnerFormatShapeCommandBase.FormattingContext context = (InnerFormatShapeCommandBase.FormattingContext)base.contextManager.Peek();
                if (context.state == InnerFormatShapeCommandBase.FormattingContext.State.none)
                {
                    this.viewManager.Initialize(base.TerminatingErrorContext, this.expressionFactory, this._typeInfoDataBase, so, this.shape, this.parameters);
                    this.WriteFormatStartData(so);
                    base.contextManager.Push(new InnerFormatShapeCommandBase.FormattingContext(InnerFormatShapeCommandBase.FormattingContext.State.document));
                }
                if (!this.ProcessOutOfBandObjectInsideDocumentSequence(so))
                {
                    switch (this.ComputeGroupTransition(so))
                    {
                    case GroupTransition.enter:
                        this.PushGroup(so);
                        this.WritePayloadObject(so);
                        return;

                    case GroupTransition.exit:
                        this.WritePayloadObject(so);
                        this.PopGroup();
                        return;

                    case GroupTransition.startNew:
                        this.PopGroup();
                        this.PushGroup(so);
                        this.WritePayloadObject(so);
                        return;
                    }
                    this.WritePayloadObject(so);
                }
            }
        }