public Stream CreateResponseStream(string requestId)
        {
            _logger?.Verbose("Creating write stream for storing response body. request-id={RequestId}", requestId);

            var ms = new NotifyingMemoryStream();
            ms.Disposing += (s, e) => _responseData[requestId] = new Entry(ms.ToArray(), _storagePeriod);
            return ms;
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public ScriptCommandWindow()
        {
            InitializeComponent();
            this.SWMessageText.Font = this.SWCommandText.Font = new Font(
                FontFamily.GenericMonospace, 9.0f
            );
            this.Name = "ScriptWindow";
            this.Text = MessageResources.ScriptWindow;
            this.TabText = this.Text;

            m_defaultFont = SWMessageText.SelectionFont;
            m_defaultTextColor = SWMessageText.SelectionColor;
            m_boldFont = new Font(m_defaultFont, FontStyle.Bold);
            m_consoleOutput = new NotifyingMemoryStream();
            m_consoleOutput.StreamFlushed +=
                delegate(NotifyingMemoryStream s, long prevPos)
                {
                    SWCommandText.Invoke(new MethodInvoker(Flush));
                };
            m_statementBuffer = new StringBuilder();
            m_currentPromptCharCount = 0;
            m_scriptRunner = new ScriptRunner(this);
            ResetCommandLineControl();
            Flush();
            Disposed +=
                delegate(object o, EventArgs e)
                {
                    m_scriptRunner.Stop();
                };
            WriteHeader();
        }