【发布时间】:2016-11-29 12:58:10
【问题描述】:
我现在正在处理一个问题,我必须读取、过滤和处理控制台输出。要正确解析它几乎是不可能的,所以我的问题是是否可以使用自定义输出通道。目前我只有Console.Error 和Console.Out 可用。但这还不足以有效地将它们分开。
控制台输出示例:
Info text over many lines. It can be everything written in plain text.
Now important messages are coming I have to filter out.
Important Message for C1! It can be everything in plain text.
Important Message for C1! It can be everything in plain text.
Important Message for C1! It can be everything in plain text.
Info text over many lines. It can be everything written in plain text.
Now important messages are coming I have to filter out.
Important Message for C2! It can be everything in plain text.
Important Message for C2! It can be everything in plain text.
Important Message for C2! It can be everything in plain text.
现在我想这样写 C1 的输出:Console.C1.WriteLine("Message 1")
对于 C2:Console.C2.WriteLine("Message 2")
您可以在控制台中看到的唯一区别是颜色。也许我可以继续这个?如果是这样,那就太好了。
感谢您的帮助:D
【问题讨论】:
-
您的问题有点不具体。您能否详细说明您要分离的具体内容?
-
更新了我的问题。它可以是一切。那就是问题所在。您可以在控制台中看到的唯一区别是文本的颜色。
标签: c# output console-application