private void ProcessTransferInEvent(ConsoleTransferEventStruct e) { using (_logger.CreateCallstack()) { _logger.WriteLine("Len [{0}]", e.Len); if (StdIn == null) { throw _logger.WriteException(new InvalidOperationException("Unexpected data request")); } try { int len = (int)e.Len; len = StdIn.Read(e.Data, 0, len); _logger.WriteLine("{0} bytes read", len); e.Len = (UIntPtr)len; } catch (Exception ex) { _logger.WriteLine("Error reading data stream"); _logger.WriteException(ex); e.Error = true; } } }
private void ProcessTransferOutEvent(ConsoleTransferEventStruct e) { using (_logger.CreateCallstack()) { _logger.WriteLine("Len [{0}]", e.Len); if (StdOut == null) { throw _logger.WriteException(new InvalidOperationException("Unexpected data")); } int len = (int)e.Len; if (len > 0) { StdOut.WriteInternal(e.Data, 0, len); _logger.WriteLine("Data written to the buffer"); } else { StdOut.CloseWrite(); _logger.WriteLine("Data buffer closed"); } } }