コード例 #1
0
ファイル: Base.cs プロジェクト: clarte53/clarte-utils
        /// <summary>
        /// Deserialize a 128 bits value.
        /// </summary>
        /// <param name="buffer">The buffer containing the serialized data.</param>
        /// <param name="start">The start index in the buffer of the serialized value.</param>
        /// <param name="value">The deserialized value.</param>
        /// <returns>The number of deserialized bytes.</returns>
        protected uint FromBytes(Buffer buffer, uint start, out Converter128 value)
        {
            Converter32 i1, i2, i3, i4;

            uint read = FromBytes(buffer, start, out i1);

            read += FromBytes(buffer, start + read, out i2);
            read += FromBytes(buffer, start + read, out i3);
            read += FromBytes(buffer, start + read, out i4);

            value = new Converter128(i1, i2, i3, i4);

            return(read);
        }
コード例 #2
0
ファイル: Base.cs プロジェクト: clarte53/clarte-utils
        /// <summary>
        /// Serialize a 128 bits value.
        /// </summary>
        /// <param name="buffer">The buffer where to serialize the data.</param>
        /// <param name="start">The start index in the buffer where to serialize the data.</param>
        /// <param name="value">The value to serialize.</param>
        /// <returns>The number of serialized bytes.</returns>
        public uint ToBytes(ref Buffer buffer, uint start, Converter128 value)
        {
            CheckSerializationParameters(buffer, start);

            // Resize buffer if necessary
            ResizeBuffer(ref buffer, start + decimalSize);

            uint written = ToBytes(ref buffer, start, value.Int1);

            written += ToBytes(ref buffer, start + written, value.Int2);
            written += ToBytes(ref buffer, start + written, value.Int3);
            written += ToBytes(ref buffer, start + written, value.Int4);

            return(written);
        }