PuttyXtermEmulator 1.0.0

dotnet add package PuttyXtermEmulator --version 1.0.0                
NuGet\Install-Package PuttyXtermEmulator -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PuttyXtermEmulator" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PuttyXtermEmulator --version 1.0.0                
#r "nuget: PuttyXtermEmulator, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PuttyXtermEmulator as a Cake Addin
#addin nuget:?package=PuttyXtermEmulator&version=1.0.0

// Install PuttyXtermEmulator as a Cake Tool
#tool nuget:?package=PuttyXtermEmulator&version=1.0.0                

PuttyXtermEmulator

An In-Memory UTF-8 XTerm Emulator based on Putty.

Send escape codes and read the virtual screen to see what happened.

PuttyXtermEmulator uses a much cut-down version of putty, which leaves just the in-memory console handling. Putty is compiled as a library and used to parse the data sent to it by using the Send method. The terminal state can then be queried by calling the GetLine method.

PuttyXtermEmu is compiled for Windows/Linux x86/x64 and WebAssembly (when using Uno Platform).

If trying to get x86 to work on x64 machines, the project which references PuttyXtermEmulator will likely need to set <PlatformTarget>x86</PlatformTarget>

Install

> dotnet add package PuttyXtermEmulator

Or download PuttyXtermEmulator directly from NuGet.

Example Usage

using Putty;
using System.Text;

namespace Test
{
    public class Program
    {
        private static void Main(string[] args)
        {
            int width = 80, height = 24;
            var term = new Terminal(width, height);

            var data = new TerminalCharacter[height, width];

            term.Send(Encoding.UTF8.GetBytes("\x1b[2J\x1b(B\x1b)0\x1b[?1049h\x1b[1;42r\x1b[m\x1b[4l\x1b[?1h\x1b=\x1b[39;49m\x1b[39;49m\x1b[m\x1b[H\x1b[J\x1b[42;1H\x1b[?1049l\r\x1b[?1l\x1b>\x1b[2J\x1b[?1h\x1b=\x1b[?1h\x1b=\x1b[?1049h\x1b[1;42r\x1b[39;49m\x1b[m\x1b[4l\x1b[H\x1b[J\x1b[H\x1b[J\x1b[1B ## nethack.alt.org - http://nethack.alt.org/\r\x1b[1B ##\x1b[1B\x08\x08## Games on this server are recorded for in-progress viewing and playback!\x1b[6;3HNot logged in.\x1b[8;3Hl) Login\x1b[9;3Hr) Register new user\x1b[10;3Hw) Watch games in progress\x1b[12;3Hs) server info\x1b[13;3Hm) MOTD/news (updated: 2010.09.22)\x1b[15;3Hq) Quit\x1b[19;3H=> "));

            for (int y = 0; y < height; ++y)
            {
                var line = term.GetLine(y);
                for (int x = 0; x < width; ++x)
                {
                    data[y, x] = line[x];
                    Console.Write(line[x].Character == 55328 ? " " : line[x].Character);
                }
                Console.WriteLine();
            }
        }
    }
}
Output:

 ## nethack.alt.org - http://nethack.alt.org/
 ##
 ## Games on this server are recorded for in-progress viewing and playback!

  Not logged in.

  l) Login
  r) Register new user
  w) Watch games in progress

  s) server info
  m) MOTD/news (updated: 2010.09.22)

  q) Quit



  =>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 374 2/10/2023

It's released!