Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InterceptedEventArgs"/> class.
        /// </summary>
        /// <param name="continuation">The <see cref="Func{TResult}"/> of type <see cref="Task"/> that will be invoked when <see cref="ContinueRead"/> is called.</param>
        /// <param name="step">The current count/step/order from which this data was intercepted.</param>
        /// <param name="packet">The intercepted data to read/write from.</param>
        public InterceptedEventArgs(Func<Task> continuation, int step, HMessage packet)
        {
            Executions = new List<HMessage>();

            Continuation = continuation;
            IsAsyncCapable = (Continuation != null);

            Step = step;
            Packet = packet;

            Replacement = new HMessage(
                packet.ToBytes(), packet.Destination);
        }
Ejemplo n.º 2
0
 public Task<int> SendAsync(HMessage packet)
 {
     return SendAsync(packet.ToBytes());
 }
Ejemplo n.º 3
0
 public Task<int> SendToServerAsync(byte[] data)
 {
     var outMessage = new HMessage(1, data);
     return _externalContractor.SendAsync(outMessage.ToBytes());
 }
Ejemplo n.º 4
0
 public Task<int> SendToClientAsync(ushort header, params object[] chunks)
 {
     var inMessage = new HMessage(0, HMessage.Construct(header, chunks));
     return _externalContractor.SendAsync(inMessage.ToBytes());
 }
Ejemplo n.º 5
0
 public Task<int> SendToClientAsync(byte[] data)
 {
     var inMessage = new HMessage(0, data);
     return _externalContractor.SendAsync(inMessage.ToBytes());
 }
Ejemplo n.º 6
0
 public Task<int> SendToServerAsync(ushort header, params object[] chunks)
 {
     var outMessage = new HMessage(1, HMessage.Construct(header, chunks));
     return _externalContractor.SendAsync(outMessage.ToBytes());
 }