/// <summary> /// Updates the data length to be sent to the remote system. /// </summary> /// <param name="formatterContext"> /// It's the message formatter context. /// </param> protected override void UpdateDataLengthHeader(ref FormatterContext formatterContext) { byte[] buffer = formatterContext.GetBuffer(); int length = formatterContext.DataLength - 2; buffer[0] = ( byte)(length >> 8); buffer[1] = ( byte)length; }
/// <summary> /// Updates the data length to be sent to the remote system. /// </summary> /// <param name="formatterContext"> /// It's the message formatter context. /// </param> protected override void UpdateDataLengthHeader(ref FormatterContext formatterContext) { byte[] buffer = formatterContext.GetBuffer(); int length = formatterContext.DataLength - 4; for (int i = 3; i >= 0; i--) { buffer[i] = Convert.ToByte((length % 10) + 0x30); length /= 10; } }