1
czw
2025-07-02 3492292c4f006945781714b731303a12b0f1dd3a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
        }
 
    }
}