Пример #1
0
 public static FormatProcessor Get(OutputWriter outputWriter, FormatShape shape)
 {
     // we use cached instances as the instance is able then to continue old output
     if (_lastProcessor != null && _lastProcessor.Shape.Equals(shape) &&
         _lastProcessor.OutputWriter.Equals(outputWriter))
     {
         return _lastProcessor;
     }
     switch (shape)
     {
         case FormatShape.List:
             _lastProcessor = new ListFormatProcessor(outputWriter);
             break;
         case FormatShape.Table:
             _lastProcessor = new TableFormatProcessor(outputWriter);
             break;
         default:
             throw new PSInvalidOperationException("Cannot get FormatProcessor for undefined shape");
     }
     return _lastProcessor;
 }
Пример #2
0
        public static FormatProcessor Get(OutputWriter outputWriter, FormatShape shape)
        {
            // we use cached instances as the instance is able then to continue old output
            if (_lastProcessor != null && _lastProcessor.Shape.Equals(shape) &&
                _lastProcessor.OutputWriter.Equals(outputWriter))
            {
                return(_lastProcessor);
            }
            switch (shape)
            {
            case FormatShape.List:
                _lastProcessor = new ListFormatProcessor(outputWriter);
                break;

            case FormatShape.Table:
                _lastProcessor = new TableFormatProcessor(outputWriter);
                break;

            default:
                throw new PSInvalidOperationException("Cannot get FormatProcessor for undefined shape");
            }
            return(_lastProcessor);
        }
Пример #3
0
 protected FormatProcessor(FormatShape shape, OutputWriter outputWriter)
 {
     Shape        = shape;
     OutputWriter = outputWriter;
     _state       = FormattingState.FormatEnd;
 }
Пример #4
0
 protected virtual void ProcessGroupEnd(GroupEndData data)
 {
     OutputWriter.WriteToErrorStream = false;
     OutputWriter.WriteLine("");
 }
Пример #5
0
 internal TableFormatProcessor(OutputWriter writer) : base(FormatShape.Table, writer)
 {
 }
Пример #6
0
 internal ListFormatProcessor(OutputWriter writer) : base(FormatShape.List, writer)
 {
 }
Пример #7
0
 protected FormatProcessor(FormatShape shape, OutputWriter outputWriter)
 {
     Shape = shape;
     OutputWriter = outputWriter;
     _state = FormattingState.FormatEnd;
 }
Пример #8
0
 internal ListFormatProcessor(OutputWriter writer)
     : base(FormatShape.List, writer)
 {
 }