Пример #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));
 }