public MessageAsyncResult(object caller, Message request, AsyncCallback callback, object state) { _caller = caller; _request = request; _asyncCallback = callback; _asyncState = state; Trace.TraceInformation("MessageAsyncResult#" + ValidationHelper.HashString(this) + "::.ctor()"); }
public void Serialize(Stream stream, Message message) { Debug.Assert(message.Identity.SubCommand == SubCommand.Response || message.Identity.SubCommand == SubCommand.Request, "Message send to the CAPI from application can be request or response."); BinaryWriter writer = new BinaryWriter(stream, Encoding.ASCII); MessageHeader header = new MessageHeader(); header.Command = message.Identity.Command; header.SubCommand = message.Identity.SubCommand; header.AppID = (short)_application.AppID; header.ID = message.Number; ((ICapiSerializable)header).Write(writer); ((ICapiSerializable)message).Write(writer); header.TotalLength = (Int16)stream.Length; writer.Seek(0, SeekOrigin.Begin); writer.Write(header.TotalLength); }
public MessageEventArgs(Message message) { _message = message; }
public ControllerEventArgs(Message message, Connection connection) : base(message) { _connection = connection; }
public void SendMessage(Message message) { using (MemoryStream stream = new MemoryStream()) { if (message.Identity.SubCommand == SubCommand.Request && message.Number == 0) { message.Number = GetUniqueMessageNumber(); } _serializer.Serialize(stream, message); CapiPInvoke.PutMessage(_appID, stream); } }