Version: 1.1.1.6
Build terminal emulation capabilities into your application with VT and Telnet controls.
That all the data sent and received between the client and the server is visible in a Trace event?
The Trace event is a handy tool for debugging applications. It will fire whenever the component sends or receives data, and is perfect for adding logging capabilities to your application.
Code Sample:
private void myComponent_Trace(object sender, SegmentEventArgs e) 
{ 
    // Append data to a file
    System.IO.FileStream file = new System.IO.FileStream("c:\\Test\\log.txt", System.IO.FileMode.Append); 
    file.Write(e.Segment.Buffer, 0, e.Segment.Count); 
    file.Close(); 
}
Back to Top
That data returning from a Telnet server can be searched for a token value, making automated scripting development a snap?
The WaitFor method will continue receiving data until the specified token has been found, or the specified Timout period has elapsed.
Code Sample:
telnet1.Connect("myserver");  // Connect to a server 
telnet1.WaitFor("ogin:"); // Read until "ogin" is found
telnet1.Send("myuser\r\n"); // Login received, send username 
telnet1.WaitFor("assword:"); // Now wait until "assword:" is found
telnet1.Send("mypass\r\n"); // Send password 
telnet1.WaitFor("$"); // Wait for command prompt
Back to Top
That escape codes returned from a server can be converted to HTML?
The Vt.ScrapeHtml method will replace traditional escape sequences with Html tags, allowing data to be displayed in browsers with minimum effort.
Code Sample:
//Get the first 100 characters of the display as Html
//Instead of an offset, you could also specify a row and column to start at
string htmlContent = vt1.ScrapeHtml(0, 100);
Back to Top
That every character has a corresponding object defining its style?
Each character in the VT display is represented by its own Cell object, making information about any character easily obtainable.
Code Sample:
private string ShowCellInfo(int offset) 
{ 
    // Scrape the cell at the offset specified and return a string. 
    Cell[] cells = vt1.ScrapeCells(offset, 1); 

    // Display info about the cell. 
    string cellInfo = "Character: " + cells[0].Character; 
    cellInfo += " (" + (char)cells[0].Character + ")" + "\r\n"; 
    cellInfo += "Raw Character: " + cells[0].RawCharacter; 
    cellInfo += " (" + (char)cells[0].RawCharacter + ")" + "\r\n"; 
    cellInfo += "Background color: " + cells[0].BackColor + "\r\n"; 
    cellInfo += "Foreground color: " + cells[0].ForeColor + "\r\n"; 
    cellInfo += "Styles: " + cells[0].Styles; 
    return cellInfo;
}
Back to Top
That Option Negotiation can be easily customized?
Specifying which options should be negotiated with the telnet server is easy when the ClientOptions and ServerOptions collections are used.
Code Sample:
// Cause the client to refuse the TerminalType option if offered by the server telnet1.ClientOptions.Remove(telnet1.ClientOptions[OptionCode.TerminalType]); 

// Request that server enable the Echo option 
telnet1.ServerOptions.Add(new Option(OptionCode.Echo)); 

// Connect and login to the Telnet server 
telnet1.Login("myserver", "myusername", "mypassword", "$");
Back to Top
That the Vt control can easily remap keys?
When keys are pressed, the default behavior of keys can be overridden by replacing them with customized sequences in the KeyDown event.
Code Sample:
private void vt1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) 
{ 
    // Handle Keymappping. In this example, two mappings are demonstrated: 
    // 1) Map the Shift key plus "H" to the sequence "Hello World" 
    // 2) Map the Control key plus "B" to the sophisticated sequence "Blah" 
    if(e.Shift == true && e.KeyCode == Keys.H) 
    { 
        vt1.Telnet.Send("Hello World\r\n"); 
        e.Handled = true; // Mark the event as handled so no more key events are raised 
    } 
    if(e.Control == true && e.KeyCode == Keys.B) 
    { 
        vt1.Telnet.Send("Blah\r\n"); 
        e.Handled = true; // Mark the event as handled so no more key events are raised 
    } 
}
Back to Top