/// <summary> /// Writes array of <see cref="double"/> values into packet buffer. /// </summary> /// <param name="v">Array of <see cref="double"/> values.</param> public unsafe void WriteDouble(params double[] v) { int length = v.Length * sizeof(double); ValidateBufferSize(length); fixed(byte *buf = m_Buffer) fixed(double *w = v) L2Buffer.UnsafeCopy(w, length, buf, ref m_Offset); }
/// <summary> /// Writes array of <see cref="long"/> values into packet buffer. /// </summary> /// <param name="v">Array of <see cref="long"/> values.</param> public unsafe void WriteLong(params long[] v) { int length = v.Length * sizeof(long); ValidateBufferSize(length); fixed(byte *buf = m_Buffer) fixed(long *w = v) L2Buffer.UnsafeCopy(w, length, buf, ref m_Offset); }
/// <summary> /// Writes array of <see cref="int"/> values into packet buffer. /// </summary> /// <param name="v">Array of <see cref="int"/> values.</param> public unsafe void WriteInt(params int[] v) { int length = v.Length * sizeof(int); ValidateBufferSize(Length); fixed(byte *buf = m_Buffer) fixed(int *w = v) L2Buffer.UnsafeCopy(w, length, buf, ref m_Offset); }
/// <summary> /// Writes <see cref="string"/> object into packet buffer. /// </summary> /// <param name="s"><see cref="string"/> value.</param> public unsafe void WriteString(string s) { s += '\0'; int length = s.Length * sizeof(char); ValidateBufferSize(length); fixed(byte *buf = m_Buffer) fixed(char *w = s) L2Buffer.UnsafeCopy(w, length, buf, ref m_Offset); }
/// <summary> /// Writes array of <see cref="string"/> values to packet buffer. /// </summary> /// <param name="s">Array of <see cref="string"/> values.</param> public unsafe void WriteString(params string[] s) { string v = String.Empty; for (int i = 0; i < s.Length; i++) { v += s[i] + '\0'; } int length = v.Length * sizeof(char); ValidateBufferSize(length); fixed(byte *buf = m_Buffer) fixed(char *w = v) L2Buffer.UnsafeCopy(w, length, buf, ref m_Offset); }