using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace GZ.Projects.AuxAllWCS
|
{
|
// 创建自定义的 TextWriter
|
public class ConsoleInterceptor : TextWriter
|
{
|
private readonly TextWriter _originalOut;
|
|
public ConsoleInterceptor()
|
{
|
_originalOut = Console.Out;
|
}
|
|
public override Encoding Encoding => Encoding.UTF8;
|
|
public override void WriteLine(string value = "")
|
{
|
// 在这里拦截处理输出
|
//string intercepted = $"[拦截到的输出] {value}";
|
|
//// 可以选择继续输出到原控制台
|
//_originalOut.WriteLine(intercepted);
|
}
|
|
}
|
}
|