private static void SetBinaryMode(IPrimitiveSink connection) { var binaryModeCommand = new SystemCommand(SystemOp.SetBinaryMode); var binaryModeMessage = new MessageBuilder(binaryModeCommand); binaryModeMessage.Send(connection); }
/// <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); } }
/// <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(); }
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); }
public void Send(IPrimitiveSink sock) { sock.SendFloat(Value); }
public void Send(IPrimitiveSink sock) { sock.SendString(Value); }
/// <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); }
/// <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)); }