Table of Contents

Class IndentedTextWriter

Namespace
ValveResourceFormat
Assembly
ValveResourceFormat.dll

The same as System.CodeDom.Compiler.IndentedTextWriter but works in partial trust. Taken from System.Data.Entity.Migrations.Utilities.IndentedTextWriter.

public class IndentedTextWriter : TextWriter, IAsyncDisposable, IDisposable

Inheritance

Implements

Inherited Members

Constructors

IndentedTextWriter()

Initializes a new instance of the ValveResourceFormat.IndentedTextWriter class.

public IndentedTextWriter()

IndentedTextWriter(StringWriter)

Initializes a new instance of the ValveResourceFormat.IndentedTextWriter class.

public IndentedTextWriter(StringWriter writer)

Parameters

writer StringWriter

Fields

TabString

Specifies the default tab string. This field is constant.

public const string TabString = "\t"

Field Value

string

Properties

Encoding

When overridden in a derived class, returns the character encoding in which the output is written.

public override Encoding Encoding { get; }

Property Value

Encoding

Indent

Gets or sets the number of spaces to indent.

public int Indent { get; set; }

Property Value

int

NewLine

Gets or sets the line terminator string used by the current TextWriter.

public override string NewLine { get; set; }

Property Value

string

Methods

Close()

Closes the current writer and releases any system resources associated with the writer.

public override void Close()

Dispose(bool)

Releases the unmanaged resources used by the System.IO.TextWriter and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

EnsureCapacity(int)

Ensures that the capacity of this writer is at least the specified value.

public int EnsureCapacity(int capacity)

Parameters

capacity int

The new capacity for this writer.

Returns

int

Flush()

Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

public override void Flush()

Grow(int)

Grows this writer to match the specified min capacity.

public int Grow(int minCapacity)

Parameters

minCapacity int

The minimum capacity for this writer.

Returns

int

OutputTabs()

Outputs the tab string once for each level of indentation according to the ValveResourceFormat.IndentedTextWriter.Indent property.

protected virtual void OutputTabs()

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Write(string?)

Writes a string to the text stream.

public override void Write(string? value)

Parameters

value string?

The string to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(bool)

Writes the text representation of a Boolean value to the text stream.

public override void Write(bool value)

Parameters

value bool

The Boolean value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(char)

Writes a character to the text stream.

public override void Write(char value)

Parameters

value char

The character to write to the text stream.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(char[]?)

Writes a character array to the text stream.

public override void Write(char[]? buffer)

Parameters

buffer char[]?

The character array to write to the text stream.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(char[], int, int)

Writes a subarray of characters to the text stream.

public override void Write(char[] buffer, int index, int count)

Parameters

buffer char[]

The character array to write data from.

index int

The character position in the buffer at which to start retrieving data.

count int

The number of characters to write.

Exceptions

ArgumentException

The buffer length minus index is less than count.

ArgumentNullException

The buffer parameter is null.

ArgumentOutOfRangeException

index or count is negative.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(decimal)

Writes the text representation of a decimal value to the text stream.

public override void Write(decimal value)

Parameters

value decimal

The decimal value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(double)

Writes the text representation of an 8-byte floating-point value to the text stream.

public override void Write(double value)

Parameters

value double

The 8-byte floating-point value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(float)

Writes the text representation of a 4-byte floating-point value to the text stream.

public override void Write(float value)

Parameters

value float

The 4-byte floating-point value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(int)

Writes the text representation of a 4-byte signed integer to the text stream.

public override void Write(int value)

Parameters

value int

The 4-byte signed integer to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(long)

Writes the text representation of an 8-byte signed integer to the text stream.

public override void Write(long value)

Parameters

value long

The 8-byte signed integer to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(object?) Deprecated

Writes the text representation of an object to the text stream by calling the ToString method on that object.

[Obsolete("Do not write to string as a generic object, this is probably a mistake.")]
public override void Write(object? value)

Parameters

value object?

The object to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

Write(string, object?)

Writes a formatted string to the text stream, using the same semantics as the System.String.Format(System.String,System.Object) method.

public override void Write(string format, object? arg0)

Parameters

format string

A composite format string.

arg0 object?

The object to format and write.

Exceptions

ArgumentNullException

format is null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is one).

Write(string, object?, object?)

Writes a formatted string to the text stream using the same semantics as the System.String.Format(System.String,System.Object,System.Object) method.

public override void Write(string format, object? arg0, object? arg1)

Parameters

format string

A composite format string.

arg0 object?

The first object to format and write.

arg1 object?

The second object to format and write.

Exceptions

ArgumentNullException

format is null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero) or greater than or equal to the number of objects to be formatted (which, for this method overload, is two).

Write(string, params object?[])

Writes a formatted string to the text stream, using the same semantics as the System.String.Format(System.String,System.Object[]) method.

public override void Write(string format, params object?[] arg)

Parameters

format string

A composite format string.

arg object?[]

An object array that contains zero or more objects to format and write.

Exceptions

ArgumentNullException

format or arg is null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero), or greater than or equal to the length of the arg array.

WriteLine(string?)

Writes a string to the text stream, followed by a line terminator.

public override void WriteLine(string? value)

Parameters

value string?

The string to write. If value is null, only the line terminator is written.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(ReadOnlySpan<char>)

Writes the text representation of a character span to the text stream, followed by a line terminator.

public override void WriteLine(ReadOnlySpan<char> buffer)

Parameters

buffer ReadOnlySpan<char>

The char span value to write to the text stream.

WriteLine()

Writes a line terminator to the text stream.

public override void WriteLine()

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(bool)

Writes the text representation of a Boolean value to the text stream, followed by a line terminator.

public override void WriteLine(bool value)

Parameters

value bool

The Boolean value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(char)

Writes a character to the text stream, followed by a line terminator.

public override void WriteLine(char value)

Parameters

value char

The character to write to the text stream.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(char[]?)

Writes an array of characters to the text stream, followed by a line terminator.

public override void WriteLine(char[]? buffer)

Parameters

buffer char[]?

The character array from which data is read.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(char[], int, int)

Writes a subarray of characters to the text stream, followed by a line terminator.

public override void WriteLine(char[] buffer, int index, int count)

Parameters

buffer char[]

The character array from which data is read.

index int

The character position in buffer at which to start reading data.

count int

The maximum number of characters to write.

Exceptions

ArgumentException

The buffer length minus index is less than count.

ArgumentNullException

The buffer parameter is null.

ArgumentOutOfRangeException

index or count is negative.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(double)

Writes the text representation of a 8-byte floating-point value to the text stream, followed by a line terminator.

public override void WriteLine(double value)

Parameters

value double

The 8-byte floating-point value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(float)

Writes the text representation of a 4-byte floating-point value to the text stream, followed by a line terminator.

public override void WriteLine(float value)

Parameters

value float

The 4-byte floating-point value to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(int)

Writes the text representation of a 4-byte signed integer to the text stream, followed by a line terminator.

public override void WriteLine(int value)

Parameters

value int

The 4-byte signed integer to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(long)

Writes the text representation of an 8-byte signed integer to the text stream, followed by a line terminator.

public override void WriteLine(long value)

Parameters

value long

The 8-byte signed integer to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(object?)

Writes the text representation of an object to the text stream, by calling the ToString method on that object, followed by a line terminator.

public override void WriteLine(object? value)

Parameters

value object?

The object to write. If value is null, only the line terminator is written.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(uint)

Writes the text representation of a 4-byte unsigned integer to the text stream, followed by a line terminator.

public override void WriteLine(uint value)

Parameters

value uint

The 4-byte unsigned integer to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(ulong)

Writes the text representation of an 8-byte unsigned integer to the text stream, followed by a line terminator.

public override void WriteLine(ulong value)

Parameters

value ulong

The 8-byte unsigned integer to write.

Exceptions

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(string, object?)

Writes a formatted string and a new line to the text stream, using the same semantics as the System.String.Format(System.String,System.Object) method.

public override void WriteLine(string format, object? arg0)

Parameters

format string

A composite format string.

arg0 object?

The object to format and write.

Exceptions

ArgumentNullException

format is null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is one).

WriteLine(string, object?, object?)

Writes a formatted string and a new line to the text stream, using the same semantics as the System.String.Format(System.String,System.Object,System.Object) method.

public override void WriteLine(string format, object? arg0, object? arg1)

Parameters

format string

A composite format string.

arg0 object?

The first object to format and write.

arg1 object?

The second object to format and write.

Exceptions

ArgumentNullException

format is null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is two).

WriteLine(string, object?, object?, object?)

Writes out a formatted string and a new line to the text stream, using the same semantics as System.String.Format(System.String,System.Object).

public override void WriteLine(string format, object? arg0, object? arg1, object? arg2)

Parameters

format string

A composite format string.

arg0 object?

The first object to format and write.

arg1 object?

The second object to format and write.

arg2 object?

The third object to format and write.

Exceptions

ArgumentNullException

format is null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero), or greater than or equal to the number of objects to be formatted (which, for this method overload, is three).

WriteLine(string, params object?[])

Writes out a formatted string and a new line to the text stream, using the same semantics as System.String.Format(System.String,System.Object).

public override void WriteLine(string format, params object?[] arg)

Parameters

format string

A composite format string.

arg object?[]

An object array that contains zero or more objects to format and write.

Exceptions

ArgumentNullException

A string or object is passed in as null.

ObjectDisposedException

The System.IO.TextWriter is closed.

IOException

An I/O error occurs.

FormatException
   <code class="paramref">format</code> is not a valid composite format string.

-or-

The index of a format item is less than 0 (zero), or greater than or equal to the length of the arg array.

WriteLine(string, params ReadOnlySpan<object?>)

Writes out a formatted string and a new line to the text stream, using the same semantics as System.String.Format(System.String,System.ReadOnlySpan{System.Object}).

public override void WriteLine(string format, params ReadOnlySpan<object?> arg)

Parameters

format string

A composite format string.

arg ReadOnlySpan<object?>

An object span that contains zero or more objects to format and write.