AnsiViewer - GUI ANSI file presentation
Displays the content of text files with ANSI escape sequences.
The TerminalControl class makes it easy to render and display the so-called ANSI files.
This sample demonstrates:
- Using TerminalControl class.
- Writing a text with escape sequences to the terminal screen.
- Resizing the terminal screen.
Sample files are included in the project.
C#
// open the ANSI file for reading using (StreamReader reader = new StreamReader("ANSI_file.ans")) { // read the whole file to the string string data = reader.ReadToEnd(); // write the data to the terminal screen terminalControl.Screen.Write(data); }
VB.NET
Dim reader As StreamReader = Nothing Try ' open the ANSI file for reading reader = New StreamReader("ANSI_file.ans") ' read the whole file to the string Dim data As String = reader.ReadToEnd() ' write the data to the terminal screen terminalControl.Screen.Write(data) Finally ' close the stream reader If Not reader Is Nothing Then reader.Close() End Try