From 0ba06d95233c2227c1735d35d3d66b3ec64d42c6 Mon Sep 17 00:00:00 2001 From: leaf1170124460 <45704618+leaf1170124460@users.noreply.github.com> Date: Tue, 2 Jun 2020 22:25:58 +0800 Subject: [PATCH] =?UTF-8?q?F-=E5=B0=9D=E8=AF=95=E8=A7=A3=E5=86=B3=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CodeChatSDK/Utils/ChatMessageParser.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CodeChatSDK/Utils/ChatMessageParser.cs b/CodeChatSDK/Utils/ChatMessageParser.cs index 50bde3c..db7283b 100644 --- a/CodeChatSDK/Utils/ChatMessageParser.cs +++ b/CodeChatSDK/Utils/ChatMessageParser.cs @@ -91,8 +91,24 @@ public static void ParseContent(ChatMessage message) //判断是否为普通文本消息 if (message.IsPlainText == true) { - //解析内容为聊天消息 - message.Text = JsonConvert.DeserializeObject(message.Content); + try + { + //解析内容为聊天消息 + message.Text = JsonConvert.DeserializeObject(message.Content); + } + catch + { + //解析内容为聊天消息 + var chatMessage = JsonConvert.DeserializeObject(message.Content + , new JsonSerializerSettings() + { + NullValueHandling = NullValueHandling.Ignore + }); + message.Ent = chatMessage.Ent; + message.Fmt = chatMessage.Fmt; + message.Text = chatMessage.Text; + } + } else {