Example #1
0
 /// <summary>
 /// Gets the command text.
 /// </summary>
 /// <returns>The command text.</returns>
 public string GetCommandText(ICommand command, CommandOptions options = null)
 {
     if (options == null)
     {
         options = new CommandOptions();
     }
     StringWriter writer = new StringWriter();
     FormattingVisitor visitor = new FormattingVisitor(writer, options);
     visitor.Visit(command);
     return writer.ToString();
 }
 /// <summary>
 /// Initializes a new instance of a FormatterVisitor.
 /// </summary>
 /// <param name="writer">The text writer to write the text to.</param>
 /// <param name="options">The command options to use to augment the text generation.</param>
 public FormattingVisitor(TextWriter writer, CommandOptions options = null)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     this.writer = writer;
     this.options = options == null ? new CommandOptions() : options.Clone();
     this.commandType = CommandType.Unknown;
     this.sourceReferenceType = SourceReferenceType.Declaration;
     this.valueReferenceType = ValueReferenceType.Declaration;
 }
 private FormattingVisitor(
     TextWriter writer, 
     CommandOptions options, 
     int level, 
     CommandType commandType, 
     SourceReferenceType sourceType,
     ValueReferenceType projectionType)
 {
     this.writer = writer;
     this.options = options;
     this.level = level;
     this.commandType = commandType;
     this.sourceReferenceType = sourceType;
     this.valueReferenceType = projectionType;
 }