1
czw
2025-07-02 f156f02ad009105233eadfedb28938747c60cdc9
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;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 
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 values = (string)AutoThread.InvokeMethod(AutoThread.Instance, "WriteLine", new object[] { value });
            //// 可以选择继续输出到原控制台
            if (!string.IsNullOrEmpty(values))
                _originalOut.WriteLine(values);
        }
 
    }
}