PumpStream() public method

A function which processes the part of the stream which gets available (or does the rest of it at the end).
public PumpStream ( ) : void
return void
コード例 #1
0
ファイル: ConEmuSession.cs プロジェクト: vbjay/conemu-inside
        private AnsiLog Init_AnsiLog([NotNull] ConEmuStartInfo startinfo)
        {
            var ansilog = new AnsiLog(_dirTempWorkingFolder);

            _lifetime.Add(() => ansilog.Dispose());
            if (startinfo.AnsiStreamChunkReceivedEventSink != null)
            {
                ansilog.AnsiStreamChunkReceived += startinfo.AnsiStreamChunkReceivedEventSink;
            }

            // Do the pumping periodically (TODO: take this to async?.. but would like to keep the final evt on the home thread, unless we go to tasks)
            // TODO: if ConEmu writes to a pipe, we might be getting events when more data comes to the pipe rather than poll it by timer
            var timer = new Timer()
            {
                Interval = (int)TimeSpan.FromSeconds(.1).TotalMilliseconds, Enabled = true
            };

            timer.Tick += delegate { ansilog.PumpStream(); };
            _lifetime.Add(() => timer.Dispose());

            return(ansilog);
        }
コード例 #2
0
		private AnsiLog Init_AnsiLog([NotNull] ConEmuStartInfo startinfo)
		{
			var ansilog = new AnsiLog(_dirTempWorkingFolder);
			_lifetime.Add(() => ansilog.Dispose());
			if(startinfo.AnsiStreamChunkReceivedEventSink != null)
				ansilog.AnsiStreamChunkReceived += startinfo.AnsiStreamChunkReceivedEventSink;

			// Do the pumping periodically (TODO: take this to async?.. but would like to keep the final evt on the home thread, unless we go to tasks)
			// TODO: if ConEmu writes to a pipe, we might be getting events when more data comes to the pipe rather than poll it by timer
			var timer = new Timer() {Interval = (int)TimeSpan.FromSeconds(.1).TotalMilliseconds, Enabled = true};
			timer.Tick += delegate { ansilog.PumpStream(); };
			_lifetime.Add(() => timer.Dispose());

			return ansilog;
		}