public static IEnumerable <TtyRecFrame> DecodeFrames(Stream stream) { var term = Putty.CreatePuttyTerminal(80, 50); int frame_number = 0; foreach (var packet in DecodePackets(stream)) { Putty.SendPuttyTerminal(term, false, packet.Payload); if (++frame_number % 10 == 0) { var clone = Putty.ClonePuttyTerminal(term); Putty.DestroyPuttyTerminal(term); term = clone; } var frame = new TtyRecFrame() { SinceStart = packet.SinceStart , Data = new PuttyTermChar[80, 50] }; for (int y = 0; y < 50; ++y) { var line = Putty.GetPuttyTerminalLine(term, y); for (int x = 0; x < 80; ++x) { frame.Data[x, y] = line[x]; } } yield return(frame); } Putty.DestroyPuttyTerminal(term); }
public void Append(TtyRecFrame frame) { lock ( Stream ) { Stream.Seek(0, SeekOrigin.End); var bw = new BinaryWriter(Stream); var header = new Header() { SinceStart = frame.SinceStart , Width = frame.Data.GetLength(0) , Height = frame.Data.GetLength(1) , SeekPos = Stream.Length }; for (int y = 0; y < frame.Data.GetLength(1); ++y) { for (int x = 0; x < frame.Data.GetLength(0); ++x) { bw.Write(frame.Data[x, y].chr); bw.Write(frame.Data[x, y].attr); } } lock (Frames) Frames.Add(header); } }
public static IEnumerable<TtyRecFrame> DecodeFrames( Stream stream ) { var term = Putty.CreatePuttyTerminal(80,50); int frame_number = 0; foreach ( var packet in DecodePackets(stream) ) { Putty.SendPuttyTerminal( term, false, packet.Payload ); if ( ++frame_number%10 == 0 ) { var clone = Putty.ClonePuttyTerminal(term); Putty.DestroyPuttyTerminal(term); term = clone; } var frame = new TtyRecFrame() { SinceStart = packet.SinceStart , Data = new PuttyTermChar[80,50] }; for ( int y=0 ; y<50 ; ++y ) { var line = Putty.GetPuttyTerminalLine( term, y ); for ( int x=0 ; x<80 ; ++x ) frame.Data[x,y] = line[x]; } yield return frame; } Putty.DestroyPuttyTerminal(term); }
public void Append( TtyRecFrame frame ) { lock ( Stream ) { Stream.Seek(0,SeekOrigin.End); var bw = new BinaryWriter(Stream); var header = new Header() { SinceStart = frame.SinceStart , Width = frame.Data.GetLength(0) , Height = frame.Data.GetLength(1) , SeekPos = Stream.Length }; for ( int y=0 ; y<frame.Data.GetLength(1) ; ++y ) for ( int x=0 ; x<frame.Data.GetLength(0) ; ++x ) { bw.Write( frame.Data[x,y].chr ); bw.Write( frame.Data[x,y].attr ); } lock ( Frames ) Frames.Add(header); } }