示例#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);
        }