コード例 #1
0
 public override T DeserializeFromStream <T>(Stream stream)
 {
     try
     {
         var serializer = MessagePackSerializer.Create <T>();
         var obj        = serializer.Unpack(stream);
         return(obj);
     }
     catch (Exception ex)
     {
         return((T)MsgPackFormat.HandleException(ex, typeof(T)));
     }
 }
コード例 #2
0
 public override void SerializeToStream(IRequestContext requestContext, object request, Stream stream)
 {
     if (request == null)
     {
         return;
     }
     try
     {
         MsgPackFormat.Serialize(requestContext, request, stream);
     }
     catch (Exception ex)
     {
         MsgPackFormat.HandleException(ex, request.GetType());
     }
 }