如何将 ReadMessage 和 WriteMessage 映射到可以控制类库之外的消息编码的事件?
public class CustomMessageEncoder:MessageEncoder
{
public delegate Message ReadMessage_dlg(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType);
public delegate Message ReadMessage_dlg(System.IO.Stream stream, int maxSizeOfHeaders, string contentType);
public static event ReadMessage_dlg OnReadMessage;
public delegate ArraySegment<byte> WriteMessage_dlg(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset);
public delegate void WriteMessage_dlg(Message message, System.IO.Stream stream);
public static event WriteMessage_dlg OnWriteMessage;
.
.
.
public override Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType)
{
throw new NotImplementedException();
}
public override Message ReadMessage(System.IO.Stream stream, int maxSizeOfHeaders, string contentType)
{
throw new NotImplementedException();
}
public override ArraySegment<byte> WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset)
{
throw new NotImplementedException();
}
public override void WriteMessage(Message message, System.IO.Stream stream)
{
throw new NotImplementedException();
}
}
我只想要 StrongType (没有动态/参数对象 [] ) onReadMessage 和 onWriteMessage 事件有没有办法重载可以接受两个方法的委托/事件?