AsynqFramework.CodeWriter.CodeWriterBase.Format C# (CSharp) Метод

Format() публичный Метод

Formats the code as plain-text to a TextWriter with the specified indentation and new-line settings.
public Format ( TextWriter tw, string indentString, int indentationLevel, string newLine ) : void
tw System.IO.TextWriter TextWriter to write the output to
indentString string The indentation string to use per each level of indentation, defaults to 4 spaces.
indentationLevel int The level of indentation to start at, defaults to 0.
newLine string The environment-specific new-line delimiter string to use, defaults to Environment.NewLine.
Результат void
        public virtual void Format(TextWriter tw, string indentString, int indentationLevel, string newLine)
        {
            if (indentationLevel < 0) indentationLevel = 0;
            if (indentString == null) indentString = new string(' ', 4);
            if (newLine == null) newLine = Environment.NewLine;

            foreach (var tok in output)
            {
                switch (tok.TokenType)
                {
                    case TokenType.Newline:
                        tw.Write(newLine + String.Concat(Enumerable.Repeat<string>(indentString, indentationLevel + tok.IndentationDepth.Value).ToArray()));
                        break;
                    default:
                        tw.Write(tok.Text);
                        break;
                }
            }
        }