示例#1
0
 public LineSplitList(
     List <StringSegment> splits,
     EchoSequenceList printSequences,
     int cursorIndex     = -1,
     int cursorLineIndex = -1)
 {
     Splits          = splits;
     PrintSequences  = printSequences;
     CursorIndex     = cursorIndex;
     CursorLineIndex = cursorLineIndex;
 }
示例#2
0
        public override void Echo(
            object o,
            bool lineBreak      = false,
            bool preserveColors = false,                // TODO: remove this parameter + SaveColors property
            bool parseCommands  = true,
            bool doNotEvalutatePrintDirectives = false, // TODO: explain this
            EchoSequenceList printSequences    = null,
            bool avoidANSISequencesAndNonPrintableCharacters = true,
            bool getNonPrintablesASCIICodesAsLabel           = true
            // TODO: add the formatting options for the decorators (see ConsoleCommands.Echo)
            )
        {
            if (o == null)
            {
                // handle null

                base.Echo(
                    EchoPrimitives.DumpNull(CommandEvaluationContext),
                    lineBreak,
                    preserveColors,
                    parseCommands,
                    doNotEvalutatePrintDirectives,
                    printSequences,
                    avoidANSISequencesAndNonPrintableCharacters,
                    getNonPrintablesASCIICodesAsLabel
                    );
            }
            else
            {
                if (o is string)
                {
                    // handle string

                    base.Echo(
                        o,
                        lineBreak,
                        preserveColors,
                        parseCommands,
                        doNotEvalutatePrintDirectives,
                        printSequences,
                        avoidANSISequencesAndNonPrintableCharacters,
                        getNonPrintablesASCIICodesAsLabel
                        );
                }
                else
                {
                    // handle object

                    o.Echo(
                        new EchoEvaluationContext(
                            (ConsoleTextWriterWrapper)CommandEvaluationContext.Out,
                            CommandEvaluationContext,
                            new FormatingOptions(lineBreak, parseCommands)
                            )
                        );
                    if (lineBreak)
                    {
                        base.Echo("", true);             // TODO: formatting option not implemented ?
                    }
                }
            }
        }