From 6174e78696749c232255be94c2f81078ad48645d Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Sat, 25 Jul 2020 00:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=87=BA=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E7=9A=84=E6=96=87=E6=9C=AC=E7=BC=96=E7=A0=81=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Netch/Controllers/Interface/Controller.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Netch/Controllers/Interface/Controller.cs b/Netch/Controllers/Interface/Controller.cs index d6a42b6f..ff1f8851 100644 --- a/Netch/Controllers/Interface/Controller.cs +++ b/Netch/Controllers/Interface/Controller.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Text; using Netch.Models; using Netch.Utils; @@ -131,8 +132,10 @@ namespace Netch.Controllers /// 数据 protected void OnOutputDataReceived(object sender, DataReceivedEventArgs e) { + var str = Encoding.UTF8.GetString(Encoding.GetEncoding("gbk").GetBytes(e.Data??string.Empty)); + // 写入日志 - if (!Write(e.Data)) return; + if (!Write(str)) return; // 检查启动 if (State == State.Starting) @@ -146,7 +149,7 @@ namespace Netch.Controllers foreach (var s in _startedKeywords) { - if (e.Data.Contains(s)) + if (str.Contains(s)) { State = State.Started; @@ -156,7 +159,7 @@ namespace Netch.Controllers foreach (var s in _stoppedKeywords) { - if (e.Data.Contains(s)) + if (str.Contains(s)) { State = State.Stopped;