Example #1
0
 public void Send()
 {
     lock (this) {
         if (Buffer.Length > 0)
         {
             var m = new StatusMessage(Commands.Info);
             try {
                 var text = Encoding.GetString(Buffer.ToArray());                         // might throw an exception, if buffer length is not on character borders. just wait for more text.
                 if (Channel == Channels.Output)
                 {
                     Session.SendOutput(text);
                 }
                 else
                 {
                     Session.SendError(text);
                 }
                 Buffer.SetLength(0);
             } catch { }
         }
     }
 }