/// <summary/>
        public CustomEntryBuilder StartFrame(uint leftIndent = 0, uint rightIndent = 0, uint firstLineHanging = 0, uint firstLineIndent = 0)
        {
            // Mutually exclusive
            if (leftIndent != 0 && rightIndent != 0)
            {
                throw PSTraceSource.NewArgumentException("leftIndent");
            }

            // Mutually exclusive
            if (firstLineHanging != 0 && firstLineIndent != 0)
            {
                throw PSTraceSource.NewArgumentException("firstLineHanging");
            }

            var frame = new CustomItemFrame
            {
                LeftIndent       = leftIndent,
                RightIndent      = rightIndent,
                FirstLineHanging = firstLineHanging,
                FirstLineIndent  = firstLineIndent
            };

            _entryStack.Peek().Add(frame);
            _entryStack.Push(frame.CustomItems);
            return(this);
        }
        /// <summary/>
        public CustomEntryBuilder StartFrame(uint leftIndent = 0, uint rightIndent = 0, uint firstLineHanging = 0, uint firstLineIndent = 0)
        {
            // Mutually exclusive
            if (leftIndent != 0 && rightIndent != 0)
            {
                throw PSTraceSource.NewArgumentException("leftIndent");
            }

            // Mutually exclusive
            if (firstLineHanging != 0 && firstLineIndent != 0)
            {
                throw PSTraceSource.NewArgumentException("firstLineHanging");
            }

            var frame = new CustomItemFrame
            {
                LeftIndent = leftIndent,
                RightIndent = rightIndent,
                FirstLineHanging = firstLineHanging,
                FirstLineIndent = firstLineIndent
            };
            _entryStack.Peek().Add(frame);
            _entryStack.Push(frame.CustomItems);
            return this;
        }
        internal static CustomItemBase Create(FormatToken token)
        {
            if (token is NewLineToken)
            {
                return(new CustomItemNewline());
            }

            var textToken = token as TextToken;

            if (textToken != null)
            {
                return(new CustomItemText {
                    Text = textToken.text
                });
            }

            var frameToken = token as FrameToken;

            if (frameToken != null)
            {
                var frame = new CustomItemFrame
                {
                    RightIndent = (uint)frameToken.frameInfoDefinition.rightIndentation,
                    LeftIndent  = (uint)frameToken.frameInfoDefinition.leftIndentation
                };
                var firstLine = frameToken.frameInfoDefinition.firstLine;
                if (firstLine > 0)
                {
                    frame.FirstLineIndent = (uint)firstLine;
                }
                else if (firstLine < 0)
                {
                    frame.FirstLineHanging = (uint)-firstLine;
                }
                foreach (var frameItemToken in frameToken.itemDefinition.formatTokenList)
                {
                    frame.CustomItems.Add(CustomItemBase.Create(frameItemToken));
                }
                return(frame);
            }

            var cpt = token as CompoundPropertyToken;

            if (cpt != null)
            {
                var cie = new CustomItemExpression {
                    EnumerateCollection = cpt.enumerateCollection
                };

                if (cpt.conditionToken != null)
                {
                    cie.ItemSelectionCondition = new DisplayEntry(cpt.conditionToken);
                }

                if (cpt.expression.expressionValue != null)
                {
                    cie.Expression = new DisplayEntry(cpt.expression);
                }

                if (cpt.control != null)
                {
                    cie.CustomControl = new CustomControl((ComplexControlBody)cpt.control, null);
                }

                return(cie);
            }

            var fpt = token as FieldPropertyToken;

            if (fpt != null)
            {
            }

            Diagnostics.Assert(false, "Unexpected formatting token kind");

            return(null);
        }
        internal static CustomItemBase Create(FormatToken token)
        {
            if (token is NewLineToken)
            {
                return new CustomItemNewline();
            }

            var textToken = token as TextToken;
            if (textToken != null)
            {
                return new CustomItemText { Text = textToken.text };
            }

            var frameToken = token as FrameToken;
            if (frameToken != null)
            {
                var frame = new CustomItemFrame
                {
                    RightIndent = (uint)frameToken.frameInfoDefinition.rightIndentation,
                    LeftIndent = (uint)frameToken.frameInfoDefinition.leftIndentation
                };
                var firstLine = frameToken.frameInfoDefinition.firstLine;
                if (firstLine > 0)
                {
                    frame.FirstLineIndent = (uint)firstLine;
                }
                else if (firstLine < 0)
                {
                    frame.FirstLineHanging = (uint)-firstLine;
                }
                foreach (var frameItemToken in frameToken.itemDefinition.formatTokenList)
                {
                    frame.CustomItems.Add(CustomItemBase.Create(frameItemToken));
                }
                return frame;
            }

            var cpt = token as CompoundPropertyToken;
            if (cpt != null)
            {
                var cie = new CustomItemExpression { EnumerateCollection = cpt.enumerateCollection };

                if (cpt.conditionToken != null)
                {
                    cie.ItemSelectionCondition = new DisplayEntry(cpt.conditionToken);
                }

                if (cpt.expression.expressionValue != null)
                {
                    cie.Expression = new DisplayEntry(cpt.expression);
                }

                if (cpt.control != null)
                {
                    cie.CustomControl = new CustomControl((ComplexControlBody)cpt.control, null);
                }

                return cie;
            }

            var fpt = token as FieldPropertyToken;
            if (fpt != null)
            {
            }

            Diagnostics.Assert(false, "Unexpected formatting token kind");

            return null;
        }