示例#1
0
 /// <summary>
 /// 设置消息数据
 /// </summary>
 /// <param name="model">消息model</param>
 public void SetData(object model)
 {
     this.Data = SerializerUtils.Serialize(model);
 }
示例#2
0
 /// <summary>
 /// 序列化消息
 /// </summary>
 /// <returns></returns>
 public byte[] Serialize()
 {
     return(SerializerUtils.Serialize(this));
 }
示例#3
0
 /// <summary>
 /// 获取消息数据
 /// </summary>
 /// <param name="type">消息model type</param>
 /// <returns>消息model</returns>
 public object GetData(Type type)
 {
     return(SerializerUtils.Deserialize(type, this.Data));
 }
示例#4
0
 /// <summary>
 /// 反序列化消息
 /// </summary>
 /// <param name="buffer"></param>
 /// <returns></returns>
 public static MsgData Deserialize(byte[] buffer)
 {
     return(SerializerUtils.Deserialize <MsgData>(buffer));
 }
示例#5
0
 /// <summary>
 /// 获取消息数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public T GetData <T>()
 {
     return(SerializerUtils.Deserialize <T>(this.Data));
 }