2020-03-18 16:21:29 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-03-12 16:23:21 +08:00
|
|
|
|
|
|
|
|
|
namespace LeanCloud.Realtime {
|
2020-03-16 11:50:49 +08:00
|
|
|
|
public class LCIMTextMessage : LCIMTypedMessage {
|
2020-03-17 16:17:19 +08:00
|
|
|
|
public string Text {
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
2020-03-16 11:50:49 +08:00
|
|
|
|
|
2020-03-18 16:21:29 +08:00
|
|
|
|
internal LCIMTextMessage() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LCIMTextMessage(string text) : base() {
|
2020-03-17 16:17:19 +08:00
|
|
|
|
Text = text;
|
2020-03-16 11:50:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-18 16:21:29 +08:00
|
|
|
|
internal override Dictionary<string, object> Encode() {
|
|
|
|
|
Dictionary<string, object> data = base.Encode();
|
|
|
|
|
if (!string.IsNullOrEmpty(Text)) {
|
|
|
|
|
data["_lctext"] = Text;
|
|
|
|
|
}
|
|
|
|
|
return data;
|
2020-03-17 16:17:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 17:46:45 +08:00
|
|
|
|
internal override int MessageType => TextMessageType;
|
|
|
|
|
|
2020-03-18 16:21:29 +08:00
|
|
|
|
protected override void DecodeMessageData(Dictionary<string, object> msgData) {
|
|
|
|
|
base.DecodeMessageData(msgData);
|
|
|
|
|
if (msgData.TryGetValue("_lctext", out object value)) {
|
|
|
|
|
Text = value as string;
|
|
|
|
|
}
|
2020-03-12 16:23:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|