private static void SetBinaryMode(IPrimitiveSink connection)
        {
            var binaryModeCommand = new SystemCommand(SystemOp.SetBinaryMode);
            var binaryModeMessage = new MessageBuilder(binaryModeCommand);

            binaryModeMessage.Send(connection);
        }
Esempio n. 2
0
 /// <summary>
 ///     Sends each argument in this message to the given sink.
 /// </summary>
 /// <param name="primitiveSink">The (non-null) sink to send onto.</param>
 private void SendArguments(IPrimitiveSink primitiveSink)
 {
     foreach (var arg in _arguments)
     {
         arg.Send(primitiveSink);
     }
 }
Esempio n. 3
0
 /// <summary>
 ///     Sends this message to a sink, flushing at the end.
 /// </summary>
 /// <param name="primitiveSink">The (non-null) sink to send onto.</param>
 public void Send(IPrimitiveSink primitiveSink)
 {
     SendCommand(primitiveSink);
     SendLength(primitiveSink);
     SendArguments(primitiveSink);
     primitiveSink.Flush();
 }
Esempio n. 4
0
        private void SendLength(IPrimitiveSink sock)
        {
            var length = (from arg in _arguments select arg.Length).Sum();

            Debug.Assert(0 <= length, "negative length");
            sock.SendUint((uint)length);
        }
Esempio n. 5
0
 public void Send(IPrimitiveSink sock)
 {
     sock.SendFloat(Value);
 }
Esempio n. 6
0
 public void Send(IPrimitiveSink sock)
 {
     sock.SendString(Value);
 }
Esempio n. 7
0
 /// <summary>
 ///     Sends this message's command to the given sink.
 /// </summary>
 /// <param name="primitiveSink">The (non-null) sink to send onto.</param>
 private void SendCommand(IPrimitiveSink primitiveSink)
 {
     primitiveSink.SendCommand(_cmd.Packed);
 }
Esempio n. 8
0
 /// <summary>
 ///     Constructs a new <see cref="Sender" />.
 /// </summary>
 /// <param name="primitiveSink">
 ///     The <see cref="IPrimitiveSink" /> that the <see cref="Sender" /> will
 ///     send packed BapsNet messages on.
 /// </param>
 public Sender(IPrimitiveSink?primitiveSink)
 {
     _primitiveSink = primitiveSink ?? throw new ArgumentNullException(nameof(primitiveSink));
 }