简体   繁体   English

如何解析显示外部进程(C#)状态的第三方控制台应用程序?

[英]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.以下视频 (gif) 显示了管理外部进程的第三方控制台应用程序。

在此处输入图像描述

I'm looking to parse the information in the standard output to show it in a WinForm (C#).我正在寻找解析标准 output 中的信息以在 WinForm (C#) 中显示它。

I tried various approaches (for example here ) but none seems to work, meaning nothing in the StreamReader, neither OutputDataReceived event.我尝试了各种方法(例如here ),但似乎都不起作用,这意味着 StreamReader 中没有任何内容,也没有 OutputDataReceived 事件。

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.在这种情况下,您需要在 stream 缓冲区被换行符“提交”之前读取它。 (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 . (正如您所发现的。IISC,您链接的答案使用 BeginOutput ReadLine 。)因此,当您拥有 stream (例如标准输入?)您可能能够更精确地读取缓冲区。

Hope, I got the question right:)希望,我的问题是对的:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 禁用C#控制台应用程序中的跟踪,包括第三方引用 - Disable tracing in C# Console Application including third party references C#-如何在第三方应用程序中设置服务参考配置 - C# - How to set service reference configuration in a third party application 如何在我的 C# 应用程序中调用第三方 exe? - How to call an third party exe within my C# application? Ruby或C#:如何编写控制台应用程序以向Twitter发布状态 - Ruby or C#: how to write a console application to post a status to Twitter 在不使用第三方记录器的情况下登录C#应用程序 - Logging in C# application without using third party logger 使用Windows C#第三方程序更改IOS应用程序名称 - Change IOS Application Name with windows C# third party program 没有第三方库的文本解析应用程序c# - text parsing application c# without third party libraries 如何在包含第三方DLL文件的同时部署C#应用程序? - How to deploy a C# application while including third-party DLL files? 如何使用C#查找第三方应用程序(如Google Earth)的安装目录? - How to find the installation directory of a third-party application, such as Google Earth, using C#? 如何使用C#在控制台应用程序中执行命令或进程 - How to Execute a command or process in Console application using C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM