简体   繁体   中英

How to parse a third party console application showing the status of external process (C#)?

The following video (gif) shows a third party console application that is managing an external process.

在此处输入图像描述

I'm looking to parse the information in the standard output to show it in a WinForm (C#).

I tried various approaches (for example here ) but none seems to work, meaning nothing in the StreamReader, neither OutputDataReceived event.

If the text have new line characters, there is not issue. But is not the case with this app.

Any advice is appreciated.

Thanks

It may depend on the operating system. But it looks like the line gets rewritten . In this case you would need to read the stream buffer before it gets "committed" by a newline. (As you found out. IISC, the answer you linked uses BeginOutput ReadLine .) So, when you have your stream (eg standard input ?) You might be able to read the buffer more precisely .

Hope, I got the question right:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM