예제 #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)
 {
 }