示例#1
0
        /// <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 = _mBuffer)
            {
                fixed(long *w = v)
                L2Buffer.UnsafeCopy(w, length, buf, ref _mOffset);
            }
        }
示例#2
0
        /// <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 = _mBuffer)
            {
                fixed(double *w = v)
                L2Buffer.UnsafeCopy(w, length, buf, ref _mOffset);
            }
        }
示例#3
0
        /// <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 WriteIntArray(int[] v)
        {
            int length = v.Length * sizeof(int);

            ValidateBufferSize(Length);

            fixed(byte *buf = _mBuffer)
            {
                fixed(int *w = v)
                L2Buffer.UnsafeCopy(w, length, buf, ref _mOffset);
            }
        }
示例#4
0
        /// <summary>
        /// Writes array of <see cref="short"/> values into packet buffer.
        /// </summary>
        /// <param name="v">Array of <see cref="short"/> values.</param>
        public unsafe void WriteShort(params short[] v)
        {
            int length = v.Length * sizeof(short);

            ValidateBufferSize(length);

            fixed(byte *buf = _mBuffer)
            {
                fixed(short *w = v)
                L2Buffer.UnsafeCopy(w, length, buf, ref _mOffset);
            }
        }
示例#5
0
        /// <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 = _mBuffer)
            {
                fixed(char *w = s)
                L2Buffer.UnsafeCopy(w, length, buf, ref _mOffset);
            }
        }
示例#6
0
        /// <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.Join(string.Empty, s.Select(t => t + '\0').ToArray());

            int length = v.Length * sizeof(char);

            ValidateBufferSize(length);

            fixed(byte *buf = _mBuffer)
            {
                fixed(char *w = v)
                L2Buffer.UnsafeCopy(w, length, buf, ref _mOffset);
            }
        }