using System.Collections.Generic;
namespace LeanCloud.Realtime {
///
/// 文本消息
///
public class LCIMTextMessage : LCIMTypedMessage {
///
/// 文本
///
public string Text {
get; set;
}
internal LCIMTextMessage() {
}
public LCIMTextMessage(string text) : base() {
Text = text;
}
internal override Dictionary Encode() {
Dictionary data = base.Encode();
if (!string.IsNullOrEmpty(Text)) {
data[MessageTextKey] = Text;
}
return data;
}
public override int MessageType => TextMessageType;
internal override void Decode(Dictionary msgData) {
if (msgData.TryGetValue(MessageTextKey, out object value)) {
Text = value as string;
}
}
}
}