From 1fd51877853bc401e1d193ec2a9960449747862f Mon Sep 17 00:00:00 2001 From: yeziuku <53083103+yeziuku@users.noreply.github.com> Date: Sat, 9 Dec 2023 16:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BE=93=E5=87=BAError?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=9A=84=E6=96=B9=E6=B3=95=20(#69)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/AddonController.cs | 15 ++++++++++++++- Docs/FunGame.Core.xml | 12 ++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Controller/AddonController.cs b/Controller/AddonController.cs index 5021e50..feda96f 100644 --- a/Controller/AddonController.cs +++ b/Controller/AddonController.cs @@ -23,6 +23,11 @@ namespace Milimoe.FunGame.Core.Controller /// private Func MaskMethod_NewLongRunningDataRequest { get; set; } + /// + /// 输出错误消息 + /// + private Action MaskMethod_Error { get; set; } = new(e => Console.Write("\r" + e + "\n\r> ")); + /// /// 输出系统消息 /// @@ -45,7 +50,14 @@ namespace Milimoe.FunGame.Core.Controller /// /// public DataRequest NewLongRunningDataRequest(DataRequestType type) => MaskMethod_NewLongRunningDataRequest(type); - + + /// + /// 输出错误消息 + /// + /// + /// + public void Error(Exception e) => MaskMethod_Error(e); + /// /// 新建一个AddonController /// @@ -57,6 +69,7 @@ namespace Milimoe.FunGame.Core.Controller if (delegates.Length > 0) MaskMethod_WriteLine = (Action)delegates[0]; if (delegates.Length > 1) MaskMethod_NewDataRequest = (Func)delegates[1]; if (delegates.Length > 2) MaskMethod_NewLongRunningDataRequest = (Func)delegates[2]; + if (delegates.Length > 3) MaskMethod_Error = (Action)delegates[3]; MaskMethod_NewDataRequest ??= new(DefaultNewDataRequest); MaskMethod_NewLongRunningDataRequest ??= new(DefaultNewDataRequest); } diff --git a/Docs/FunGame.Core.xml b/Docs/FunGame.Core.xml index 8cb4136..ae04447 100644 --- a/Docs/FunGame.Core.xml +++ b/Docs/FunGame.Core.xml @@ -975,6 +975,11 @@ 基于本地已连接的Socket创建长时间运行的数据请求 + + + 输出错误消息 + + 输出系统消息 @@ -998,6 +1003,13 @@ + + + 输出错误消息 + + + + 新建一个AddonController